Skip to content

Commit

Permalink
refactor(backend): add abstraction
Browse files Browse the repository at this point in the history
Add abstraction to handle mocking in tests.
  • Loading branch information
Sikora00 committed Oct 9, 2020
1 parent 5244ed4 commit 97dfed2
Show file tree
Hide file tree
Showing 132 changed files with 2,712 additions and 473 deletions.
2 changes: 2 additions & 0 deletions .env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ DB_PASSWORD=sdj123123
DB_ROOT_PASSWORD=rootPass123
DB_USERNAME=sdj

JWT_SECRET=somecomplextext

NG_CONTAINER_NAME=slack_dj_ng
NG_EXTERNAL_STREAM=stream.open.fm/109
NG_URL=radio.local
Expand Down
225 changes: 225 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,231 @@
}
}
}
},
"backend-radio-infrastructure-slack-api": {
"root": "libs/backend/radio/infrastructure-slack-api",
"sourceRoot": "libs/backend/radio/infrastructure-slack-api/src",
"projectType": "library",
"schematics": {},
"architect": {
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"libs/backend/radio/infrastructure-slack-api/tsconfig.lib.json",
"libs/backend/radio/infrastructure-slack-api/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**",
"!libs/backend/radio/infrastructure-slack-api/**/*"
]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "libs/backend/radio/infrastructure-slack-api/jest.config.js",
"passWithNoTests": true
}
}
}
},
"backend-auth-core-application-services": {
"root": "libs/backend/auth/core/application-services",
"sourceRoot": "libs/backend/auth/core/application-services/src",
"projectType": "library",
"schematics": {},
"architect": {
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"libs/backend/auth/core/application-services/tsconfig.lib.json",
"libs/backend/auth/core/application-services/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**",
"!libs/backend/auth/core/application-services/**/*"
]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "libs/backend/auth/core/application-services/jest.config.js",
"passWithNoTests": true
}
}
}
},
"backend-auth-ui-rest": {
"root": "libs/backend/auth/ui-rest",
"sourceRoot": "libs/backend/auth/ui-rest/src",
"projectType": "library",
"schematics": {},
"architect": {
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"libs/backend/auth/ui-rest/tsconfig.lib.json",
"libs/backend/auth/ui-rest/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**", "!libs/backend/auth/ui-rest/**/*"]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "libs/backend/auth/ui-rest/jest.config.js",
"passWithNoTests": true
}
}
}
},
"shared-auth-core-domain": {
"root": "libs/shared/auth/core/domain",
"sourceRoot": "libs/shared/auth/core/domain/src",
"projectType": "library",
"schematics": {},
"architect": {
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"libs/shared/auth/core/domain/tsconfig.lib.json",
"libs/shared/auth/core/domain/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**",
"!libs/shared/auth/core/domain/**/*"
]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "libs/shared/auth/core/domain/jest.config.js",
"passWithNoTests": true
}
}
}
},
"ng-auth-infrastructure-local-storage": {
"projectType": "library",
"root": "libs/ng/auth/infrastructure-local-storage",
"sourceRoot": "libs/ng/auth/infrastructure-local-storage/src",
"prefix": "sdj",
"architect": {
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"libs/ng/auth/infrastructure-local-storage/tsconfig.lib.json",
"libs/ng/auth/infrastructure-local-storage/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**",
"!libs/ng/auth/infrastructure-local-storage/**/*"
]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "libs/ng/auth/infrastructure-local-storage/jest.config.js",
"passWithNoTests": true
}
}
},
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
}
},
"ng-auth-shell": {
"projectType": "library",
"root": "libs/ng/auth/shell",
"sourceRoot": "libs/ng/auth/shell/src",
"prefix": "sdj",
"architect": {
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"libs/ng/auth/shell/tsconfig.lib.json",
"libs/ng/auth/shell/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**", "!libs/ng/auth/shell/**/*"]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "libs/ng/auth/shell/jest.config.js",
"passWithNoTests": true
}
}
},
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
}
},
"backend-auth-core-domain": {
"root": "libs/backend/auth/core/domain",
"sourceRoot": "libs/backend/auth/core/domain/src",
"projectType": "library",
"schematics": {},
"architect": {
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"libs/backend/auth/core/domain/tsconfig.lib.json",
"libs/backend/auth/core/domain/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**",
"!libs/backend/auth/core/domain/**/*"
]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "libs/backend/auth/core/domain/jest.config.js",
"passWithNoTests": true
}
}
}
},
"backend-auth-api": {
"root": "libs/backend/auth/api",
"sourceRoot": "libs/backend/auth/api/src",
"projectType": "library",
"schematics": {},
"architect": {
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"libs/backend/auth/api/tsconfig.lib.json",
"libs/backend/auth/api/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**", "!libs/backend/auth/api/**/*"]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "libs/backend/auth/api/jest.config.js",
"passWithNoTests": true
}
}
}
}
},
"cli": {
Expand Down
2 changes: 2 additions & 0 deletions apps/backend/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Module } from '@nestjs/common';
import { BackendAuthUiRestModule } from '@sdj/backend/auth/ui-rest';
import { BackendRadioUiRedisModule } from '@sdj/backend/radio/ui-redis';
import { BackendRadioUiRestModule } from '@sdj/backend/radio/ui-rest';
import { SlackModule } from '@sdj/backend/radio/ui-slack';
Expand All @@ -7,6 +8,7 @@ import { BackendSharedKernelModule } from '@sdj/backend/shared/kernel';

