-
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.
- Loading branch information
Showing
167 changed files
with
2,801 additions
and
3,969 deletions.
There are no files selected for viewing
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, | ||
}, | ||
}); | ||
}; |
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,84 +1,68 @@ | ||
import type {MemberType} from 'types/serviceType'; | ||
import type {AllMembers, Members} from 'types/serviceType'; | ||
|
||
import {BASE_URL} from '@apis/baseUrl'; | ||
import {TEMP_PREFIX} from '@apis/tempPrefix'; | ||
import {requestDelete, requestGet, requestPut, requestPostWithoutResponse} from '@apis/fetcher'; | ||
import {WithEventId} from '@apis/withEventId.type'; | ||
import {ADMIN_API_PREFIX, USER_API_PREFIX} from '@apis/endpointPrefix'; | ||
import {requestDelete, requestGet, requestPut, requestPostWithResponse} from '@apis/fetcher'; | ||
import {WithEventId} from '@apis/withId.type'; | ||
|
||
type RequestPostMemberList = { | ||
memberNameList: string[]; | ||
type: MemberType; | ||
}; | ||
interface PostMember { | ||
name: string; | ||
} | ||
|
||
export interface RequestPostMembers { | ||
members: PostMember[]; | ||
} | ||
|
||
export const requestPostMemberList = async ({eventId, type, memberNameList}: WithEventId<RequestPostMemberList>) => { | ||
await requestPostWithoutResponse({ | ||
export const requestPostMembers = async ({eventId, members: newMembers}: WithEventId<RequestPostMembers>) => { | ||
return await requestPostWithResponse<Members>({ | ||
baseUrl: BASE_URL.HD, | ||
endpoint: `${TEMP_PREFIX}/${eventId}/member-actions`, | ||
endpoint: `${ADMIN_API_PREFIX}/${eventId}/members`, | ||
body: { | ||
members: memberNameList, | ||
status: type, | ||
members: newMembers, | ||
}, | ||
}); | ||
}; | ||
|
||
type RequestDeleteMemberAction = { | ||
actionId: number; | ||
}; | ||
export interface RequestDeleteMember { | ||
memberId: number; | ||
} | ||
|
||
export const requestDeleteMemberAction = async ({eventId, actionId}: WithEventId<RequestDeleteMemberAction>) => { | ||
export const requestDeleteMember = async ({eventId, memberId}: WithEventId<RequestDeleteMember>) => { | ||
await requestDelete({ | ||
baseUrl: BASE_URL.HD, | ||
endpoint: `${TEMP_PREFIX}/${eventId}/member-actions/${actionId}`, | ||
}); | ||
}; | ||
|
||
type ResponseGetAllMemberList = { | ||
memberNames: string[]; | ||
}; | ||
|
||
export const requestGetAllMemberList = async ({eventId}: WithEventId) => { | ||
return requestGet<ResponseGetAllMemberList>({ | ||
endpoint: `${TEMP_PREFIX}/${eventId}/members`, | ||
endpoint: `${ADMIN_API_PREFIX}/${eventId}/members/${memberId}`, | ||
}); | ||
}; | ||
|
||
export type MemberChange = { | ||
before: string; | ||
after: string; | ||
}; | ||
interface PutMember { | ||
id: number; | ||
name: string; | ||
isDeposited: boolean; | ||
} | ||
|
||
type RequestPutAllMemberList = { | ||
members: MemberChange[]; | ||
}; | ||
export interface RequestPutMembers { | ||
members: PutMember[]; | ||
} | ||
|
||
export const requestPutAllMemberList = async ({eventId, members}: WithEventId<RequestPutAllMemberList>) => { | ||
export const requestPutMembers = async ({eventId, members}: WithEventId<RequestPutMembers>) => { | ||
await requestPut({ | ||
baseUrl: BASE_URL.HD, | ||
endpoint: `${TEMP_PREFIX}/${eventId}/members/nameChange`, | ||
endpoint: `${ADMIN_API_PREFIX}/${eventId}/members`, | ||
body: { | ||
members, | ||
members: members, | ||
}, | ||
}); | ||
}; | ||
|
||
type RequestDeleteAllMemberList = { | ||
memberName: string; | ||
}; | ||
|
||
export const requestDeleteAllMemberList = async ({eventId, memberName}: WithEventId<RequestDeleteAllMemberList>) => { | ||
await requestDelete({ | ||
export const requestGetCurrentMembers = async ({eventId}: WithEventId) => { | ||
return await requestGet<Members>({ | ||
baseUrl: BASE_URL.HD, | ||
endpoint: `${TEMP_PREFIX}/${eventId}/members/${memberName}`, | ||
endpoint: `${USER_API_PREFIX}/${eventId}/members/current`, | ||
}); | ||
}; | ||
|
||
export type ResponseGetCurrentInMemberList = { | ||
memberNames: string[]; | ||
}; | ||
|
||
export const requestGetCurrentInMemberList = async ({eventId}: WithEventId) => { | ||
return await requestGet<ResponseGetCurrentInMemberList>({ | ||
baseUrl: BASE_URL.HD, | ||
endpoint: `${TEMP_PREFIX}/${eventId}/members/current`, | ||
export const requestGetAllMembers = async ({eventId}: WithEventId) => { | ||
return await requestGet<AllMembers>({ | ||
endpoint: `${USER_API_PREFIX}/${eventId}/members`, | ||
}); | ||
}; |
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,19 +1,13 @@ | ||
import type {MemberReport} from 'types/serviceType'; | ||
import type {Reports} from 'types/serviceType'; | ||
|
||
import {BASE_URL} from '@apis/baseUrl'; | ||
import {TEMP_PREFIX} from '@apis/tempPrefix'; | ||
import {USER_API_PREFIX} from '@apis/endpointPrefix'; | ||
import {requestGet} from '@apis/fetcher'; | ||
import {WithEventId} from '@apis/withEventId.type'; | ||
import {WithEventId} from '@apis/withId.type'; | ||
|
||
type ResponseGetMemberReportList = { | ||
reports: MemberReport[]; | ||
}; | ||
|
||
export const requestGetMemberReportList = async ({eventId}: WithEventId) => { | ||
const {reports} = await requestGet<ResponseGetMemberReportList>({ | ||
export const requestGetReports = async ({eventId}: WithEventId) => { | ||
return await requestGet<Reports>({ | ||
baseUrl: BASE_URL.HD, | ||
endpoint: `${TEMP_PREFIX}/${eventId}/actions/reports`, | ||
endpoint: `${USER_API_PREFIX}/${eventId}/reports`, | ||
}); | ||
|
||
return reports; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {Steps} from 'types/serviceType'; | ||
|
||
import {BASE_URL} from '@apis/baseUrl'; | ||
import {USER_API_PREFIX} from '@apis/endpointPrefix'; | ||
import {requestGet} from '@apis/fetcher'; | ||
import {WithEventId} from '@apis/withId.type'; | ||
|
||
export const requestGetSteps = async ({eventId}: WithEventId) => { | ||
const {steps} = await requestGet<Steps>({ | ||
baseUrl: BASE_URL.HD, | ||
endpoint: `${USER_API_PREFIX}/${eventId}/bills`, | ||
}); | ||
|
||
return steps; | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.