update packages, clean code
This commit is contained in:
parent
aa77a64cd2
commit
b3232e3896
|
@ -10,6 +10,7 @@ DATABASE_URL="postgresql://mobicoop:mobicoop@v3-db:5432/mobicoop?schema=user"
|
|||
# MESSAGE BROKER
|
||||
MESSAGE_BROKER_URI=amqp://v3-broker:5672
|
||||
MESSAGE_BROKER_EXCHANGE=mobicoop
|
||||
MESSAGE_BROKER_EXCHANGE_DURABILITY=true
|
||||
|
||||
# REDIS
|
||||
REDIS_HOST=v3-redis
|
||||
|
|
File diff suppressed because it is too large
Load Diff
84
package.json
84
package.json
|
@ -30,53 +30,53 @@
|
|||
"migrate:deploy": "npx prisma migrate deploy"
|
||||
},
|
||||
"dependencies": {
|
||||
"@grpc/grpc-js": "^1.8.0",
|
||||
"@grpc/proto-loader": "^0.7.4",
|
||||
"@liaoliaots/nestjs-redis": "^9.0.5",
|
||||
"@mobicoop/configuration-module": "^1.2.0",
|
||||
"@mobicoop/ddd-library": "^1.0.0",
|
||||
"@mobicoop/health-module": "^2.0.0",
|
||||
"@mobicoop/message-broker-module": "^1.2.0",
|
||||
"@nestjs/cache-manager": "^1.0.0",
|
||||
"@nestjs/common": "^9.0.0",
|
||||
"@nestjs/config": "^2.2.0",
|
||||
"@nestjs/core": "^9.0.0",
|
||||
"@nestjs/cqrs": "^9.0.1",
|
||||
"@nestjs/event-emitter": "^2.0.0",
|
||||
"@nestjs/microservices": "^9.2.1",
|
||||
"@nestjs/platform-express": "^9.0.0",
|
||||
"@nestjs/terminus": "^9.2.2",
|
||||
"@prisma/client": "^4.7.1",
|
||||
"@types/supertest": "^2.0.11",
|
||||
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
||||
"@typescript-eslint/parser": "^5.0.0",
|
||||
"cache-manager": "^5.2.1",
|
||||
"cache-manager-ioredis-yet": "^1.1.0",
|
||||
"@grpc/grpc-js": "^1.9.5",
|
||||
"@grpc/proto-loader": "^0.7.10",
|
||||
"@songkeys/nestjs-redis": "^10.0.0",
|
||||
"@mobicoop/configuration-module": "^2.0.0",
|
||||
"@mobicoop/ddd-library": "^2.0.0",
|
||||
"@mobicoop/health-module": "^2.3.1",
|
||||
"@mobicoop/message-broker-module": "^2.1.1",
|
||||
"@nestjs/cache-manager": "^2.1.0",
|
||||
"@nestjs/common": "^10.2.7",
|
||||
"@nestjs/config": "^3.1.1",
|
||||
"@nestjs/core": "^10.2.7",
|
||||
"@nestjs/cqrs": "^10.2.6",
|
||||
"@nestjs/event-emitter": "^2.0.2",
|
||||
"@nestjs/microservices": "^10.2.7",
|
||||
"@nestjs/platform-express": "^10.2.7",
|
||||
"@nestjs/terminus": "^10.1.1",
|
||||
"@prisma/client": "^5.4.2",
|
||||
"@types/supertest": "^2.0.14",
|
||||
"@typescript-eslint/eslint-plugin": "^6.8.0",
|
||||
"@typescript-eslint/parser": "^6.8.0",
|
||||
"cache-manager": "^5.2.4",
|
||||
"cache-manager-ioredis-yet": "^1.2.2",
|
||||
"class-transformer": "^0.5.1",
|
||||
"class-validator": "^0.14.0",
|
||||
"dotenv-cli": "^6.0.0",
|
||||
"ioredis": "^5.3.0"
|
||||
"dotenv-cli": "^7.3.0",
|
||||
"ioredis": "^5.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/cli": "^9.0.0",
|
||||
"@nestjs/schematics": "^9.0.0",
|
||||
"@nestjs/testing": "^9.0.0",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/uuid": "^9.0.2",
|
||||
"eslint": "^8.0.1",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"jest": "28.1.3",
|
||||
"prettier": "^2.3.2",
|
||||
"prisma": "^4.7.1",
|
||||
"source-map-support": "^0.5.20",
|
||||
"supertest": "^6.1.3",
|
||||
"ts-jest": "28.0.8",
|
||||
"ts-loader": "^9.2.3",
|
||||
"@nestjs/cli": "^10.1.18",
|
||||
"@nestjs/schematics": "^10.0.2",
|
||||
"@nestjs/testing": "^10.2.7",
|
||||
"@types/jest": "^29.5.5",
|
||||
"@types/node": "^20.8.6",
|
||||
"@types/uuid": "^9.0.5",
|
||||
"eslint": "^8.51.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-prettier": "^5.0.1",
|
||||
"jest": "29.7.0",
|
||||
"prettier": "^3.0.3",
|
||||
"prisma": "^5.4.2",
|
||||
"source-map-support": "^0.5.21",
|
||||
"supertest": "^6.3.3",
|
||||
"ts-jest": "29.1.1",
|
||||
"ts-loader": "^9.5.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"tsconfig-paths": "4.1.0",
|
||||
"typescript": "^4.9.4"
|
||||
"tsconfig-paths": "4.2.0",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// service
|
||||
export const SERVICE_NAME = 'user';
|
||||
|
||||
// grpc
|
||||
export const GRPC_SERVICE_NAME = 'UserService';
|
||||
|
||||
// configuration
|
||||
export const SERVICE_CONFIGURATION_SET_QUEUE = 'user-configuration-set';
|
||||
export const SERVICE_CONFIGURATION_DELETE_QUEUE = 'user-configuration-delete';
|
||||
export const SERVICE_CONFIGURATION_PROPAGATE_QUEUE =
|
||||
'user-configuration-propagate';
|
||||
|
||||
// health
|
||||
export const HEALTH_SERVICE_NAME = 'health';
|
||||
export const HEALTH_USER_REPOSITORY = 'UserRepository';
|
||||
export const HEALTH_CRITICAL_LOGGING_KEY = 'logging.user.health.crit';
|
|
@ -15,6 +15,14 @@ import { USER_REPOSITORY } from './modules/user/user.di-tokens';
|
|||
import { MESSAGE_PUBLISHER } from './modules/messager/messager.di-tokens';
|
||||
import { MessagePublisherPort } from '@mobicoop/ddd-library';
|
||||
import { EventEmitterModule } from '@nestjs/event-emitter';
|
||||
import {
|
||||
HEALTH_CRITICAL_LOGGING_KEY,
|
||||
HEALTH_USER_REPOSITORY,
|
||||
SERVICE_CONFIGURATION_DELETE_QUEUE,
|
||||
SERVICE_CONFIGURATION_PROPAGATE_QUEUE,
|
||||
SERVICE_CONFIGURATION_SET_QUEUE,
|
||||
SERVICE_NAME,
|
||||
} from './app.constants';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
@ -26,19 +34,23 @@ import { EventEmitterModule } from '@nestjs/event-emitter';
|
|||
useFactory: async (
|
||||
configService: ConfigService,
|
||||
): Promise<ConfigurationModuleOptions> => ({
|
||||
domain: configService.get<string>('SERVICE_CONFIGURATION_DOMAIN'),
|
||||
domain: configService.get<string>(
|
||||
'SERVICE_CONFIGURATION_DOMAIN',
|
||||
) as string,
|
||||
messageBroker: {
|
||||
uri: configService.get<string>('MESSAGE_BROKER_URI'),
|
||||
exchange: configService.get<string>('MESSAGE_BROKER_EXCHANGE'),
|
||||
uri: configService.get<string>('MESSAGE_BROKER_URI') as string,
|
||||
exchange: configService.get<string>(
|
||||
'MESSAGE_BROKER_EXCHANGE',
|
||||
) as string,
|
||||
},
|
||||
redis: {
|
||||
host: configService.get<string>('REDIS_HOST'),
|
||||
host: configService.get<string>('REDIS_HOST') as string,
|
||||
password: configService.get<string>('REDIS_PASSWORD'),
|
||||
port: configService.get<number>('REDIS_PORT'),
|
||||
port: configService.get<number>('REDIS_PORT') as number,
|
||||
},
|
||||
setConfigurationBrokerQueue: 'user-configuration-create-update',
|
||||
deleteConfigurationQueue: 'user-configuration-delete',
|
||||
propagateConfigurationQueue: 'user-configuration-propagate',
|
||||
setConfigurationBrokerQueue: SERVICE_CONFIGURATION_SET_QUEUE,
|
||||
deleteConfigurationQueue: SERVICE_CONFIGURATION_DELETE_QUEUE,
|
||||
propagateConfigurationQueue: SERVICE_CONFIGURATION_PROPAGATE_QUEUE,
|
||||
}),
|
||||
}),
|
||||
HealthModule.forRootAsync({
|
||||
|
@ -48,11 +60,11 @@ import { EventEmitterModule } from '@nestjs/event-emitter';
|
|||
userRepository: HealthRepositoryPort,
|
||||
messagePublisher: MessagePublisherPort,
|
||||
): Promise<HealthModuleOptions> => ({
|
||||
serviceName: 'user',
|
||||
criticalLoggingKey: 'logging.user.health.crit',
|
||||
serviceName: SERVICE_NAME,
|
||||
criticalLoggingKey: HEALTH_CRITICAL_LOGGING_KEY,
|
||||
checkRepositories: [
|
||||
{
|
||||
name: 'UserRepository',
|
||||
name: HEALTH_USER_REPOSITORY,
|
||||
repository: userRepository,
|
||||
},
|
||||
],
|
||||
|
|
|
@ -2,6 +2,7 @@ import { NestFactory } from '@nestjs/core';
|
|||
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
||||
import { join } from 'path';
|
||||
import { AppModule } from './app.module';
|
||||
import { HEALTH_SERVICE_NAME, SERVICE_NAME } from './app.constants';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
|
@ -11,17 +12,17 @@ async function bootstrap() {
|
|||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.GRPC,
|
||||
options: {
|
||||
package: ['user', 'health'],
|
||||
package: [SERVICE_NAME, HEALTH_SERVICE_NAME],
|
||||
protoPath: [
|
||||
join(__dirname, 'modules/user/interface/grpc-controllers/user.proto'),
|
||||
join(__dirname, 'health.proto'),
|
||||
],
|
||||
url: process.env.SERVICE_URL + ':' + process.env.SERVICE_PORT,
|
||||
loader: { keepCase: true },
|
||||
url: `${process.env.SERVICE_URL}:${process.env.SERVICE_PORT}`,
|
||||
loader: { keepCase: true, enums: String },
|
||||
},
|
||||
});
|
||||
|
||||
await app.startAllMicroservices();
|
||||
await app.listen(process.env.HEALTH_SERVICE_PORT);
|
||||
await app.listen(process.env.HEALTH_SERVICE_PORT as unknown as number);
|
||||
}
|
||||
bootstrap();
|
||||
|
|
|
@ -6,6 +6,7 @@ import {
|
|||
MessageBrokerPublisher,
|
||||
} from '@mobicoop/message-broker-module';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { SERVICE_NAME } from '@src/app.constants';
|
||||
|
||||
const imports = [
|
||||
MessageBrokerModule.forRootAsync({
|
||||
|
@ -14,9 +15,14 @@ const imports = [
|
|||
useFactory: async (
|
||||
configService: ConfigService,
|
||||
): Promise<MessageBrokerModuleOptions> => ({
|
||||
uri: configService.get<string>('MESSAGE_BROKER_URI'),
|
||||
exchange: configService.get<string>('MESSAGE_BROKER_EXCHANGE'),
|
||||
name: 'user',
|
||||
uri: configService.get<string>('MESSAGE_BROKER_URI') as string,
|
||||
exchange: {
|
||||
name: configService.get<string>('MESSAGE_BROKER_EXCHANGE') as string,
|
||||
durable: configService.get<boolean>(
|
||||
'MESSAGE_BROKER_EXCHANGE_DURABILITY',
|
||||
) as boolean,
|
||||
},
|
||||
name: SERVICE_NAME,
|
||||
}),
|
||||
}),
|
||||
];
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { IntegrationEvent, IntegrationEventProps } from '@mobicoop/ddd-library';
|
||||
|
||||
export class UserCreatedIntegrationEvent extends IntegrationEvent {
|
||||
readonly firstName: string;
|
||||
readonly lastName: string;
|
||||
readonly email: string;
|
||||
readonly phone: string;
|
||||
readonly firstName?: string;
|
||||
readonly lastName?: string;
|
||||
readonly email?: string;
|
||||
readonly phone?: string;
|
||||
|
||||
constructor(props: IntegrationEventProps<UserCreatedIntegrationEvent>) {
|
||||
super(props);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { IntegrationEvent, IntegrationEventProps } from '@mobicoop/ddd-library';
|
||||
|
||||
export class UserUpdatedIntegrationEvent extends IntegrationEvent {
|
||||
readonly firstName: string;
|
||||
readonly lastName: string;
|
||||
readonly email: string;
|
||||
readonly phone: string;
|
||||
readonly firstName?: string;
|
||||
readonly lastName?: string;
|
||||
readonly email?: string;
|
||||
readonly phone?: string;
|
||||
|
||||
constructor(props: IntegrationEventProps<UserUpdatedIntegrationEvent>) {
|
||||
super(props);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { DomainEvent, DomainEventProps } from '@mobicoop/ddd-library';
|
||||
|
||||
export class UserCreatedDomainEvent extends DomainEvent {
|
||||
readonly firstName: string;
|
||||
readonly lastName: string;
|
||||
readonly email: string;
|
||||
readonly phone: string;
|
||||
readonly firstName?: string;
|
||||
readonly lastName?: string;
|
||||
readonly email?: string;
|
||||
readonly phone?: string;
|
||||
|
||||
constructor(props: DomainEventProps<UserCreatedDomainEvent>) {
|
||||
super(props);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { DomainEvent, DomainEventProps } from '@mobicoop/ddd-library';
|
||||
|
||||
export class UserUpdatedDomainEvent extends DomainEvent {
|
||||
readonly firstName: string;
|
||||
readonly lastName: string;
|
||||
readonly email: string;
|
||||
readonly phone: string;
|
||||
readonly firstName?: string;
|
||||
readonly lastName?: string;
|
||||
readonly email?: string;
|
||||
readonly phone?: string;
|
||||
|
||||
constructor(props: DomainEventProps<UserUpdatedDomainEvent>) {
|
||||
super(props);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { INestApplication, Injectable, OnModuleInit } from '@nestjs/common';
|
||||
import { Injectable, OnModuleInit } from '@nestjs/common';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
@Injectable()
|
||||
|
@ -6,10 +6,4 @@ export class PrismaService extends PrismaClient implements OnModuleInit {
|
|||
async onModuleInit() {
|
||||
await this.$connect();
|
||||
}
|
||||
|
||||
async enableShutdownHooks(app: INestApplication) {
|
||||
this.$on('beforeExit', async () => {
|
||||
await app.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,18 +10,19 @@ import { UserEntity } from '../core/domain/user.entity';
|
|||
import { UserRepositoryPort } from '../core/application/ports/user.repository.port';
|
||||
import { UserMapper } from '../user.mapper';
|
||||
import { USER_MESSAGE_PUBLISHER } from '../user.di-tokens';
|
||||
import { SERVICE_NAME } from '@src/app.constants';
|
||||
|
||||
export type UserBaseModel = {
|
||||
uuid: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
firstName?: string;
|
||||
lastName?: string;
|
||||
email?: string;
|
||||
phone?: string;
|
||||
};
|
||||
|
||||
export type UserReadModel = UserBaseModel & {
|
||||
createdAt?: Date;
|
||||
updatedAt?: Date;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
};
|
||||
|
||||
export type UserWriteModel = UserBaseModel;
|
||||
|
@ -48,7 +49,7 @@ export class UserRepository
|
|||
eventEmitter,
|
||||
new LoggerBase({
|
||||
logger: new Logger(UserRepository.name),
|
||||
domain: 'user',
|
||||
domain: SERVICE_NAME,
|
||||
messagePublisher,
|
||||
}),
|
||||
);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { ResponseBase } from '@mobicoop/ddd-library';
|
||||
|
||||
export class UserResponseDto extends ResponseBase {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
firstName?: string;
|
||||
lastName?: string;
|
||||
email?: string;
|
||||
phone?: string;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
PhoneAlreadyExistsException,
|
||||
UserAlreadyExistsException,
|
||||
} from '@modules/user/core/domain/user.errors';
|
||||
import { GRPC_SERVICE_NAME } from '@src/app.constants';
|
||||
|
||||
@UsePipes(
|
||||
new RpcValidationPipe({
|
||||
|
@ -23,7 +24,7 @@ import {
|
|||
export class CreateUserGrpcController {
|
||||
constructor(private readonly commandBus: CommandBus) {}
|
||||
|
||||
@GrpcMethod('UserService', 'Create')
|
||||
@GrpcMethod(GRPC_SERVICE_NAME, 'Create')
|
||||
async create(
|
||||
createUserRequestDto: CreateUserRequestDto,
|
||||
): Promise<IdResponse> {
|
||||
|
|
|
@ -9,6 +9,7 @@ import { CommandBus } from '@nestjs/cqrs';
|
|||
import { GrpcMethod, RpcException } from '@nestjs/microservices';
|
||||
import { DeleteUserRequestDto } from './dtos/delete-user.request.dto';
|
||||
import { DeleteUserCommand } from '@modules/user/core/application/commands/delete-user/delete-user.command';
|
||||
import { GRPC_SERVICE_NAME } from '@src/app.constants';
|
||||
|
||||
@UsePipes(
|
||||
new RpcValidationPipe({
|
||||
|
@ -20,7 +21,7 @@ import { DeleteUserCommand } from '@modules/user/core/application/commands/delet
|
|||
export class DeleteUserGrpcController {
|
||||
constructor(private readonly commandBus: CommandBus) {}
|
||||
|
||||
@GrpcMethod('UserService', 'Delete')
|
||||
@GrpcMethod(GRPC_SERVICE_NAME, 'Delete')
|
||||
async delete(data: DeleteUserRequestDto): Promise<void> {
|
||||
try {
|
||||
await this.commandBus.execute(new DeleteUserCommand(data));
|
||||
|
|
|
@ -9,6 +9,7 @@ import { FindUserByIdRequestDto } from './dtos/find-user-by-id.request.dto';
|
|||
import { UserResponseDto } from '../dtos/user.response.dto';
|
||||
import { UserEntity } from '@modules/user/core/domain/user.entity';
|
||||
import { FindUserByIdQuery } from '@modules/user/core/application/queries/find-user-by-id/find-user-by-id.query';
|
||||
import { GRPC_SERVICE_NAME } from '@src/app.constants';
|
||||
|
||||
@UsePipes(
|
||||
new RpcValidationPipe({
|
||||
|
@ -23,7 +24,7 @@ export class FindUserByIdGrpcController {
|
|||
private readonly queryBus: QueryBus,
|
||||
) {}
|
||||
|
||||
@GrpcMethod('UserService', 'FindOneById')
|
||||
@GrpcMethod(GRPC_SERVICE_NAME, 'FindOneById')
|
||||
async findOnebyId(data: FindUserByIdRequestDto): Promise<UserResponseDto> {
|
||||
try {
|
||||
const user: UserEntity = await this.queryBus.execute(
|
||||
|
|
|
@ -14,6 +14,7 @@ import {
|
|||
PhoneAlreadyExistsException,
|
||||
UserAlreadyExistsException,
|
||||
} from '@modules/user/core/domain/user.errors';
|
||||
import { GRPC_SERVICE_NAME } from '@src/app.constants';
|
||||
|
||||
@UsePipes(
|
||||
new RpcValidationPipe({
|
||||
|
@ -25,7 +26,7 @@ import {
|
|||
export class UpdateUserGrpcController {
|
||||
constructor(private readonly commandBus: CommandBus) {}
|
||||
|
||||
@GrpcMethod('UserService', 'Update')
|
||||
@GrpcMethod(GRPC_SERVICE_NAME, 'Update')
|
||||
async updateUser(data: UpdateUserRequestDto): Promise<IdResponse> {
|
||||
try {
|
||||
const aggregateID: AggregateID = await this.commandBus.execute(
|
||||
|
|
|
@ -64,9 +64,8 @@ describe('create-user.service', () => {
|
|||
UserEntity.create = jest.fn().mockReturnValue({
|
||||
id: '047a6ecf-23d4-4d3e-877c-3225d560a8da',
|
||||
});
|
||||
const result: AggregateID = await createUserService.execute(
|
||||
createUserCommand,
|
||||
);
|
||||
const result: AggregateID =
|
||||
await createUserService.execute(createUserCommand);
|
||||
expect(result).toBe('047a6ecf-23d4-4d3e-877c-3225d560a8da');
|
||||
});
|
||||
it('should throw an error if something bad happens', async () => {
|
||||
|
|
|
@ -41,9 +41,8 @@ describe('Delete User Service', () => {
|
|||
describe('execution', () => {
|
||||
const deleteUserCommand = new DeleteUserCommand(deleteUserRequest);
|
||||
it('should delete a user', async () => {
|
||||
const result: boolean = await deleteUserService.execute(
|
||||
deleteUserCommand,
|
||||
);
|
||||
const result: boolean =
|
||||
await deleteUserService.execute(deleteUserCommand);
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -49,9 +49,8 @@ describe('find-user-by-id.query-handler', () => {
|
|||
const findUserbyIdQuery = new FindUserByIdQuery(
|
||||
'dd264806-13b4-4226-9b18-87adf0ad5dd1',
|
||||
);
|
||||
const user: UserEntity = await findUserByIdQueryHandler.execute(
|
||||
findUserbyIdQuery,
|
||||
);
|
||||
const user: UserEntity =
|
||||
await findUserByIdQueryHandler.execute(findUserbyIdQuery);
|
||||
expect(user.getProps().lastName).toBe('Doe');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -98,9 +98,8 @@ describe('update-user.service', () => {
|
|||
const updateUserCommand = new UpdateUserCommand(
|
||||
updateFirstNameUserRequest,
|
||||
);
|
||||
const result: AggregateID = await updateUserService.execute(
|
||||
updateUserCommand,
|
||||
);
|
||||
const result: AggregateID =
|
||||
await updateUserService.execute(updateUserCommand);
|
||||
expect(result).toBe('c97b1783-76cf-4840-b298-b90b13c58894');
|
||||
expect(userToUpdate.update).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
|
|
@ -65,9 +65,8 @@ describe('Create User Grpc Controller', () => {
|
|||
|
||||
it('should create a new user', async () => {
|
||||
jest.spyOn(mockCommandBus, 'execute');
|
||||
const result: IdResponse = await createUserGrpcController.create(
|
||||
createUserRequest,
|
||||
);
|
||||
const result: IdResponse =
|
||||
await createUserGrpcController.create(createUserRequest);
|
||||
expect(result).toBeInstanceOf(IdResponse);
|
||||
expect(result.id).toBe('200d61a8-d878-4378-a609-c19ea71633d2');
|
||||
expect(mockCommandBus.execute).toHaveBeenCalledTimes(1);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { RedisClientOptions } from '@liaoliaots/nestjs-redis';
|
||||
import { Module, Provider } from '@nestjs/common';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { CqrsModule } from '@nestjs/cqrs';
|
||||
|
@ -20,6 +19,7 @@ import { FindUserByIdQueryHandler } from './core/application/queries/find-user-b
|
|||
import { PublishMessageWhenUserIsCreatedDomainEventHandler } from './core/application/event-handlers/publish-message-when-user-is-created.domain-event-handler';
|
||||
import { PublishMessageWhenUserIsUpdatedDomainEventHandler } from './core/application/event-handlers/publish-message-when-user-is-updated.domain-event-handler';
|
||||
import { PublishMessageWhenUserIsDeletedDomainEventHandler } from './core/application/event-handlers/publish-message-when-user-is-deleted.domain-event-handler';
|
||||
import { RedisClientOptions } from '@songkeys/nestjs-redis';
|
||||
|
||||
const imports = [
|
||||
CqrsModule,
|
||||
|
|
|
@ -12,12 +12,13 @@
|
|||
"baseUrl": "./",
|
||||
"incremental": true,
|
||||
"skipLibCheck": true,
|
||||
"strictNullChecks": false,
|
||||
"noImplicitAny": false,
|
||||
"strictNullChecks": true,
|
||||
"noImplicitAny": true,
|
||||
"strictBindCallApply": false,
|
||||
"forceConsistentCasingInFileNames": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noFallthroughCasesInSwitch": false,
|
||||
"paths": {
|
||||
"@libs/*": ["src/libs/*"],
|
||||
"@modules/*": ["src/modules/*"],
|
||||
"@src/*": ["src/*"]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue