mirror of
https://gitlab.com/mobicoop/v3/service/user.git
synced 2026-03-24 12:45:49 +00:00
send logging messages
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
import { Mapper } from '@automapper/core';
|
||||
import { InjectMapper } from '@automapper/nestjs';
|
||||
import {
|
||||
Controller,
|
||||
UsePipes,
|
||||
ValidationError,
|
||||
ValidationPipe,
|
||||
} from '@nestjs/common';
|
||||
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';
|
||||
@@ -46,16 +41,17 @@ export class UsersController {
|
||||
|
||||
@GrpcMethod('UsersService', 'FindOneByUuid')
|
||||
async findOneByUuid(data: FindUserByUuidRequest): Promise<UserPresenter> {
|
||||
const user = await this._queryBus.execute(
|
||||
new FindUserByUuidQuery(data.uuid),
|
||||
);
|
||||
if (user) {
|
||||
try {
|
||||
const user = await this._queryBus.execute(
|
||||
new FindUserByUuidQuery(data.uuid),
|
||||
);
|
||||
return this._mapper.map(user, User, UserPresenter);
|
||||
} catch (error) {
|
||||
throw new RpcException({
|
||||
code: 5,
|
||||
message: 'User not found',
|
||||
});
|
||||
}
|
||||
throw new RpcException({
|
||||
code: 5,
|
||||
message: 'User not found',
|
||||
});
|
||||
}
|
||||
|
||||
@GrpcMethod('UsersService', 'Create')
|
||||
|
||||
Reference in New Issue
Block a user