FIX: better code organization

This commit is contained in:
Gabriel Rosa
2022-07-11 10:42:01 -03:00
parent 5c079bb4f5
commit 83dcc7942c
+19 -18
View File
@@ -36,24 +36,6 @@ export class UsersController {
this.logger = dadosferaLogger.logger;
}
@Post()
@ApiOkResponse({ type: CreateUserRes })
async createUser(@User() user, @Body() body: CreateUserReq) {
this.logger.info('createUser', { user });
}
@Post('batch')
@ApiOkResponse({ type: CreateUserRes })
async batchCreateUser(@User() user, @Body() body: CreateUserReq) {
this.logger.info('batchCreateUser', { user });
}
@Delete(':id')
@ApiOkResponse({ type: DeleteUserRes })
async deleteUser(@User() user, @Param('id') id: string) {
this.logger.info('deleteUser', { user });
return await this.userService.deleteUser({ id });
}
@Get()
@ApiOkResponse({
type: GetAllUsersByCustomerIdRes,
@@ -70,6 +52,25 @@ export class UsersController {
);
}
@Post()
@ApiOkResponse({ type: CreateUserRes })
async createUser(@User() user, @Body() body: CreateUserReq) {
this.logger.info('createUser', { user });
}
@Post('batch')
@ApiOkResponse({ type: CreateUserRes })
async batchCreateUser(@User() user, @Body() body: CreateUserReq) {
this.logger.info('batchCreateUser', { user });
}
@Delete(':id')
@ApiOkResponse({ type: DeleteUserRes })
async deleteUser(@User() user, @Param('id') id: string) {
this.logger.info('deleteUser', { user });
return await this.userService.deleteUser({ id });
}
@Put('role')
async assignRoleToUser(@User() user, @Body() body: AssignRoleToUserReq) {
this.logger.info('assignRoleToUser', { user });