refactor: changed the project structure
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { Body, Controller, Get, Param, Post } from '@nestjs/common';
|
||||
import { ApiOperation, ApiResponse } from '@nestjs/swagger';
|
||||
import { CreateUserDto } from './DTO/create-user.dto';
|
||||
import { User } from './entities/user.entity';
|
||||
import { UsersService } from './users.service';
|
||||
import { CreateUserRoleDto } from './DTO/create-user-role.dto';
|
||||
|
||||
@Controller('users')
|
||||
export class UsersController {
|
||||
|
||||
constructor(
|
||||
private readonly userService: UsersService
|
||||
) {}
|
||||
|
||||
@Post('signup')
|
||||
@ApiOperation({summary: 'Create a new user!'})
|
||||
@ApiResponse({status: 201, description: 'User created successfully!'})
|
||||
@ApiResponse({status: 400, description: 'Bad Request from User!'})
|
||||
signupUser(@Body() body: CreateUserDto): Promise<User> {
|
||||
return this.userService.createUser(body);
|
||||
}
|
||||
|
||||
@Post(':userId/roles')
|
||||
createRole(
|
||||
@Param('userId') userId: string,
|
||||
@Body() userRoleDto: CreateUserRoleDto
|
||||
) {
|
||||
return this.userService.createUserRole(userId, userRoleDto);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user