-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from boostcampwm-2024/be/feature/introudce
[BE/feature] 소개글 수정 구현
- Loading branch information
Showing
11 changed files
with
134 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export const authQueries = { | ||
signUpQuery: 'INSERT INTO members (email, password, nickname) VALUES ($1, $2, $3) RETURNING *', | ||
findByEmailQuery: | ||
'SELECT member_id, email, password, nickname FROM members WHERE email = $1 LIMIT 1' | ||
'SELECT member_id, email, password, nickname FROM members WHERE email = $1 LIMIT 1', | ||
upateMemberQuery: 'UPDATE members SET introduce = $1 WHERE member_id = $2' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,16 @@ | ||
import { applyDecorators } from '@nestjs/common'; | ||
import { ApiResponse } from '@nestjs/swagger'; | ||
import { ApiBearerAuth, ApiResponse } from '@nestjs/swagger'; | ||
import { LogoutSuccessResponseDto } from '../dto/logout.dto'; | ||
import { TokenDecorator } from 'src/global/utils/tokenSwagger'; | ||
|
||
export function logoutResponseDecorator() { | ||
return applyDecorators( | ||
ApiBearerAuth(), | ||
ApiResponse({ | ||
status: 200, | ||
description: '로그아웃 성공', | ||
type: LogoutSuccessResponseDto | ||
}), | ||
ApiResponse({ | ||
status: 400, | ||
description: '로그아웃 실패 - 토큰 없음 오류', | ||
content: { | ||
'application/json': { | ||
examples: { | ||
noToken: { | ||
summary: '토큰 없음', | ||
value: { | ||
code: 400, | ||
message: '토큰이 필요합니다.' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}), | ||
ApiResponse({ | ||
status: 401, | ||
description: '로그아웃 실패 - 인증 오류', | ||
content: { | ||
'application/json': { | ||
examples: { | ||
expiredToken: { | ||
summary: '만료된 토큰', | ||
value: { | ||
code: 401, | ||
message: '유효하지 않은 토큰입니다.' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}) | ||
TokenDecorator() | ||
); | ||
} |
16 changes: 16 additions & 0 deletions
16
apps/backend/src/auth/decorator/updateIntroduce.decorator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { applyDecorators } from '@nestjs/common'; | ||
import { ApiBearerAuth, ApiResponse } from '@nestjs/swagger'; | ||
import { TokenDecorator } from 'src/global/utils/tokenSwagger'; | ||
import { updateIntroduceSuccessResponseDto } from '../dto/updateIntroduce.dto'; | ||
|
||
export function updateIntroduceResponseDecorator() { | ||
return applyDecorators( | ||
ApiBearerAuth(), | ||
ApiResponse({ | ||
status: 200, | ||
description: '소개글 수정 성공', | ||
type: updateIntroduceSuccessResponseDto | ||
}), | ||
TokenDecorator() | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
export class UpdateIntroduceDto { | ||
@ApiProperty({ | ||
description: '소개글', | ||
example: '나는 누구?' | ||
}) | ||
introduce: string; | ||
} | ||
|
||
export class updateIntroduceSuccessResponseDto { | ||
@ApiProperty({ | ||
description: '응답 코드', | ||
example: 200 | ||
}) | ||
code: number; | ||
|
||
@ApiProperty({ | ||
description: '응답 메세지', | ||
example: '로그인 되었습니다.' | ||
}) | ||
message: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface MemberData { | ||
memberId: number; | ||
email: string; | ||
nickname: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { applyDecorators } from '@nestjs/common'; | ||
import { ApiHeader, ApiResponse } from '@nestjs/swagger'; | ||
|
||
export function TokenDecorator() { | ||
return applyDecorators( | ||
ApiHeader({ | ||
name: 'Authorization', | ||
description: 'Bearer <token>', | ||
required: true, | ||
example: 'asjudjasdnsodnaowdoiqndoiqwnoidqwndioqwndasjdnalkjsnqw' | ||
}), | ||
ApiResponse({ | ||
status: 401, | ||
description: '토큰 오류로 인한 API 호출 실패', | ||
content: { | ||
'application/json': { | ||
examples: { | ||
noTokens: { | ||
summary: '허가되지 않은 토큰', | ||
value: { | ||
code: 401, | ||
message: '허가되지 않은 사용자입니다.' | ||
} | ||
}, | ||
blacklistTokens: { | ||
summary: '유효하지 않은 토큰', | ||
value: { | ||
code: 401, | ||
message: '유효하지 않은 토큰입니다.' | ||
} | ||
}, | ||
invalidTokens: { | ||
summary: '잘못된 토큰', | ||
value: { | ||
code: 401, | ||
message: '잘못된 토큰입니다.' | ||
} | ||
}, | ||
timeoutTokens: { | ||
summary: '만료된 토큰', | ||
value: { | ||
code: 401, | ||
message: '만료된 토큰입니다.' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}) | ||
); | ||
} |