@Module({
imports: [
BackendAuthUiRestModule,
BackendSharedKernelModule,
BackendRadioUiRestModule,
WebSocketModule,
Expand Down
1 change: 0 additions & 1 deletion apps/backend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ async function bootstrap(): Promise<void> {
res.set('Access-Control-Allow-Origin', '*');
},
});
app.enableCors();

return app.listen(port, () => {
Logger.log('Listening at http://localhost:' + port + '/' + globalPrefix);
Expand Down
128 changes: 65 additions & 63 deletions apps/ng-e2e/src/fixtures/channels.response.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,67 @@
{
"C9R4N7K7T": {
"id": "C9R4N7K7T",
"defaultStreamUrl": null,
"isRunning": false,
"name": null,
"usersOnline": 0
},
"C9RQHAD53": {
"id": "C9RQHAD53",
"defaultStreamUrl": "",
"isRunning": false,
"name": "general",
"usersOnline": 0
},
"CF2H8APEH": {
"id": "CF2H8APEH",
"defaultStreamUrl": null,
"isRunning": false,
"name": null,
"usersOnline": 0
},
"CFB1KBLNM": {
"id": "CFB1KBLNM",
"defaultStreamUrl": null,
"isRunning": false,
"name": null,
"usersOnline": 0
},
"CL01K3GUT": {
"id": "CL01K3GUT",
"defaultStreamUrl": null,
"isRunning": false,
"name": null,
"usersOnline": 0
},
"CL4U9684R": {
"id": "CL4U9684R",
"defaultStreamUrl": "https://n-6-12.dcs.redcdn.pl/sc/o2/Eurozet/live/audio.livx?audio=5",
"isRunning": false,
"name": null,
"usersOnline": 0
},
"CQUS4F2AV": {
"id": "CQUS4F2AV",
"defaultStreamUrl": null,
"isRunning": false,
"name": null,
"usersOnline": 0
},
"CRUFLRV9N": {
"id": "CRUFLRV9N",
"defaultStreamUrl": null,
"isRunning": false,
"name": null,
"usersOnline": 0
},
"GLTDVB5M5": {
"id": "GLTDVB5M5",
"defaultStreamUrl": null,
"isRunning": false,
"name": null,
"usersOnline": 0
}
"channels": [
{
"id": "C9R4N7K7T",
"defaultStreamUrl": null,
"isRunning": false,
"name": null,
"usersOnline": 0
},
{
"id": "C9RQHAD53",
"defaultStreamUrl": "",
"isRunning": false,
"name": "general",
"usersOnline": 0
},
{
"id": "CF2H8APEH",
"defaultStreamUrl": null,
"isRunning": false,
"name": null,
"usersOnline": 0
},
{
"id": "CFB1KBLNM",
"defaultStreamUrl": null,
"isRunning": false,
"name": null,
"usersOnline": 0
},
{
"id": "CL01K3GUT",
"defaultStreamUrl": null,
"isRunning": false,
"name": null,
"usersOnline": 0
},
{
"id": "CL4U9684R",
"defaultStreamUrl": "https://n-6-12.dcs.redcdn.pl/sc/o2/Eurozet/live/audio.livx?audio=5",
"isRunning": false,
"name": null,
"usersOnline": 0
},
{
"id": "CQUS4F2AV",
"defaultStreamUrl": null,
"isRunning": false,
"name": null,
"usersOnline": 0
},
{
"id": "CRUFLRV9N",
"defaultStreamUrl": null,
"isRunning": false,
"name": null,
"usersOnline": 0
},
{
"id": "GLTDVB5M5",
"defaultStreamUrl": null,
"isRunning": false,
"name": null,
"usersOnline": 0
}
]
}
Loading

0 comments on commit 97dfed2

Please sign in to comment.