diff --git a/src/api/applicationApi.ts b/src/api/applicationApi.ts new file mode 100644 index 00000000..a53bc455 --- /dev/null +++ b/src/api/applicationApi.ts @@ -0,0 +1,65 @@ +import type { NoticeInfo } from './alertApi'; +import type { ShopInfo } from './shopApi'; +import type { UserProfileItem } from './userApi'; + +export interface LinkInfo { + rel: string; + description: string; + method: string; + href: string; +} + +export interface ApplicationItem { + id: string; + status: 'pending' | 'accepted' | 'rejected' | 'canceled'; + createdAt: string; +} + +export interface ApplicationUserItem extends ApplicationItem { + shop: ShopInfo; + notice: NoticeInfo; +} + +export interface ApplicationNoticeItem extends ApplicationUserItem { + user: { + item: UserProfileItem; + href: string; + }; +} + +export interface ApplicationUserInfo { + item: ApplicationUserItem; + link: LinkInfo[]; +} + +// POST /shops/{shop_id}/notices/{notice_id}/applications - 가게의 특정 공고 지원 등록 response +// PUT /shops/{shop_id}/notices/{notice_id}/applications/{application_id} - 가게의 특정 공고 지원 승인, 거절 또는 취소 response +export interface ApplicationNoticeInfo { + item: ApplicationNoticeItem; + link: LinkInfo[]; +} + +// GET /users/{user_id}/applications - 유저의 지원 목록 조회 response +export interface ApplicationUserResponse { + offset: number; + limit: number; + count: number; + hasNext: boolean; + items: ApplicationUserInfo[]; + link: LinkInfo[]; +} + +// GET /shops/{shop_id}/notices/{notice_id}/applications - 가게의 특정 공고의 지원 목록 조회 response +export interface ApplicationNoticeResponse { + offset: number; + limit: number; + count: number; + hasNext: boolean; + items: ApplicationNoticeInfo[]; + link: LinkInfo[]; +} + +// PUT /shops/{shop_id}/notices/{notice_id}/applications/{application_id} - 가게의 특정 공고 지원 승인, 거절 또는 취소 request +export interface ApplicationRequest { + status: 'accepted' | 'rejected' | 'canceled'; +} diff --git a/src/api/noticeApi.ts b/src/api/noticeApi.ts index a04759f0..fa2d0dfb 100644 --- a/src/api/noticeApi.ts +++ b/src/api/noticeApi.ts @@ -1,3 +1,4 @@ +import type { ApplicationItem } from './applicationApi'; import type { ShopInfo } from './shopApi'; // Link (공통 링크 타입) @@ -8,13 +9,6 @@ export interface LinkInfo { href: string; } -// Application (신청 상태) -export interface ApplicationItem { - id: string; - status: 'pending' | 'accepted' | 'rejected' | 'canceled'; - createdAt: string; -} - // 공통 Notice Item export interface NoticeItem { id: string;