Skip to content

Commit

Permalink
feat : profile
Browse files Browse the repository at this point in the history
  • Loading branch information
kangjuhyup committed Dec 27, 2024
1 parent ab2de80 commit d5ae09b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
23 changes: 23 additions & 0 deletions packages/server/src/domain/user/user.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { UserAccessGuard } from "@app/jwt/guard/user.access.guard";
import { Controller, Get, Req, UseGuards } from "@nestjs/common";
import { Request } from "express";
import { UserService } from "./user.service";

@Controller('user')
export class UserController {

constructor(
private readonly userService: UserService
){}

@UseGuards(UserAccessGuard)
@Get()
async getMyProfile(
@Req() request : Request
) {
const user = request.user as { id: string}
return { result : true, data : await this.userService.getUser({
userId : user.id
})}
}
}
3 changes: 2 additions & 1 deletion packages/server/src/domain/user/user.module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Module } from '@nestjs/common';
import { UserService } from './user.service';
import { UserController } from './user.controller';

@Module({
imports: [],
controllers: [],
controllers: [UserController],
providers: [UserService],
exports: [UserService],
})
Expand Down

0 comments on commit d5ae09b

Please sign in to comment.