diff --git a/.github/workflows/aws-ecr-push.yml b/.github/workflows/aws-ecr-push.yml index 1d06e21..feb6ec0 100644 --- a/.github/workflows/aws-ecr-push.yml +++ b/.github/workflows/aws-ecr-push.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: - service: [service-app, service-capital, service-clans, service-wars] + service: [service-auth, service-capital, service-clans, service-wars] runs-on: buildjet-4vcpu-ubuntu-2204-arm diff --git a/.vscode/settings.json b/.vscode/settings.json index 9729a01..de5420f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,8 @@ { "editor.formatOnSave": true, - "editor.codeActionsOnSave": { "source.organizeImports": "explicit" }, + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + }, "editor.tabSize": 2, "editor.detectIndentation": false, "editor.insertSpaces": true, diff --git a/apps/service-app/src/app.controller.ts b/apps/service-app/src/app.controller.ts deleted file mode 100644 index cce879e..0000000 --- a/apps/service-app/src/app.controller.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; -import { AppService } from './app.service'; - -@Controller() -export class AppController { - constructor(private readonly appService: AppService) {} - - @Get() - getHello(): string { - return this.appService.getHello(); - } -} diff --git a/apps/service-auth/src/auth.controller.ts b/apps/service-auth/src/auth.controller.ts new file mode 100644 index 0000000..758fe3b --- /dev/null +++ b/apps/service-auth/src/auth.controller.ts @@ -0,0 +1,12 @@ +import { Controller, Get } from '@nestjs/common'; +import { AuthService } from './auth.service'; + +@Controller() +export class AuthController { + constructor(private readonly authService: AuthService) {} + + @Get() + getHello(): string { + return this.authService.getHello(); + } +} diff --git a/apps/service-app/src/app.module.ts b/apps/service-auth/src/auth.module.ts similarity index 63% rename from apps/service-app/src/app.module.ts rename to apps/service-auth/src/auth.module.ts index 596c06d..d627f26 100644 --- a/apps/service-app/src/app.module.ts +++ b/apps/service-auth/src/auth.module.ts @@ -3,12 +3,12 @@ import { RedisModule } from '@app/redis'; import { RestModule } from '@app/rest'; import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; -import { AppController } from './app.controller'; -import { AppService } from './app.service'; +import { AuthController } from './auth.controller'; +import { AuthService } from './auth.service'; @Module({ imports: [ConfigModule.forRoot({ isGlobal: true }), MongodbModule, RedisModule, RestModule], - controllers: [AppController], - providers: [AppService], + controllers: [AuthController], + providers: [AuthService], }) -export class AppModule {} +export class AuthModule {} diff --git a/apps/service-app/src/app.service.ts b/apps/service-auth/src/auth.service.ts similarity index 96% rename from apps/service-app/src/app.service.ts rename to apps/service-auth/src/auth.service.ts index 2b89d88..5f09e26 100644 --- a/apps/service-app/src/app.service.ts +++ b/apps/service-auth/src/auth.service.ts @@ -6,7 +6,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { Db } from 'mongodb'; @Injectable() -export class AppService { +export class AuthService { constructor( @Inject(Tokens.MONGODB) private readonly db: Db, @Inject(Tokens.REDIS) private readonly redis: RedisClient, diff --git a/apps/service-app/src/main.ts b/apps/service-auth/src/main.ts similarity index 61% rename from apps/service-app/src/main.ts rename to apps/service-auth/src/main.ts index 00b30e0..2c2ac2f 100644 --- a/apps/service-app/src/main.ts +++ b/apps/service-auth/src/main.ts @@ -1,14 +1,14 @@ -import { NestFactory } from '@nestjs/core'; -import { AppModule } from './app.module'; import { Logger } from '@nestjs/common'; +import { NestFactory } from '@nestjs/core'; +import { AuthModule } from './auth.module'; async function bootstrap() { - const app = await NestFactory.create(AppModule); + const app = await NestFactory.create(AuthModule); const logger = new Logger('NestApplication'); const port = process.env.PORT || 8081; await app.listen(port); - logger.log(`Service-App: http://localhost:${port}`); + logger.log(`Service-Auth: http://localhost:${port}`); } bootstrap(); diff --git a/apps/service-app/test/app.e2e-spec.ts b/apps/service-auth/test/app.e2e-spec.ts similarity index 80% rename from apps/service-app/test/app.e2e-spec.ts rename to apps/service-auth/test/app.e2e-spec.ts index 888ae3d..69c82eb 100644 --- a/apps/service-app/test/app.e2e-spec.ts +++ b/apps/service-auth/test/app.e2e-spec.ts @@ -1,14 +1,14 @@ import { INestApplication } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; import request from 'supertest'; -import { AppModule } from '../src/app.module'; +import { AuthModule } from '../src/auth.module'; -describe('AppController (e2e)', () => { +describe('AuthController (e2e)', () => { let app: INestApplication; beforeEach(async () => { const moduleFixture: TestingModule = await Test.createTestingModule({ - imports: [AppModule], + imports: [AuthModule], }).compile(); app = moduleFixture.createNestApplication(); diff --git a/apps/service-app/test/jest-e2e.json b/apps/service-auth/test/jest-e2e.json similarity index 100% rename from apps/service-app/test/jest-e2e.json rename to apps/service-auth/test/jest-e2e.json diff --git a/apps/service-app/tsconfig.app.json b/apps/service-auth/tsconfig.app.json similarity index 80% rename from apps/service-app/tsconfig.app.json rename to apps/service-auth/tsconfig.app.json index 6b55eeb..ee46ac0 100644 --- a/apps/service-app/tsconfig.app.json +++ b/apps/service-auth/tsconfig.app.json @@ -2,7 +2,7 @@ "extends": "../../tsconfig.json", "compilerOptions": { "declaration": false, - "outDir": "../../dist/apps/service-app" + "outDir": "../../dist/apps/service-auth" }, "include": ["src/**/*"], "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] diff --git a/docker-compose.yml b/docker-compose.yml index 1821aed..bdb7743 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,9 @@ version: '3.6' services: - service-app: - image: 432159388664.dkr.ecr.us-east-1.amazonaws.com/service-app:latest - container_name: service-app + service-auth: + image: 432159388664.dkr.ecr.us-east-1.amazonaws.com/service-auth:latest + container_name: service-auth restart: always # build: # context: . diff --git a/nest-cli.json b/nest-cli.json index 9eea565..a2ea0ca 100644 --- a/nest-cli.json +++ b/nest-cli.json @@ -1,26 +1,26 @@ { "$schema": "https://json.schemastore.org/nest-cli", "collection": "@nestjs/schematics", - "sourceRoot": "apps/service-app/src", + "sourceRoot": "apps/service-auth/src", "compilerOptions": { "deleteOutDir": true, "webpack": true, - "tsConfigPath": "apps/service-app/tsconfig.app.json" + "tsConfigPath": "apps/service-auth/tsconfig.app.json" }, "generateOptions": { "spec": false, "flat": true }, "monorepo": true, - "root": "apps/service-app", + "root": "apps/service-auth", "projects": { - "service-app": { + "service-auth": { "type": "application", - "root": "apps/service-app", + "root": "apps/service-auth", "entryFile": "main", - "sourceRoot": "apps/service-app/src", + "sourceRoot": "apps/service-auth/src", "compilerOptions": { - "tsConfigPath": "apps/service-app/tsconfig.app.json" + "tsConfigPath": "apps/service-auth/tsconfig.app.json" } }, "service-capital": { @@ -123,4 +123,4 @@ } } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 8c293e9..247663b 100644 --- a/package.json +++ b/package.json @@ -11,13 +11,13 @@ "start": "nest start", "start:dev": "nest start --watch", "start:debug": "nest start --debug --watch", - "start:prod": "node dist/apps/service-app/main", + "start:prod": "node dist/apps/service-auth/main", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "test": "jest", "test:watch": "jest --watch", "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", - "test:e2e": "jest --config ./apps/service-app/test/jest-e2e.json" + "test:e2e": "jest --config ./apps/service-auth/test/jest-e2e.json" }, "dependencies": { "@elastic/elasticsearch": "^8.9.0",