diff --git a/backend/src/user/user.controller.ts b/backend/src/user/user.controller.ts index 4bbfcb37..01c9638e 100644 --- a/backend/src/user/user.controller.ts +++ b/backend/src/user/user.controller.ts @@ -1,7 +1,12 @@ -import { Controller } from '@nestjs/common'; +import { Controller, Get, Param } from '@nestjs/common'; import { UserService } from './user.service'; @Controller('users') export class UserController { constructor(private readonly userService: UserService) {} + + @Get('/:id') + async getUserInfo(@Param('id') id: number) { + return await this.userService.getUserInfo(id); + } } diff --git a/backend/src/user/user.service.ts b/backend/src/user/user.service.ts index 4278da27..14505301 100644 --- a/backend/src/user/user.service.ts +++ b/backend/src/user/user.service.ts @@ -1,6 +1,7 @@ import { Injectable } from '@nestjs/common'; import { UserRepository } from './user.repository'; import { CreateUserRequest } from './dto/CreateUserRequest'; +import { UserIconResponse } from '@src/user/dto/UserIconResponse'; @Injectable() export class UserService { @@ -22,4 +23,9 @@ export class UserService { const newUser = await this.userRepository.save(user); return { userId: newUser.id, role: newUser.role }; } + + async getUserInfo(userId: number) { + const user = await this.userRepository.findById(userId); + return UserIconResponse.from(user); + } }