Skip to content

Commit 850f7db

Browse files
committed
[#60] 📝 update comments in type files
1 parent 72273b1 commit 850f7db

File tree

8 files changed

+171
-106
lines changed

8 files changed

+171
-106
lines changed
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
/**
2+
- isSuccess: 요청 성공 여부
3+
- code: 응답 코드 (예: TEAM004)
4+
- message: 응답 메시지 (예: "This is a deleted post.")
5+
- result?: 응답 데이터 (제네릭 타입)
6+
*/
17
interface ApiResponse<T = unknown> {
2-
isSuccess: boolean // 요청 성공 여부
3-
code: string // 응답 코드 (예: TEAM004)
4-
message: string // 응답 메시지 (예: "This is a deleted post.")
5-
result?: T // 응답 데이터 (제네릭 타입)
8+
isSuccess: boolean
9+
code: string
10+
message: string
11+
result?: T
612
}

src/types/api/Auth.types.d.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
/*
2-
path: '/v1/auth'
3-
GET: 로그인한 유저 조회
1+
/**
2+
- path: '/v1/auth'
3+
- GET: 로그인한 유저 조회
44
*/
55
export type GetLoggedInUserResponse = User
66

7-
/*
8-
path: '/v1/auth/sign-up'
9-
POST: 회원가입
7+
/**
8+
- path: '/v1/auth/sign-up'
9+
- POST: 회원가입
1010
*/
1111
export interface SignUpRequest {
1212
email: Email // 이메일
@@ -18,9 +18,9 @@ export interface SignUpResponse extends User {
1818
gitHub: GitHub // GitHub 계정 URL
1919
}
2020

21-
/*
22-
path: '/v1/auth/sign-in'
23-
POST: 로그인
21+
/**
22+
- path: '/v1/auth/sign-in'
23+
- POST: 로그인
2424
*/
2525
export interface SignInRequest {
2626
email: Email // 이메일
@@ -32,9 +32,9 @@ export interface SignInResponse extends User {
3232
refreshToken: Token // 리프레시 토큰
3333
}
3434

35-
/*
36-
path: '/v1/auth/new-token'
37-
POST: 액세스 토큰 재발급
35+
/**
36+
- path: '/v1/auth/new-token'
37+
- POST: 액세스 토큰 재발급
3838
*/
3939
export interface RefreshTokenRequest {
4040
oldAccessToken: Token // 기존의 access token
@@ -44,9 +44,9 @@ export interface AccessTokenResponse {
4444
accessToken: Token // 신규 access token
4545
}
4646

47-
/*
48-
path: '/v1/auth/check-email'
49-
POST: 이메일 중복 체크
47+
/**
48+
- path: '/v1/auth/check-email'
49+
- POST: 이메일 중복 체크
5050
*/
5151
export interface CheckEmailRequest {
5252
email: Email // 검사하고자 하는 이메일

src/types/api/Community.types.d.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ interface CommunityDetail extends CommunityListItem {
2323
}
2424

2525
/**
26-
path: '/v1/community'
27-
GET: 커뮤니티 글 전체 조회
26+
- path: '/v1/community'
27+
- GET: 커뮤니티 글 전체 조회
2828
*/
2929
export type GetCommunityListResponse = CommunityListItem[]
3030
/**
31-
POST: 커뮤니티 글 등록
31+
- POST: 커뮤니티 글 등록
3232
*/
3333
export interface CreateCommunityRequest extends CommunityBase {
3434
isComment?: boolean // 댓글 허용 여부
@@ -40,20 +40,20 @@ export interface CreateCommunityResponse extends CommunityBase, TimeStamps {
4040
}
4141

4242
/**
43-
path: '/v1/community/{id}'
44-
GET: 커뮤니티 글 상세 조회
43+
- path: '/v1/community/{id}'
44+
- GET: 커뮤니티 글 상세 조회
4545
*/
4646
export type GetCommunityDetailResponse = CommunityDetail
4747

4848
/**
49-
PATCH: 커뮤니티 글 수정
49+
- PATCH: 커뮤니티 글 수정
5050
*/
5151
export type UpdateCommunityRequest = CommunityBase
5252
export type UpdateCommunityResponse = CreateCommunityResponse
5353

5454
/**
55-
DELETE: 커뮤니티 글 삭제
56-
반환 값: 기본 ApiResponse 구조 사용
55+
- DELETE: 커뮤니티 글 삭제
56+
- 반환 값: 기본 ApiResponse 구조 사용
5757
{
5858
"isSuccess": true,
5959
"code": "COMMON200",
@@ -62,7 +62,7 @@ DELETE: 커뮤니티 글 삭제
6262
*/
6363

6464
/**
65-
path: '/v1/community/top5'
66-
GET: 좋아요 순으로 인기 커뮤니티 Top 5 유저 조회
65+
- path: '/v1/community/top5'
66+
- GET: 좋아요 순으로 인기 커뮤니티 Top 5 유저 조회
6767
*/
6868
export type GetCommunityTop5Response = CommunityTopMember[]

src/types/api/Global.types.d.ts

Lines changed: 63 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,79 @@
11
// 기본 타입 정의
2-
type Id = number // 고유 ID
3-
type URL = string // URL
4-
type Token = string // JWT 또는 인증 토큰
2+
3+
/**
4+
고유 ID
5+
*/
6+
type Id = number
7+
/**
8+
URL
9+
*/
10+
type URL = string
11+
/**
12+
JWT 또는 인증 토큰
13+
*/
14+
type Token = string
515

616
// 사용자 관련 타입
7-
type Email = string // 이메일
8-
type Password = string // 비밀번호
9-
type Name = string // 사용자 이름
10-
type Nickname = string // 닉네임
11-
type GitHub = string // GitHub 프로필 URL
1217

13-
// 공통 속성 타입
14-
type TechStack = string // 기술 스택 (예: "React", "Node.js")
18+
/**
19+
사용자 이메일
20+
*/
21+
type Email = string
22+
/**
23+
사용자 비밀번호
24+
*/
25+
type Password = string
26+
/**
27+
사용자 이름
28+
*/
29+
type Name = string
30+
/**
31+
사용자 닉네임
32+
*/
33+
type Nickname = string
34+
/**
35+
사용자 GitHub 프로필 URL
36+
*/
37+
type GitHub = string
38+
39+
/**
40+
기술 스택 (예: "React", "Node.js")
41+
*/
42+
type TechStack = string
1543

16-
// 타임스탬프 정의
44+
/**
45+
타임스탬프 정의 (Format: date-time)
46+
- createdAt: 생성 시간 (ISO 8601)
47+
- updatedAt?: 수정 시간 (선택적, ISO 8601)
48+
*/
1749
type TimeStamps = {
18-
// Format: date-time
19-
createdAt: string // 생성 시간 (ISO 8601)
20-
updatedAt?: string // 수정 시간 (선택적, ISO 8601)
50+
createdAt: string
51+
updatedAt?: string
2152
}
2253

23-
// 사용자 관련 인터페이스
24-
interface User {
25-
id: Id // 사용자 고유 ID
26-
email: Email // 이메일
27-
name: Name // 이름
28-
nickname: Nickname // 닉네임
29-
imageUrl: URL // 프로필 이미지 URL
54+
/**
55+
사용자 관련 인터페이스
56+
- id: 사용자 고유 ID
57+
- email: 이메일
58+
- name: 이름
59+
- nickname: 닉네임
60+
- imageUrl: 프로필 이미지 URL
61+
*/
62+
type User = {
63+
id: Id
64+
email: Email
65+
name: Name
66+
nickname: Nickname
67+
imageUrl: URL
3068
}
3169

3270
// MemberInfo: 일부 사용자 정보를 제외한 타입
3371
type MemberInfo = Omit<User, 'email' | 'name'>
3472

73+
/**
74+
- request: T
75+
- file?: Format: binary
76+
*/
3577
interface MultipartFormData<T> {
3678
request: T
3779
/** Format: binary */

src/types/api/MyPage.types.d.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,52 +12,52 @@ export interface ProfileBase {
1212
affiliation?: AffiliationType // 소속
1313
}
1414

15-
/*
16-
path: '/v1/my-page/profile'
17-
GET: 마이페이지 프로필 조회
15+
/**
16+
- path: '/v1/my-page/profile'
17+
- GET: 마이페이지 프로필 조회
1818
*/
1919
export interface GetProfileResponse extends ProfileBase, User {
2020
completionRate: number // 포트폴리오 완성률 (%)
2121
}
2222

23-
/*
24-
PATCH: 마이페이지 프로필 저장
23+
/**
24+
- PATCH: 마이페이지 프로필 저장
2525
*/
2626
export type UpdateProfileRequest = MultipartFormData<ProfileBase>
2727

2828
export interface UpdateProfileResponse extends ProfileBase {
2929
completionRate?: number // 포트폴리오 완성률 (%)
3030
}
3131

32-
/*
33-
path: '/v1/my-page/check-nickname'
34-
POST: 닉네임 중복 체크
32+
/**
33+
- path: '/v1/my-page/check-nickname'
34+
- POST: 닉네임 중복 체크
3535
*/
3636
export interface CheckNicknameRequest {
3737
nickname: Nickname // 닉네임 중복 검사 대상
3838
}
3939

4040
export type CheckNicknameResponse = boolean
4141

42-
/*
43-
UpdatePasswordResponse
42+
/**
43+
- UpdatePasswordResponse
4444
{
4545
"isSuccess": true,
4646
"code": "COMMON200",
4747
"message": "비밀번호 수정이 완료되었습니다."
4848
}
4949
*/
5050

51-
/*
52-
path: '/v1/my-page/password'
53-
PATCH: 마이 페이지 비밀번호 수정
51+
/**
52+
- path: '/v1/my-page/password'
53+
- PATCH: 마이 페이지 비밀번호 수정
5454
*/
5555
export interface UpdatePasswordRequest {
5656
password: Password // 새 비밀번호
5757
}
5858

59-
/*
60-
UpdatePasswordResponse
59+
/**
60+
- UpdatePasswordResponse
6161
{
6262
"isSuccess": true,
6363
"code": "COMMON200",

src/types/api/Portfolio.types.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ export interface PortfolioDetail extends PortfolioBase {
108108
}
109109

110110
/**
111-
path: '/v1/portfolio'
112-
GET: 포트폴리오 전체 리스트 조회
111+
- path: '/v1/portfolio'
112+
- GET: 포트폴리오 전체 리스트 조회
113113
*/
114114
export type GetPortfolioListResponse = PortfolioListItem[]
115115

116116
/**
117-
path: '/v1/portfolio'
118-
POST: 포트폴리오 글 등록
117+
- path: '/v1/portfolio'
118+
- POST: 포트폴리오 글 등록
119119
*/
120120
export type CreatePortfolioRequest = MultipartFormData<PortfolioDetail>
121121
export type CreatePortfolioResponse = CreatePortfolioRequest & PostBaseBody

src/types/api/Post.types.d.ts

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,31 @@
1-
// 게시글 유형
1+
/**
2+
게시글 기본 구조
3+
*/
24
type PostCategory = 'COMMUNITY' | 'TEAM' | 'PORTFOLIO' | 'PROJECT'
35

4-
// 게시글 기본 구조
6+
/**
7+
게시글 기본 구조
8+
- id: 게시글 고유 ID
9+
- member: 게시글 작성자 정보
10+
- views: 조회수
11+
- answers: 답변 수
12+
- likes: 좋아요 수
13+
*/
514
interface PostBaseBody extends TimeStamps {
6-
id: Id // 게시글 고유 ID
7-
member: MemberInfo // 게시글 작성자 정보
8-
views: number // 조회수
9-
answers: number // 답변 수
10-
likes: number // 좋아요 수
15+
id: Id
16+
member: MemberInfo
17+
views: number
18+
answers: number
19+
likes: number
1120
}
1221

13-
// 좋아요 요청 타입
14-
interface LikeRequest {
15-
likeId: Id // 좋아요 대상 게시글 ID
16-
likeType: PostCategory // 대상 유형 (PostCategory)
22+
/**
23+
- path: '/v1/likes'
24+
- POST: 좋아요 요청
25+
- likeId: 좋아요 대상 게시글 ID
26+
- likeType: 대상 유형 (PostCategory)
27+
*/
28+
type LikeRequest = {
29+
likeId: Id
30+
likeType: PostCategory
1731
}

0 commit comments

Comments
 (0)