diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index 0e975fd..de3ce10 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -15,9 +15,7 @@ export class AuthController { //결과오류시 NotFoundError: No User found라고 console log에 출력됨 @Post('login') async login(@Request() req) { - const response = await this.authService.login(req.user) - console.log(response) - return response + return await this.authService.login(req.user) } //사용자정보 AccesToken 확인용 @@ -26,12 +24,12 @@ export class AuthController { @Get('profile') async getProfile(@Request() req) { //console.log(req) - return await req.user + return req.user } //사용자 등록 @Post('register') - async add(@Body() data: UserDTO): Promise { + async add(@Body() data: UserDTO) { return await this.authService.register(data) } } diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts index 9fcb6ff..6dc356e 100644 --- a/src/auth/auth.service.ts +++ b/src/auth/auth.service.ts @@ -36,7 +36,7 @@ export class AuthService { } async login(user: User) { - return this.getTokens(user) + return await this.getTokens(user) } async register(data: UserDTO): Promise { @@ -76,6 +76,8 @@ export class AuthService { } ) ]) - return { access_token: accessToken, refresh_token: refreshToken } + const tokens = { access_token: accessToken, refresh_token: refreshToken } + console.log(tokens) + return tokens } } diff --git a/src/user/user.service.ts b/src/user/user.service.ts index 037f381..c695715 100644 --- a/src/user/user.service.ts +++ b/src/user/user.service.ts @@ -18,7 +18,7 @@ export class UserService { where?: Prisma.UserWhereInput }): Promise { const { cursor, where } = params - return this.prisma.user.count({ + return await this.prisma.user.count({ cursor, where }) @@ -33,7 +33,7 @@ export class UserService { orderBy?: Prisma.UserOrderByWithRelationInput }): Promise { const { skip, take, cursor, where, orderBy } = params - return this.prisma.user.findMany({ + return await this.prisma.user.findMany({ skip, take, cursor, @@ -44,12 +44,12 @@ export class UserService { //단일 조회 async fetchOne(where: Prisma.UserWhereInput): Promise { - return this.prisma.user.findFirstOrThrow({ where: where }) + return await this.prisma.user.findFirstOrThrow({ where: where }) } //단일 추가 async add(data: Prisma.UserCreateInput): Promise { - return this.prisma.user.create({ data }) + return await this.prisma.user.create({ data }) } //단일 수정 @@ -58,7 +58,7 @@ export class UserService { data: Prisma.UserUpdateInput }): Promise { const { where, data } = params - return this.prisma.user.update({ + return await this.prisma.user.update({ data, where }) @@ -66,6 +66,6 @@ export class UserService { //단일 삭제 async remove(where: Prisma.UserWhereUniqueInput): Promise { - return this.prisma.user.delete({ where }) + return await this.prisma.user.delete({ where }) } }