feat: complete auth and submission's swagger docs

This commit is contained in:
2026-09-02 16:37:47 +03:30
parent 8fced148b7
commit 0961b8f11d
22 changed files with 453 additions and 13 deletions
+32 -2
View File
@@ -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,