Spaces:
Sleeping
Sleeping
import { Body, Controller, Get, Param, Post, Request } from '@nestjs/common'; | |
import { UserService } from './user.service.js'; | |
import { UserEntity } from 'src/entities/user.entity.js'; | |
import { UpdateUserDto } from './dto/update-user-dto.js'; | |
'users') | (|
export class UsersController { | |
constructor(private readonly usersService: UserService) {} | |
':username') | (|
async getUser( | |
'username') username: string, | (|
): Promise<UserEntity | undefined> { | |
return this.usersService.findOne(username); | |
} | |
'updateUser') | (|
async updateUser(){ () req | |
const userId = req.user.sub; | |
const updateUserDto = req.body; | |
return this.usersService.updateUserById(userId, updateUserDto); | |
} | |
} | |