Skip to content

Commit 0912b46

Browse files
committed
[#60] 💄 format and organize prior types
1 parent 9c6f83a commit 0912b46

File tree

6 files changed

+116
-99
lines changed

6 files changed

+116
-99
lines changed

src/types/apiResponse.types.d.ts

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

src/types/auth.types.d.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,32 @@
22
path: '/v1/auth'
33
GET: 로그인한 유저 조회
44
*/
5-
export type GetMemberInfoResult = User
5+
export type GetLoggedInUserResponse = User
66

77
/*
88
path: '/v1/auth/sign-up'
99
POST: 회원가입
1010
*/
1111
export interface SignUpRequest {
12-
email: Email
13-
password: Password
14-
name: Name
15-
gitHub: GitHub
12+
email: Email // 이메일
13+
password: Password // 비밀번호
14+
name: Name // 사용자 이름
15+
gitHub: GitHub // GitHub 계정 URL
1616
}
1717
export interface SignUpResponse extends User {
18-
gitHub: GitHub
18+
gitHub: GitHub // GitHub 계정 URL
1919
}
2020

2121
/*
2222
path: '/v1/auth/sign-in'
2323
POST: 로그인
2424
*/
2525
export interface SignInRequest {
26-
email: Email
27-
password: Password
26+
email: Email // 이메일
27+
password: Password // 비밀번호
2828
}
29-
export interface SignInResponseResult extends User {
30-
accessToken: Token
31-
refreshToken: Token
29+
30+
export interface SignInResponse extends User {
31+
accessToken: Token // 액세스 토큰
32+
refreshToken: Token // 리프레시 토큰
3233
}

src/types/community.types.d.ts

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,59 @@
1+
// 커뮤니티 카테고리
12
export type CommunityCategory = 'SKILL' | 'CAREER' | 'OTHER'
23
export type CommunityLabelCategory = '기술' | '커리어' | '기타'
34

4-
type CommunityBaseBody = {
5-
communityCategory: CommunityCategory
6-
communityTitle: string
7-
communityContent: string
5+
type CommunityBase = {
6+
communityCategory: CommunityCategory // 커뮤니티 글 카테고리
7+
communityTitle: string // 커뮤니티 글 제목
8+
communityContent: string // 커뮤니티 글 내용
89
}
910

11+
// 인기 멤버 구조
1012
type CommunityTop5Member = {
11-
member: MemberInfo
12-
totalLikes: number
13+
member: MemberInfo // 멤버 정보
14+
totalLikes: number // 총 좋아요 수
1315
}
1416

15-
interface CommunityListType extends PostBaseBody, CommunityBaseBody {}
17+
// 커뮤니티 리스트 타입
18+
interface CommunityListItem extends PostBaseBody, CommunityBase {}
1619

17-
interface CommunityDetail extends CommunityListDetail {
18-
isComment: boolean
20+
// 커뮤니티 상세 타입
21+
interface CommunityDetail extends CommunityListItem {
22+
isComment: boolean // 댓글 허용 여부
1923
}
24+
2025
/*
2126
path: '/v1/community'
2227
GET: 커뮤니티 글 전체 조회
2328
*/
24-
export type GetCommunityListResponse = CommunityListType
25-
/* POST: 커뮤니티 글 등록 */
26-
export interface CommunityCreateRequest extends CommunityBaseBody {
27-
isComment?: boolean // 답변 동의 여부
29+
export type GetCommunityListResponse = CommunityListItem[]
30+
/*
31+
POST: 커뮤니티 글 등록
32+
*/
33+
export interface CommunityCreateRequest extends CommunityBase {
34+
isComment?: boolean // 댓글 허용 여부
2835
}
29-
export interface CommunityCreateResponse extends CommunityBaseBody, TimeStamps {
30-
id: Id
36+
export interface CommunityCreateResponse extends CommunityBase, TimeStamps {
37+
id: Id // 생성된 커뮤니티 글 ID
3138
member: Id // 작성자 Id
32-
isComment: boolean
39+
isComment: boolean // 댓글 허용 여부
3340
}
3441

3542
/*
3643
path: '/v1/community/{id}'
3744
GET: 커뮤니티 글 상세 조회
3845
*/
3946
export type GetCommunityDetailResponse = CommunityDetail
40-
/* PATHCH: 커뮤니티 글 수정 */
41-
export type CommunityUpdateRequest = CommunityBaseBody
47+
48+
/*
49+
PATCH: 커뮤니티 글 수정
50+
*/
51+
export type CommunityUpdateRequest = CommunityBase
4252
export type CommunityUpdateResponse = CommunityCreateResponse
43-
/* DELETE: 커뮤니티 글 삭제
44-
반환 값:
53+
54+
/*
55+
DELETE: 커뮤니티 글 삭제
56+
반환 값: 기본 ApiResponse 구조 사용
4557
{
4658
"isSuccess": true,
4759
"code": "COMMON200",
@@ -51,6 +63,6 @@ export type CommunityUpdateResponse = CommunityCreateResponse
5163

5264
/*
5365
path: '/v1/community/top5'
54-
GET: 인기 커뮤니티 Top5 유저 조회 (좋아요 순))
66+
GET: 좋아요 순으로 인기 커뮤니티 Top 5 유저 조회
5567
*/
56-
export type GetCommunityTop5Response = CommunityTop5Member[]
68+
export type GetCommunityTop5Response = CommunityTopMember[]

src/types/global.types.d.ts

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
// 기본 타입 정의
2-
type Id = number
3-
type URL = string
4-
type Token = string
2+
type Id = number // 고유 ID
3+
type URL = string // URL
4+
type Token = string // JWT 또는 인증 토큰
55

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

1313
// 공통 속성 타입
14-
type TechStack = string
14+
type TechStack = string // 기술 스택 (예: "React", "Node.js")
1515

1616
// 타임스탬프 정의
1717
type TimeStamps = {
1818
// Format: date-time
19-
createdAt: string
20-
updatedAt?: string // 있을 수도 있고 없을 수도 있음
19+
createdAt: string // 생성 시간 (ISO 8601)
20+
updatedAt?: string // 수정 시간 (선택적, ISO 8601)
2121
}
2222

2323
// 사용자 관련 인터페이스
2424
interface User {
25-
id: Id
26-
email: Email
27-
name: Name
28-
nickname: Nickname
29-
imageUrl: URL
25+
id: Id // 사용자 고유 ID
26+
email: Email // 이메일
27+
name: Name // 이름
28+
nickname: Nickname // 닉네임
29+
imageUrl: URL // 프로필 이미지 URL
3030
}
3131

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

src/types/post.types.d.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
// 게시글 관련 타입
2-
type PostType = 'COMMUNITY' | 'TEAM' | 'PORTFOLIO' | 'PROJECT'
1+
// 게시글 유형
2+
type PostCategory = 'COMMUNITY' | 'TEAM' | 'PORTFOLIO' | 'PROJECT'
33

44
// 게시글 기본 구조
55
interface PostBaseBody extends TimeStamps {
6-
id: Id
7-
member: MemberInfo // 게시글 작성자
8-
views: number
9-
answers: number
10-
likes: number
6+
id: Id // 게시글 고유 ID
7+
member: MemberInfo // 게시글 작성자 정보
8+
views: number // 조회수
9+
answers: number // 답변 수
10+
likes: number // 좋아요 수
1111
}
1212

13+
// 좋아요 요청 타입
1314
interface LikeRequest {
14-
likeId: Id
15-
likeType: PostType
15+
likeId: Id // 좋아요 대상 ID
16+
likeType: PostCategory // 대상 유형 (PostCategory)
1617
}

src/types/team.types.d.ts

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,72 @@
1-
export type TeamType = 'STUDY' | 'PROJECT' | 'MENTORING'
2-
export type TeamLabelType = '스터디' | '프로젝트' | '멘토링'
3-
export type TeamRecruitmentLabelType = '모집 중' | '모집 완료'
4-
export type TeamPosition = string
1+
// 팀 모집글 관련 기본 타입
2+
export type TeamType = 'STUDY' | 'PROJECT' | 'MENTORING' // 팀 모집글 유형
3+
export type TeamLabelType = '스터디' | '프로젝트' | '멘토링' // 팀 모집글 유형 라벨
4+
export type TeamRecruitmentLabelType = '모집 중' | '모집 완료' // 모집 상태 라벨
5+
export type TeamPosition = string // 역할 (예: 프론트엔드, 백엔드 등)
56

6-
type TeamBaseBody = {
7-
teamTitle: string
8-
teamContent: string
9-
teamType: TeamType
10-
teamPosition: TeamPosition
11-
teamRecruitmentNum: number
12-
teamTechStack?: TechStack[]
13-
teamTags?: Tag[]
7+
// 팀 모집글 공통 속성
8+
type TeamBase = {
9+
teamTitle: string // 팀 모집글 제목
10+
teamContent: string // 팀 모집글 내용
11+
teamType: TeamType // 팀 모집글 유형
12+
teamPosition: TeamPosition // 모집 역할
13+
teamRecruitmentNum: number // 모집 인원
14+
teamTechStack?: TechStack[] // 사용 기술 스택
15+
teamTags?: Tag[] // 태그
1416
}
1517

16-
export interface TeamListType extends PostBaseBody, TeamBaseBody {
17-
teamIsActive: boolean
18+
// 팀 모집글 리스트 아이템
19+
export interface TeamListItem extends PostBaseBody, TeamBase {
20+
teamIsActive: boolean // 모집 활성 상태
1821
}
1922

2023
/*
2124
path: '/v1/team'
22-
23-
GET: 팀 모집급 전체 조회
25+
GET: 팀 모집글 모집급 전체 조회
2426
*/
25-
export type GetTeamListResponse = TeamListType[]
27+
export type GetTeamListResponse = TeamListItem[]
2628

27-
/* POST: 팀 모집글 등록 */
28-
export type TeamCreateRequest = TeamBaseBody
29-
export interface TeamCreateResponse extends TimeStamps, TeamBaseBody {
30-
id: Id
29+
/*
30+
POST: 팀 모집글 등록
31+
*/
32+
export type TeamCreateRequest = TeamBase
33+
export interface TeamCreateResponse extends TimeStamps, TeamBase {
34+
id: Id // 팀 모집글 ID
3135
}
3236

3337
/*
3438
path: '/v1/team/{teamId}'
3539
GET: 팀 모집글 상세 조회
3640
*/
37-
export type GetTeamDetailResponse = TeamListType
41+
export type GetTeamDetailResponse = TeamListItem
3842

39-
/* DELETE: 팀 모집글 삭제
40-
41-
반환 값:
43+
/*
44+
DELETE: 팀 모집글 삭제
45+
반환 값: 공통 응답 타입 활용 (ApiResponse)
4246
{
4347
"isSuccess": true,
4448
"code": "COMMON200",
45-
"message": "팀 모집글이 성공적으로 삭제되었습니다."
49+
"message": "팀 모집글 모집글이 성공적으로 삭제되었습니다."
4650
}
4751
*/
4852

4953
/*
5054
path: '/v1/team/{teamId}/add'
5155
52-
POST: 팀 멤버 추가
56+
POST: 팀 모집글 멤버 추가
5357
*/
5458
export interface TeamAddMemberRequest {
55-
memberId: Id
59+
memberId: Id // 추가할 멤버 ID
5660
}
5761
export interface TeamAddMemberResponse {
58-
id: Id
59-
teamId: Id
60-
memberId: Id
62+
id: Id // 추가 작업 ID
63+
teamId: Id // 팀 모집글 ID
64+
memberId: Id // 멤버 ID
6165
}
6266

6367
/*
6468
path: '/v1/team/{teamId}/close'
65-
PATCH: 팀 모집 마감
69+
PATCH: 팀 모집글 모집 마감
6670
6771
반환 값:
6872
{
@@ -80,9 +84,9 @@ export type SearchMembersResponse = MemberInfo[]
8084

8185
/*
8286
path: '/v1/team/{teamId}/members'
83-
GET: 팀 멤버 전체 조회
87+
GET: 팀 모집글 멤버 전체 조회
8488
*/
8589
export type GetTeamMembersResponse = {
86-
teamId: Id
87-
members: MemberInfo[]
90+
teamId: Id // 팀 모집글 ID
91+
members: MemberInfo[] // 팀 모집글 멤버 리스트
8892
}

0 commit comments

Comments
 (0)