From c34b15c0f4226169dd5ad0d720eeaf8adc42c9fa Mon Sep 17 00:00:00 2001 From: sbriat Date: Fri, 31 Mar 2023 10:33:59 +0200 Subject: [PATCH] refactore module name --- src/app.module.ts | 4 ++-- src/main.ts | 2 +- .../adapters/primaries/user.controller.ts} | 2 +- .../{users => user}/adapters/primaries/user.presenter.ts | 0 src/modules/{users => user}/adapters/primaries/user.proto | 0 .../{users => user}/adapters/secondaries/messager.ts | 0 .../adapters/secondaries/users.repository.ts | 0 src/modules/{users => user}/commands/create-user.command.ts | 0 src/modules/{users => user}/commands/delete-user.command.ts | 0 src/modules/{users => user}/commands/update-user.command.ts | 0 .../{users => user}/domain/dtos/create-user.request.ts | 0 .../{users => user}/domain/dtos/find-all-users.request.ts | 0 .../domain/dtos/find-user-by-uuid.request.ts | 0 .../{users => user}/domain/dtos/update-user.request.ts | 0 src/modules/{users => user}/domain/entities/user.ts | 0 .../{users => user}/domain/interfaces/message-broker.ts | 0 .../{users => user}/domain/usecases/create-user.usecase.ts | 0 .../{users => user}/domain/usecases/delete-user.usecase.ts | 0 .../domain/usecases/find-all-users.usecase.ts | 0 .../domain/usecases/find-user-by-uuid.usecase.ts | 0 .../{users => user}/domain/usecases/update-user.usecase.ts | 0 src/modules/{users => user}/mappers/user.profile.ts | 0 src/modules/{users => user}/queries/find-all-users.query.ts | 0 .../{users => user}/queries/find-user-by-uuid.query.ts | 0 .../tests/integration/users.repository.spec.ts | 0 .../{users => user}/tests/unit/create-user.usecase.spec.ts | 0 .../{users => user}/tests/unit/delete-user.usecase.spec.ts | 0 .../tests/unit/find-all-users.usecase.spec.ts | 0 .../tests/unit/find-user-by-uuid.usecase.spec.ts | 0 src/modules/{users => user}/tests/unit/messager.spec.ts | 0 .../{users => user}/tests/unit/update-user.usecase.spec.ts | 0 src/modules/{users/users.module.ts => user/user.module.ts} | 6 +++--- src/utils/tests/unit/rpc-validation-pipe.usecase.spec.ts | 2 +- 33 files changed, 8 insertions(+), 8 deletions(-) rename src/modules/{users/adapters/primaries/users.controller.ts => user/adapters/primaries/user.controller.ts} (99%) rename src/modules/{users => user}/adapters/primaries/user.presenter.ts (100%) rename src/modules/{users => user}/adapters/primaries/user.proto (100%) rename src/modules/{users => user}/adapters/secondaries/messager.ts (100%) rename src/modules/{users => user}/adapters/secondaries/users.repository.ts (100%) rename src/modules/{users => user}/commands/create-user.command.ts (100%) rename src/modules/{users => user}/commands/delete-user.command.ts (100%) rename src/modules/{users => user}/commands/update-user.command.ts (100%) rename src/modules/{users => user}/domain/dtos/create-user.request.ts (100%) rename src/modules/{users => user}/domain/dtos/find-all-users.request.ts (100%) rename src/modules/{users => user}/domain/dtos/find-user-by-uuid.request.ts (100%) rename src/modules/{users => user}/domain/dtos/update-user.request.ts (100%) rename src/modules/{users => user}/domain/entities/user.ts (100%) rename src/modules/{users => user}/domain/interfaces/message-broker.ts (100%) rename src/modules/{users => user}/domain/usecases/create-user.usecase.ts (100%) rename src/modules/{users => user}/domain/usecases/delete-user.usecase.ts (100%) rename src/modules/{users => user}/domain/usecases/find-all-users.usecase.ts (100%) rename src/modules/{users => user}/domain/usecases/find-user-by-uuid.usecase.ts (100%) rename src/modules/{users => user}/domain/usecases/update-user.usecase.ts (100%) rename src/modules/{users => user}/mappers/user.profile.ts (100%) rename src/modules/{users => user}/queries/find-all-users.query.ts (100%) rename src/modules/{users => user}/queries/find-user-by-uuid.query.ts (100%) rename src/modules/{users => user}/tests/integration/users.repository.spec.ts (100%) rename src/modules/{users => user}/tests/unit/create-user.usecase.spec.ts (100%) rename src/modules/{users => user}/tests/unit/delete-user.usecase.spec.ts (100%) rename src/modules/{users => user}/tests/unit/find-all-users.usecase.spec.ts (100%) rename src/modules/{users => user}/tests/unit/find-user-by-uuid.usecase.spec.ts (100%) rename src/modules/{users => user}/tests/unit/messager.spec.ts (100%) rename src/modules/{users => user}/tests/unit/update-user.usecase.spec.ts (100%) rename src/modules/{users/users.module.ts => user/user.module.ts} (94%) diff --git a/src/app.module.ts b/src/app.module.ts index 1ae5ffc..12ac182 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -4,13 +4,13 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; import { ConfigurationModule } from './modules/configuration/configuration.module'; import { HealthModule } from './modules/health/health.module'; -import { UsersModule } from './modules/users/users.module'; +import { UserModule } from './modules/user/user.module'; @Module({ imports: [ ConfigModule.forRoot({ isGlobal: true }), AutomapperModule.forRoot({ strategyInitializer: classes() }), - UsersModule, + UserModule, ConfigurationModule, HealthModule, ], diff --git a/src/main.ts b/src/main.ts index 89f98fc..8d6da51 100644 --- a/src/main.ts +++ b/src/main.ts @@ -11,7 +11,7 @@ async function bootstrap() { options: { package: ['user', 'health'], protoPath: [ - join(__dirname, 'modules/users/adapters/primaries/user.proto'), + join(__dirname, 'modules/user/adapters/primaries/user.proto'), join(__dirname, 'modules/health/adapters/primaries/health.proto'), ], url: process.env.SERVICE_URL + ':' + process.env.SERVICE_PORT, diff --git a/src/modules/users/adapters/primaries/users.controller.ts b/src/modules/user/adapters/primaries/user.controller.ts similarity index 99% rename from src/modules/users/adapters/primaries/users.controller.ts rename to src/modules/user/adapters/primaries/user.controller.ts index b48d00f..dcbfee7 100644 --- a/src/modules/users/adapters/primaries/users.controller.ts +++ b/src/modules/user/adapters/primaries/user.controller.ts @@ -31,7 +31,7 @@ import { RpcValidationPipe } from '../../../../utils/pipes/rpc.validation-pipe'; }), ) @Controller() -export class UsersController { +export class UserController { constructor( private readonly _commandBus: CommandBus, private readonly _queryBus: QueryBus, diff --git a/src/modules/users/adapters/primaries/user.presenter.ts b/src/modules/user/adapters/primaries/user.presenter.ts similarity index 100% rename from src/modules/users/adapters/primaries/user.presenter.ts rename to src/modules/user/adapters/primaries/user.presenter.ts diff --git a/src/modules/users/adapters/primaries/user.proto b/src/modules/user/adapters/primaries/user.proto similarity index 100% rename from src/modules/users/adapters/primaries/user.proto rename to src/modules/user/adapters/primaries/user.proto diff --git a/src/modules/users/adapters/secondaries/messager.ts b/src/modules/user/adapters/secondaries/messager.ts similarity index 100% rename from src/modules/users/adapters/secondaries/messager.ts rename to src/modules/user/adapters/secondaries/messager.ts diff --git a/src/modules/users/adapters/secondaries/users.repository.ts b/src/modules/user/adapters/secondaries/users.repository.ts similarity index 100% rename from src/modules/users/adapters/secondaries/users.repository.ts rename to src/modules/user/adapters/secondaries/users.repository.ts diff --git a/src/modules/users/commands/create-user.command.ts b/src/modules/user/commands/create-user.command.ts similarity index 100% rename from src/modules/users/commands/create-user.command.ts rename to src/modules/user/commands/create-user.command.ts diff --git a/src/modules/users/commands/delete-user.command.ts b/src/modules/user/commands/delete-user.command.ts similarity index 100% rename from src/modules/users/commands/delete-user.command.ts rename to src/modules/user/commands/delete-user.command.ts diff --git a/src/modules/users/commands/update-user.command.ts b/src/modules/user/commands/update-user.command.ts similarity index 100% rename from src/modules/users/commands/update-user.command.ts rename to src/modules/user/commands/update-user.command.ts diff --git a/src/modules/users/domain/dtos/create-user.request.ts b/src/modules/user/domain/dtos/create-user.request.ts similarity index 100% rename from src/modules/users/domain/dtos/create-user.request.ts rename to src/modules/user/domain/dtos/create-user.request.ts diff --git a/src/modules/users/domain/dtos/find-all-users.request.ts b/src/modules/user/domain/dtos/find-all-users.request.ts similarity index 100% rename from src/modules/users/domain/dtos/find-all-users.request.ts rename to src/modules/user/domain/dtos/find-all-users.request.ts diff --git a/src/modules/users/domain/dtos/find-user-by-uuid.request.ts b/src/modules/user/domain/dtos/find-user-by-uuid.request.ts similarity index 100% rename from src/modules/users/domain/dtos/find-user-by-uuid.request.ts rename to src/modules/user/domain/dtos/find-user-by-uuid.request.ts diff --git a/src/modules/users/domain/dtos/update-user.request.ts b/src/modules/user/domain/dtos/update-user.request.ts similarity index 100% rename from src/modules/users/domain/dtos/update-user.request.ts rename to src/modules/user/domain/dtos/update-user.request.ts diff --git a/src/modules/users/domain/entities/user.ts b/src/modules/user/domain/entities/user.ts similarity index 100% rename from src/modules/users/domain/entities/user.ts rename to src/modules/user/domain/entities/user.ts diff --git a/src/modules/users/domain/interfaces/message-broker.ts b/src/modules/user/domain/interfaces/message-broker.ts similarity index 100% rename from src/modules/users/domain/interfaces/message-broker.ts rename to src/modules/user/domain/interfaces/message-broker.ts diff --git a/src/modules/users/domain/usecases/create-user.usecase.ts b/src/modules/user/domain/usecases/create-user.usecase.ts similarity index 100% rename from src/modules/users/domain/usecases/create-user.usecase.ts rename to src/modules/user/domain/usecases/create-user.usecase.ts diff --git a/src/modules/users/domain/usecases/delete-user.usecase.ts b/src/modules/user/domain/usecases/delete-user.usecase.ts similarity index 100% rename from src/modules/users/domain/usecases/delete-user.usecase.ts rename to src/modules/user/domain/usecases/delete-user.usecase.ts diff --git a/src/modules/users/domain/usecases/find-all-users.usecase.ts b/src/modules/user/domain/usecases/find-all-users.usecase.ts similarity index 100% rename from src/modules/users/domain/usecases/find-all-users.usecase.ts rename to src/modules/user/domain/usecases/find-all-users.usecase.ts diff --git a/src/modules/users/domain/usecases/find-user-by-uuid.usecase.ts b/src/modules/user/domain/usecases/find-user-by-uuid.usecase.ts similarity index 100% rename from src/modules/users/domain/usecases/find-user-by-uuid.usecase.ts rename to src/modules/user/domain/usecases/find-user-by-uuid.usecase.ts diff --git a/src/modules/users/domain/usecases/update-user.usecase.ts b/src/modules/user/domain/usecases/update-user.usecase.ts similarity index 100% rename from src/modules/users/domain/usecases/update-user.usecase.ts rename to src/modules/user/domain/usecases/update-user.usecase.ts diff --git a/src/modules/users/mappers/user.profile.ts b/src/modules/user/mappers/user.profile.ts similarity index 100% rename from src/modules/users/mappers/user.profile.ts rename to src/modules/user/mappers/user.profile.ts diff --git a/src/modules/users/queries/find-all-users.query.ts b/src/modules/user/queries/find-all-users.query.ts similarity index 100% rename from src/modules/users/queries/find-all-users.query.ts rename to src/modules/user/queries/find-all-users.query.ts diff --git a/src/modules/users/queries/find-user-by-uuid.query.ts b/src/modules/user/queries/find-user-by-uuid.query.ts similarity index 100% rename from src/modules/users/queries/find-user-by-uuid.query.ts rename to src/modules/user/queries/find-user-by-uuid.query.ts diff --git a/src/modules/users/tests/integration/users.repository.spec.ts b/src/modules/user/tests/integration/users.repository.spec.ts similarity index 100% rename from src/modules/users/tests/integration/users.repository.spec.ts rename to src/modules/user/tests/integration/users.repository.spec.ts diff --git a/src/modules/users/tests/unit/create-user.usecase.spec.ts b/src/modules/user/tests/unit/create-user.usecase.spec.ts similarity index 100% rename from src/modules/users/tests/unit/create-user.usecase.spec.ts rename to src/modules/user/tests/unit/create-user.usecase.spec.ts diff --git a/src/modules/users/tests/unit/delete-user.usecase.spec.ts b/src/modules/user/tests/unit/delete-user.usecase.spec.ts similarity index 100% rename from src/modules/users/tests/unit/delete-user.usecase.spec.ts rename to src/modules/user/tests/unit/delete-user.usecase.spec.ts diff --git a/src/modules/users/tests/unit/find-all-users.usecase.spec.ts b/src/modules/user/tests/unit/find-all-users.usecase.spec.ts similarity index 100% rename from src/modules/users/tests/unit/find-all-users.usecase.spec.ts rename to src/modules/user/tests/unit/find-all-users.usecase.spec.ts diff --git a/src/modules/users/tests/unit/find-user-by-uuid.usecase.spec.ts b/src/modules/user/tests/unit/find-user-by-uuid.usecase.spec.ts similarity index 100% rename from src/modules/users/tests/unit/find-user-by-uuid.usecase.spec.ts rename to src/modules/user/tests/unit/find-user-by-uuid.usecase.spec.ts diff --git a/src/modules/users/tests/unit/messager.spec.ts b/src/modules/user/tests/unit/messager.spec.ts similarity index 100% rename from src/modules/users/tests/unit/messager.spec.ts rename to src/modules/user/tests/unit/messager.spec.ts diff --git a/src/modules/users/tests/unit/update-user.usecase.spec.ts b/src/modules/user/tests/unit/update-user.usecase.spec.ts similarity index 100% rename from src/modules/users/tests/unit/update-user.usecase.spec.ts rename to src/modules/user/tests/unit/update-user.usecase.spec.ts diff --git a/src/modules/users/users.module.ts b/src/modules/user/user.module.ts similarity index 94% rename from src/modules/users/users.module.ts rename to src/modules/user/user.module.ts index 736077e..e278b67 100644 --- a/src/modules/users/users.module.ts +++ b/src/modules/user/user.module.ts @@ -5,7 +5,7 @@ import { ConfigModule, ConfigService } from '@nestjs/config'; import { CqrsModule } from '@nestjs/cqrs'; import { redisStore } from 'cache-manager-ioredis-yet'; import { DatabaseModule } from '../database/database.module'; -import { UsersController } from './adapters/primaries/users.controller'; +import { UserController } from './adapters/primaries/user.controller'; import { Messager } from './adapters/secondaries/messager'; import { UsersRepository } from './adapters/secondaries/users.repository'; import { CreateUserUseCase } from './domain/usecases/create-user.usecase'; @@ -46,7 +46,7 @@ import { UserProfile } from './mappers/user.profile'; inject: [ConfigService], }), ], - controllers: [UsersController], + controllers: [UserController], providers: [ UserProfile, UsersRepository, @@ -59,4 +59,4 @@ import { UserProfile } from './mappers/user.profile'; ], exports: [], }) -export class UsersModule {} +export class UserModule {} diff --git a/src/utils/tests/unit/rpc-validation-pipe.usecase.spec.ts b/src/utils/tests/unit/rpc-validation-pipe.usecase.spec.ts index 2ab4551..b00bf86 100644 --- a/src/utils/tests/unit/rpc-validation-pipe.usecase.spec.ts +++ b/src/utils/tests/unit/rpc-validation-pipe.usecase.spec.ts @@ -1,5 +1,5 @@ import { ArgumentMetadata } from '@nestjs/common'; -import { UpdateUserRequest } from '../../../modules/users/domain/dtos/update-user.request'; +import { UpdateUserRequest } from '../../../modules/user/domain/dtos/update-user.request'; import { RpcValidationPipe } from '../../pipes/rpc.validation-pipe'; describe('RpcValidationPipe', () => {