feat: complete auth and submission's swagger docs
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { Body, Controller, Get, Patch } from '@nestjs/common';
|
||||
import { Body, Controller, Get, HttpStatus, Patch } from '@nestjs/common';
|
||||
import { UsersService } from './providers/users.service';
|
||||
import { ActiveUser } from '@/common/decorators/active-user.decorator';
|
||||
import { User } from './entities/user.entity';
|
||||
import { UpdateProfileDTO } from './dto/update-profile.dto';
|
||||
import { UpdateProfileDTO } from './dtos/update-profile.dto';
|
||||
import { ApiAppResponse } from '@/common/decorators/api-app-response.decorator';
|
||||
import { GetProfileDTO } from './dtos/responses/get-profile.dto';
|
||||
|
||||
@Controller('users')
|
||||
export class UsersController {
|
||||
@@ -14,11 +16,39 @@ export class UsersController {
|
||||
) {}
|
||||
|
||||
@Get('profile')
|
||||
@ApiAppResponse([
|
||||
{
|
||||
status: HttpStatus.OK,
|
||||
variants: [
|
||||
{
|
||||
model: GetProfileDTO,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
status: HttpStatus.UNAUTHORIZED,
|
||||
variants: [
|
||||
{
|
||||
messageExample: 'دسترسی غیر مجاز',
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
public getUserProfile(@ActiveUser() user: User) {
|
||||
return this.usersService.getProfile(user);
|
||||
}
|
||||
|
||||
@Patch('profile')
|
||||
@ApiAppResponse([
|
||||
{
|
||||
status: HttpStatus.OK,
|
||||
variants: [
|
||||
{
|
||||
messageExample: 'تغییرات با موفقیت اعمال شد.',
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
public async updateUserProfile(
|
||||
@ActiveUser() user: User,
|
||||
@Body() updateProfileDto: UpdateProfileDTO,
|
||||
|
||||
Reference in New Issue
Block a user