better testing

This commit is contained in:
Gsk54
2023-01-11 11:26:58 +01:00
parent cc7aace334
commit 9eab64bb00
8 changed files with 94 additions and 32 deletions

View File

@@ -3,7 +3,7 @@ import { InjectMapper } from '@automapper/nestjs';
import { Controller, UsePipes } from '@nestjs/common';
import { CommandBus, QueryBus } from '@nestjs/cqrs';
import { GrpcMethod, RpcException } from '@nestjs/microservices';
import { DatabaseException } from 'src/modules/database/src/exceptions/DatabaseException';
import { DatabaseException } from '../../../database/src/exceptions/DatabaseException';
import { CreateUserCommand } from '../../commands/create-user.command';
import { DeleteUserCommand } from '../../commands/delete-user.command';
import { UpdateUserCommand } from '../../commands/update-user.command';
@@ -48,9 +48,7 @@ export class UsersController {
@GrpcMethod('UsersService', 'FindOneByUuid')
async findOneByUuid(data: FindUserByUuidRequest): Promise<UserPresenter> {
try {
const user = await this._queryBus.execute(
new FindUserByUuidQuery(data.uuid),
);
const user = await this._queryBus.execute(new FindUserByUuidQuery(data));
return this._mapper.map(user, User, UserPresenter);
} catch (error) {
throw new RpcException({