diff --git a/src/types/api/ApiResponse.types.d.ts b/src/types/api/ApiResponse.types.d.ts index e795d1e..1fc656b 100644 --- a/src/types/api/ApiResponse.types.d.ts +++ b/src/types/api/ApiResponse.types.d.ts @@ -1,6 +1,12 @@ +/** +- isSuccess: 요청 성공 여부 +- code: 응답 코드 (예: TEAM004) +- message: 응답 메시지 (예: "This is a deleted post.") +- result?: 응답 데이터 (제네릭 타입) +*/ interface ApiResponse { - isSuccess: boolean // 요청 성공 여부 - code: string // 응답 코드 (예: TEAM004) - message: string // 응답 메시지 (예: "This is a deleted post.") - result?: T // 응답 데이터 (제네릭 타입) + isSuccess: boolean + code: string + message: string + result?: T } diff --git a/src/types/api/Auth.types.d.ts b/src/types/api/Auth.types.d.ts index bcc7cc2..e7660ba 100644 --- a/src/types/api/Auth.types.d.ts +++ b/src/types/api/Auth.types.d.ts @@ -1,12 +1,12 @@ -/* -path: '/v1/auth' -GET: 로그인한 유저 조회 +/** +- path: '/v1/auth' +- GET: 로그인한 유저 조회 */ export type GetLoggedInUserResponse = User -/* -path: '/v1/auth/sign-up' -POST: 회원가입 +/** +- path: '/v1/auth/sign-up' +- POST: 회원가입 */ export interface SignUpRequest { email: Email // 이메일 @@ -18,9 +18,9 @@ export interface SignUpResponse extends User { gitHub: GitHub // GitHub 계정 URL } -/* -path: '/v1/auth/sign-in' -POST: 로그인 +/** +- path: '/v1/auth/sign-in' +- POST: 로그인 */ export interface SignInRequest { email: Email // 이메일 @@ -32,9 +32,9 @@ export interface SignInResponse extends User { refreshToken: Token // 리프레시 토큰 } -/* -path: '/v1/auth/new-token' -POST: 액세스 토큰 재발급 +/** +- path: '/v1/auth/new-token' +- POST: 액세스 토큰 재발급 */ export interface RefreshTokenRequest { oldAccessToken: Token // 기존의 access token @@ -44,9 +44,9 @@ export interface AccessTokenResponse { accessToken: Token // 신규 access token } -/* -path: '/v1/auth/check-email' -POST: 이메일 중복 체크 +/** +- path: '/v1/auth/check-email' +- POST: 이메일 중복 체크 */ export interface CheckEmailRequest { email: Email // 검사하고자 하는 이메일 diff --git a/src/types/api/Community.types.d.ts b/src/types/api/Community.types.d.ts index 7803cb1..79b2d8e 100644 --- a/src/types/api/Community.types.d.ts +++ b/src/types/api/Community.types.d.ts @@ -22,38 +22,38 @@ interface CommunityDetail extends CommunityListItem { isComment: boolean // 댓글 허용 여부 } -/* -path: '/v1/community' -GET: 커뮤니티 글 전체 조회 +/** +- path: '/v1/community' +- GET: 커뮤니티 글 전체 조회 */ export type GetCommunityListResponse = CommunityListItem[] -/* -POST: 커뮤니티 글 등록 +/** +- POST: 커뮤니티 글 등록 */ -export interface CommunityCreateRequest extends CommunityBase { +export interface CreateCommunityRequest extends CommunityBase { isComment?: boolean // 댓글 허용 여부 } -export interface CommunityCreateResponse extends CommunityBase, TimeStamps { +export interface CreateCommunityResponse extends CommunityBase, TimeStamps { id: Id // 생성된 커뮤니티 글 ID member: Id // 작성자 Id isComment: boolean // 댓글 허용 여부 } -/* -path: '/v1/community/{id}' -GET: 커뮤니티 글 상세 조회 +/** +- path: '/v1/community/{id}' +- GET: 커뮤니티 글 상세 조회 */ export type GetCommunityDetailResponse = CommunityDetail -/* -PATCH: 커뮤니티 글 수정 +/** +- PATCH: 커뮤니티 글 수정 */ -export type CommunityUpdateRequest = CommunityBase -export type CommunityUpdateResponse = CommunityCreateResponse +export type UpdateCommunityRequest = CommunityBase +export type UpdateCommunityResponse = CreateCommunityResponse -/* -DELETE: 커뮤니티 글 삭제 -반환 값: 기본 ApiResponse 구조 사용 +/** +- DELETE: 커뮤니티 글 삭제 +- 반환 값: 기본 ApiResponse 구조 사용 { "isSuccess": true, "code": "COMMON200", @@ -61,8 +61,8 @@ DELETE: 커뮤니티 글 삭제 } */ -/* -path: '/v1/community/top5' -GET: 좋아요 순으로 인기 커뮤니티 Top 5 유저 조회 +/** +- path: '/v1/community/top5' +- GET: 좋아요 순으로 인기 커뮤니티 Top 5 유저 조회 */ export type GetCommunityTop5Response = CommunityTopMember[] diff --git a/src/types/api/Global.types.d.ts b/src/types/api/Global.types.d.ts index b22cd1d..46c0945 100644 --- a/src/types/api/Global.types.d.ts +++ b/src/types/api/Global.types.d.ts @@ -1,37 +1,79 @@ // 기본 타입 정의 -type Id = number // 고유 ID -type URL = string // URL -type Token = string // JWT 또는 인증 토큰 + +/** +고유 ID +*/ +type Id = number +/** +URL +*/ +type URL = string +/** +JWT 또는 인증 토큰 +*/ +type Token = string // 사용자 관련 타입 -type Email = string // 이메일 -type Password = string // 비밀번호 -type Name = string // 사용자 이름 -type Nickname = string // 닉네임 -type GitHub = string // GitHub 프로필 URL -// 공통 속성 타입 -type TechStack = string // 기술 스택 (예: "React", "Node.js") +/** +사용자 이메일 +*/ +type Email = string +/** +사용자 비밀번호 +*/ +type Password = string +/** +사용자 이름 +*/ +type Name = string +/** +사용자 닉네임 +*/ +type Nickname = string +/** +사용자 GitHub 프로필 URL +*/ +type GitHub = string + +/** +기술 스택 (예: "React", "Node.js") +*/ +type TechStack = string -// 타임스탬프 정의 +/** +타임스탬프 정의 (Format: date-time) +- createdAt: 생성 시간 (ISO 8601) +- updatedAt?: 수정 시간 (선택적, ISO 8601) +*/ type TimeStamps = { - // Format: date-time - createdAt: string // 생성 시간 (ISO 8601) - updatedAt?: string // 수정 시간 (선택적, ISO 8601) + createdAt: string + updatedAt?: string } -// 사용자 관련 인터페이스 -interface User { - id: Id // 사용자 고유 ID - email: Email // 이메일 - name: Name // 이름 - nickname: Nickname // 닉네임 - imageUrl: URL // 프로필 이미지 URL +/** +사용자 관련 인터페이스 +- id: 사용자 고유 ID +- email: 이메일 +- name: 이름 +- nickname: 닉네임 +- imageUrl: 프로필 이미지 URL +*/ +type User = { + id: Id + email: Email + name: Name + nickname: Nickname + imageUrl: URL } // MemberInfo: 일부 사용자 정보를 제외한 타입 type MemberInfo = Omit +/** +- request: T +- file?: Format: binary +*/ interface MultipartFormData { request: T /** Format: binary */ diff --git a/src/types/api/MyPage.types.d.ts b/src/types/api/MyPage.types.d.ts index f3c3e0b..3601b41 100644 --- a/src/types/api/MyPage.types.d.ts +++ b/src/types/api/MyPage.types.d.ts @@ -12,26 +12,26 @@ export interface ProfileBase { affiliation?: AffiliationType // 소속 } -/* -path: '/v1/my-page/profile' -GET: 마이페이지 프로필 조회 +/** +- path: '/v1/my-page/profile' +- GET: 마이페이지 프로필 조회 */ export interface GetProfileResponse extends ProfileBase, User { completionRate: number // 포트폴리오 완성률 (%) } -/* -PATCH: 마이페이지 프로필 저장 +/** +- PATCH: 마이페이지 프로필 저장 */ -export type ProfileUpdateRequest = MultipartFormData +export type UpdateProfileRequest = MultipartFormData -export interface ProfileUpdateResponse extends ProfileBase { +export interface UpdateProfileResponse extends ProfileBase { completionRate?: number // 포트폴리오 완성률 (%) } -/* -path: '/v1/my-page/check-nickname' -POST: 닉네임 중복 체크 +/** +- path: '/v1/my-page/check-nickname' +- POST: 닉네임 중복 체크 */ export interface CheckNicknameRequest { nickname: Nickname // 닉네임 중복 검사 대상 @@ -39,8 +39,8 @@ export interface CheckNicknameRequest { export type CheckNicknameResponse = boolean -/* -PasswordUpdateResponse +/** +- UpdatePasswordResponse { "isSuccess": true, "code": "COMMON200", @@ -48,16 +48,16 @@ PasswordUpdateResponse } */ -/* -path: '/v1/my-page/password' -PATCH: 마이 페이지 비밀번호 수정 +/** +- path: '/v1/my-page/password' +- PATCH: 마이 페이지 비밀번호 수정 */ -export interface PasswordUpdateRequest { +export interface UpdatePasswordRequest { password: Password // 새 비밀번호 } -/* -PasswordUpdateResponse +/** +- UpdatePasswordResponse { "isSuccess": true, "code": "COMMON200", diff --git a/src/types/api/Portfolio.types.d.ts b/src/types/api/Portfolio.types.d.ts index d0e7b6f..93cb177 100644 --- a/src/types/api/Portfolio.types.d.ts +++ b/src/types/api/Portfolio.types.d.ts @@ -3,7 +3,7 @@ export type CommunityCategory = 'SKILL' | 'CAREER' | 'OTHER' export type CommunityLabelCategory = '기술' | '커리어' | '기타' // 기본 포트폴리오 타입 -export interface PortfolioBase { +interface PortfolioBase { portTitle: string // 포트폴리오 제목 portPosition: string // 역할 또는 직무 tags: string[] // 태그 리스트 @@ -11,24 +11,24 @@ export interface PortfolioBase { } // 수상 타입 (Award) -export type AwardType = 'COMPETITION' | 'CERTIFICATE' | 'LANGUAGE' | 'ACTIVITY' +type AwardType = 'COMPETITION' | 'CERTIFICATE' | 'LANGUAGE' | 'ACTIVITY' // 활동 상세 타입 -export interface ActivityAward { +interface ActivityAward { activityName?: string // 활동명 startDate?: string // 활동 시작일 (YYYY-MM-DD) endDate?: string // 활동 종료일 (YYYY-MM-DD) } // 자격증 상세 타입 -export interface CertificateAward { +interface CertificateAward { certificateName?: string // 자격증명 issuer?: string // 발행처 passingDate?: string // 합격 년월 (YYYY-MM-DD) } // 언어 능력 상세 타입 -export interface LanguageAward { +interface LanguageAward { language?: string // 언어 이름 testName?: string // 시험명 score?: string // 점수 @@ -36,20 +36,20 @@ export interface LanguageAward { } // 공모전 상세 타입 -export interface CompetitionAward { +interface CompetitionAward { competitionName?: string // 공모전명 hostingInstitution?: string // 주최기관 competitionDate?: string // 공모일 (YYYY-MM-DD) } // 링크 타입 -export interface PortfolioLink { +interface PortfolioLink { type?: string // 링크 유형 (예: github, blog) url?: string // URL } // 학력 상세 타입 -export interface PortfolioEducation { +interface PortfolioEducation { level?: string // 학력 구분 (예: 대학, 고등학교) institutionName?: string // 학교명 major?: string // 전공 @@ -62,7 +62,7 @@ export interface PortfolioEducation { } // 경력 상세 타입 -export interface PortfolioCareer { +interface PortfolioCareer { companyName?: string // 회사명 position?: string // 직무 startDate?: string // 입사일 (YYYY-MM-DD) @@ -73,30 +73,26 @@ export interface PortfolioCareer { } // 상장 요청 타입 -export interface AwardRequestBase { +interface AwardRequestBase { awardType?: AwardType } -export interface ActivityAwardRequest extends AwardRequestBase, ActivityAward { +interface ActivityAwardRequest extends AwardRequestBase, ActivityAward { awardType: 'ACTIVITY' } -export interface CertificateAwardRequest - extends AwardRequestBase, - CertificateAward { +interface CertificateAwardRequest extends AwardRequestBase, CertificateAward { awardType: 'CERTIFICATE' } -export interface CompetitionAwardRequest - extends AwardRequestBase, - CompetitionAward { +interface CompetitionAwardRequest extends AwardRequestBase, CompetitionAward { awardType: 'COMPETITION' } -export interface LanguageAwardRequest extends AwardRequestBase, LanguageAward { +interface LanguageAwardRequest extends AwardRequestBase, LanguageAward { awardType: 'LANGUAGE' } -// 포트폴리오 리스트 조회 +// 포트폴리오 리스트 아이템 export type PortfolioListItem = PortfolioBase & PostBaseBody -// 포트폴리오 리스트 조회 +// 포트폴리오 상세글 export interface PortfolioDetail extends PortfolioBase { portContent: string // 상세 내용 techStacks: TechStack[] // 사용 기술 스택 @@ -111,8 +107,15 @@ export interface PortfolioDetail extends PortfolioBase { careers?: PortfolioCareer[] // 경력 리스트 } -// 포트폴리오 생성 요청 타입 -export type PortfolioCreateRequest = MultipartFormData +/** +- path: '/v1/portfolio' +- GET: 포트폴리오 전체 리스트 조회 +*/ +export type GetPortfolioListResponse = PortfolioListItem[] -// 포트폴리오 생성 응답 타입 -export type PortfolioCreateResponse = PortfolioCreateRequest & PostBaseBody +/** +- path: '/v1/portfolio' +- POST: 포트폴리오 글 등록 +*/ +export type CreatePortfolioRequest = MultipartFormData +export type CreatePortfolioResponse = CreatePortfolioRequest & PostBaseBody diff --git a/src/types/api/Post.types.d.ts b/src/types/api/Post.types.d.ts index d98c5d7..5025780 100644 --- a/src/types/api/Post.types.d.ts +++ b/src/types/api/Post.types.d.ts @@ -1,17 +1,31 @@ -// 게시글 유형 +/** +게시글 기본 구조 +*/ type PostCategory = 'COMMUNITY' | 'TEAM' | 'PORTFOLIO' | 'PROJECT' -// 게시글 기본 구조 +/** +게시글 기본 구조 +- id: 게시글 고유 ID +- member: 게시글 작성자 정보 +- views: 조회수 +- answers: 답변 수 +- likes: 좋아요 수 +*/ interface PostBaseBody extends TimeStamps { - id: Id // 게시글 고유 ID - member: MemberInfo // 게시글 작성자 정보 - views: number // 조회수 - answers: number // 답변 수 - likes: number // 좋아요 수 + id: Id + member: MemberInfo + views: number + answers: number + likes: number } -// 좋아요 요청 타입 -interface LikeRequest { - likeId: Id // 좋아요 대상 ID - likeType: PostCategory // 대상 유형 (PostCategory) +/** +- path: '/v1/likes' +- POST: 좋아요 요청 +- likeId: 좋아요 대상 게시글 ID +- likeType: 대상 유형 (PostCategory) +*/ +type LikeRequest = { + likeId: Id + likeType: PostCategory } diff --git a/src/types/api/Team.types.d.ts b/src/types/api/Team.types.d.ts index 631a0a4..b9e8d56 100644 --- a/src/types/api/Team.types.d.ts +++ b/src/types/api/Team.types.d.ts @@ -4,8 +4,10 @@ export type TeamLabelType = '스터디' | '프로젝트' | '멘토링' // 팀 export type TeamRecruitmentLabelType = '모집 중' | '모집 완료' // 모집 상태 라벨 export type TeamPosition = string // 역할 (예: 프론트엔드, 백엔드 등) -// 팀 모집글 공통 속성 -type TeamBase = { +/** +팀 모집글 공통 속성 +*/ +type TeamRecruitmentBase = { teamTitle: string // 팀 모집글 제목 teamContent: string // 팀 모집글 내용 teamType: TeamType // 팀 모집글 유형 @@ -15,33 +17,39 @@ type TeamBase = { teamTags?: Tag[] // 태그 } -// 팀 모집글 리스트 아이템 -export interface TeamListItem extends PostBaseBody, TeamBase { +/** +팀 모집글 리스트 아이템 +*/ +export interface TeamRecruitmentListItem + extends PostBaseBody, + TeamRecruitmentBase { teamIsActive: boolean // 모집 활성 상태 } -/* -path: '/v1/team' -GET: 팀 모집글 모집급 전체 조회 +/** +- path: '/v1/team' +- GET: 팀 모집글 모집급 전체 조회 */ -export type GetTeamListResponse = TeamListItem[] +export type GetTeamRecruitmentListResponse = TeamRecruitmentListItem[] -/* -POST: 팀 모집글 등록 +/** +- POST: 팀 모집글 등록 */ -export type TeamCreateRequest = TeamBase -export interface TeamCreateResponse extends TimeStamps, TeamBase { +export type CreateTeamRecruitmentRequest = TeamRecruitmentBase +export interface CreateTeamRecruitmentResponse + extends TimeStamps, + TeamRecruitmentBase { id: Id // 팀 모집글 ID } -/* -path: '/v1/team/{teamId}' -GET: 팀 모집글 상세 조회 +/** +- path: '/v1/team/{teamId}' +- GET: 팀 모집글 상세 조회 */ -export type GetTeamDetailResponse = TeamListItem +export type GetTeamRecruitmentResponse = TeamRecruitmentListItem -/* -DELETE: 팀 모집글 삭제 +/** +- DELETE: 팀 모집글 삭제 반환 값: 공통 응답 타입 활용 (ApiResponse) { "isSuccess": true, @@ -50,23 +58,22 @@ DELETE: 팀 모집글 삭제 } */ -/* -path: '/v1/team/{teamId}/add' - -POST: 팀 모집글 멤버 추가 +/** +- path: '/v1/team/{teamId}/add' +- POST: 팀 모집글 멤버 추가 */ -export interface TeamAddMemberRequest { +export interface AddTeamMemberRequest { memberId: Id // 추가할 멤버 ID } -export interface TeamAddMemberResponse { +export type AddTeamMemberResponse = { id: Id // 추가 작업 ID teamId: Id // 팀 모집글 ID memberId: Id // 멤버 ID } -/* -path: '/v1/team/{teamId}/close' -PATCH: 팀 모집글 모집 마감 +/** +- path: '/v1/team/{teamId}/close' +- PATCH: 팀 모집글 모집 마감 반환 값: { @@ -76,15 +83,15 @@ PATCH: 팀 모집글 모집 마감 } */ -/* -path: '/v1/team/{teamId}/search-members' -GET: 멤버 리스트 검색 +/** +- path: '/v1/team/{teamId}/search-members' +- GET: 멤버 리스트 검색 */ export type SearchMembersResponse = MemberInfo[] -/* -path: '/v1/team/{teamId}/members' -GET: 팀 모집글 멤버 전체 조회 +/** +- path: '/v1/team/{teamId}/members' +- GET: 팀 모집글 멤버 전체 조회 */ export type GetTeamMembersResponse = { teamId: Id // 팀 모집글 ID