-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fe-dev' of https://github.com/woowacourse-teams/2024-ha…
- Loading branch information
Showing
208 changed files
with
3,567 additions
and
4,017 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
client/src/apis/tempPrefix.ts → client/src/apis/endpointPrefix.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
// TODO: (@weadie) 반복되서 쓰이는 이 api/events가 추후 수정 가능성이 있어서 일단 편집하기 편하게 이 변수를 재사용하도록 했습니다. | ||
export const TEMP_PREFIX = '/api/events'; | ||
export const USER_API_PREFIX = '/api/events'; | ||
export const ADMIN_API_PREFIX = '/api/admin/events'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,73 @@ | ||
import type {Bill, MemberReportInAction} from 'types/serviceType'; | ||
import type {BillDetails} from 'types/serviceType'; | ||
|
||
import {BASE_URL} from '@apis/baseUrl'; | ||
import {TEMP_PREFIX} from '@apis/tempPrefix'; | ||
import {ADMIN_API_PREFIX, USER_API_PREFIX} from '@apis/endpointPrefix'; | ||
import {requestDelete, requestGet, requestPostWithoutResponse, requestPut} from '@apis/fetcher'; | ||
import {WithEventId} from '@apis/withEventId.type'; | ||
import {WithBillId, WithEventId} from '@apis/withId.type'; | ||
|
||
type RequestPostBillList = { | ||
billList: Bill[]; | ||
}; | ||
export interface RequestPostBill { | ||
title: string; | ||
price: number; | ||
members: number[]; | ||
} | ||
|
||
export const requestPostBillList = async ({eventId, billList}: WithEventId<RequestPostBillList>) => { | ||
export const requestPostBill = async ({eventId, title, price, members}: WithEventId<RequestPostBill>) => { | ||
await requestPostWithoutResponse({ | ||
baseUrl: BASE_URL.HD, | ||
endpoint: `${TEMP_PREFIX}/${eventId}/bill-actions`, | ||
endpoint: `${ADMIN_API_PREFIX}/${eventId}/bills`, | ||
body: { | ||
actions: billList, | ||
title, | ||
price, | ||
members, | ||
}, | ||
}); | ||
}; | ||
|
||
type RequestBillAction = { | ||
actionId: number; | ||
}; | ||
|
||
export const requestDeleteBillAction = async ({eventId, actionId}: WithEventId<RequestBillAction>) => { | ||
export const requestDeleteBill = async ({eventId, billId}: WithEventId<WithBillId>) => { | ||
await requestDelete({ | ||
baseUrl: BASE_URL.HD, | ||
endpoint: `${TEMP_PREFIX}/${eventId}/bill-actions/${actionId}`, | ||
endpoint: `${ADMIN_API_PREFIX}/${eventId}/bills/${billId}`, | ||
}); | ||
}; | ||
|
||
type RequestPutBillAction = Bill & RequestBillAction; | ||
export interface RequestPutBill { | ||
title: string; | ||
price: number; | ||
} | ||
|
||
export const requestPutBillAction = async ({eventId, actionId, title, price}: WithEventId<RequestPutBillAction>) => { | ||
export const requestPutBill = async ({eventId, billId, title, price}: WithEventId<WithBillId<RequestPutBill>>) => { | ||
await requestPut({ | ||
baseUrl: BASE_URL.HD, | ||
endpoint: `${TEMP_PREFIX}/${eventId}/bill-actions/${actionId}`, | ||
body: { | ||
title, | ||
price, | ||
}, | ||
endpoint: `${ADMIN_API_PREFIX}/${eventId}/bills/${billId}`, | ||
body: {title, price}, | ||
}); | ||
}; | ||
|
||
export type MemberReportList = {members: MemberReportInAction[]}; | ||
|
||
export const requestGetMemberReportListInAction = async ({eventId, actionId}: WithEventId<RequestBillAction>) => { | ||
return requestGet<MemberReportList>({ | ||
export const requestGetBillDetails = async ({eventId, billId}: WithEventId<WithBillId>) => { | ||
return requestGet<BillDetails>({ | ||
baseUrl: BASE_URL.HD, | ||
endpoint: `${TEMP_PREFIX}/${eventId}/bill-actions/${actionId}/fixed`, | ||
endpoint: `${USER_API_PREFIX}/${eventId}/bills/${billId}/fixed`, | ||
}); | ||
}; | ||
|
||
type RequestPutMemberReportList = RequestBillAction & MemberReportList; | ||
interface PutBillDetail { | ||
id: number; | ||
price: number; | ||
isFixed: boolean; | ||
} | ||
|
||
export interface RequestPutBillDetails { | ||
billDetails: PutBillDetail[]; | ||
} | ||
|
||
export const requestPutMemberReportListInAction = async ({ | ||
export const requestPutBillDetails = async ({ | ||
eventId, | ||
actionId, | ||
members, | ||
}: WithEventId<RequestPutMemberReportList>) => { | ||
return requestPut({ | ||
billId, | ||
billDetails, | ||
}: WithEventId<WithBillId<RequestPutBillDetails>>) => { | ||
await requestPut({ | ||
baseUrl: BASE_URL.HD, | ||
endpoint: `${TEMP_PREFIX}/${eventId}/bill-actions/${actionId}/fixed`, | ||
body: { | ||
members, | ||
}, | ||
endpoint: `${ADMIN_API_PREFIX}/${eventId}/bills/${billId}/fixed`, | ||
body: {billDetails}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,43 @@ | ||
import {TEMP_PREFIX} from '@apis/tempPrefix'; | ||
import {requestGet, requestPostWithResponse} from '@apis/fetcher'; | ||
import {WithEventId} from '@apis/withEventId.type'; | ||
import {Event, EventId} from 'types/serviceType'; | ||
|
||
export type RequestPostNewEvent = { | ||
import {USER_API_PREFIX} from '@apis/endpointPrefix'; | ||
import {requestGet, requestPostWithResponse, requestPut} from '@apis/fetcher'; | ||
import {WithEventId} from '@apis/withId.type'; | ||
|
||
export interface RequestPostEvent { | ||
eventName: string; | ||
password: string; | ||
}; | ||
} | ||
|
||
export type ResponsePostNewEvent = { | ||
eventId: string; | ||
}; | ||
|
||
export const requestPostNewEvent = async ({eventName, password}: RequestPostNewEvent) => { | ||
return await requestPostWithResponse<ResponsePostNewEvent>({ | ||
endpoint: TEMP_PREFIX, | ||
export const requestPostEvent = async ({eventName, password}: RequestPostEvent) => { | ||
return await requestPostWithResponse<EventId>({ | ||
endpoint: USER_API_PREFIX, | ||
body: { | ||
eventName: eventName, | ||
password: password, | ||
eventName, | ||
password, | ||
}, | ||
}); | ||
}; | ||
|
||
type ResponseGetEventName = { | ||
eventName: string; | ||
export const requestGetEvent = async ({eventId}: WithEventId) => { | ||
return await requestGet<Event>({ | ||
endpoint: `${USER_API_PREFIX}/${eventId}`, | ||
}); | ||
}; | ||
|
||
export const requestGetEventName = async ({eventId}: WithEventId) => { | ||
return requestGet<ResponseGetEventName>({ | ||
endpoint: `${TEMP_PREFIX}/${eventId}`, | ||
export interface RequestPutEvent { | ||
eventName?: string; | ||
bankName?: string; | ||
accountNumber?: string; | ||
} | ||
|
||
export const requestPutEvent = async ({eventId, eventName, bankName, accountNumber}: WithEventId<RequestPutEvent>) => { | ||
return await requestPut({ | ||
endpoint: `${USER_API_PREFIX}/${eventId}`, | ||
body: { | ||
eventName, | ||
bankName, | ||
accountNumber, | ||
}, | ||
}); | ||
}; |
Oops, something went wrong.