feat: add jwt auth guard and profile endpoint

This commit is contained in:
2026-02-28 08:14:04 +03:30
parent 8212ede785
commit 06f659101d
21 changed files with 371 additions and 31 deletions
+15 -14
View File
@@ -1,5 +1,8 @@
import { Controller } from '@nestjs/common';
import { Body, Controller, Get, Patch } from '@nestjs/common';
import { UsersService } from './providers/users.service';
import { ActiveUser } from '@/common/decorators/active-user.decorator';
import { User } from './user.entity';
import { UpdateProfileDTO } from './dto/update-profile.dto';
@Controller('users')
export class UsersController {
@@ -10,18 +13,16 @@ export class UsersController {
private readonly usersService: UsersService,
) {}
// @Get()
// public getAllUsers() {
// return ['user1', 'user2'];
// }
@Get('profile')
public getUserProfile(@ActiveUser() user: User) {
return this.usersService.getProfile(user);
}
// @Get(':id')
// public getUserById(@Param('id', ParseIntPipe) id: number) {
// return `user ${id}`;
// }
// @Post()
// public async createUser(@Body() createUserDto: CreateUserDTO) {
// return await this.usersService.createOne(createUserDto);
// }
@Patch('profile')
public updateUserProfile(
@ActiveUser() user: User,
@Body() updateProfileDto: UpdateProfileDTO,
) {
return updateProfileDto;
}
}