Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/types/api/ApiResponse.types.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/**
- isSuccess: 요청 성공 여부
- code: 응답 코드 (예: TEAM004)
- message: 응답 메시지 (예: "This is a deleted post.")
- result?: 응답 데이터 (제네릭 타입)
*/
interface ApiResponse<T = unknown> {
isSuccess: boolean // 요청 성공 여부
code: string // 응답 코드 (예: TEAM004)
message: string // 응답 메시지 (예: "This is a deleted post.")
result?: T // 응답 데이터 (제네릭 타입)
isSuccess: boolean
code: string
message: string
result?: T
}
30 changes: 15 additions & 15 deletions src/types/api/Auth.types.d.ts
Original file line number Diff line number Diff line change
@@ -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 // 이메일
Expand All @@ -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 // 이메일
Expand All @@ -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
Expand All @@ -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 // 검사하고자 하는 이메일
Expand Down
40 changes: 20 additions & 20 deletions src/types/api/Community.types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,47 +22,47 @@ 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",
"message": "팀 모집글이 성공적으로 삭제되었습니다."
}
*/

/*
path: '/v1/community/top5'
GET: 좋아요 순으로 인기 커뮤니티 Top 5 유저 조회
/**
- path: '/v1/community/top5'
- GET: 좋아요 순으로 인기 커뮤니티 Top 5 유저 조회
*/
export type GetCommunityTop5Response = CommunityTopMember[]
84 changes: 63 additions & 21 deletions src/types/api/Global.types.d.ts
Original file line number Diff line number Diff line change
@@ -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<User, 'email' | 'name'>

/**
- request: T
- file?: Format: binary
*/
interface MultipartFormData<T> {
request: T
/** Format: binary */
Expand Down
36 changes: 18 additions & 18 deletions src/types/api/MyPage.types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +12,52 @@ 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<ProfileBase>
export type UpdateProfileRequest = MultipartFormData<ProfileBase>

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 // 닉네임 중복 검사 대상
}

export type CheckNicknameResponse = boolean

/*
PasswordUpdateResponse
/**
- UpdatePasswordResponse
{
"isSuccess": true,
"code": "COMMON200",
"message": "비밀번호 수정이 완료되었습니다."
}
*/

/*
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",
Expand Down
Loading
Loading