Skip to content

Commit

Permalink
feat: 변경된 API 적용 및 사용하지 않는 코드 제거, 지출내역 추가 flow 및 UI 변경 (#574)
Browse files Browse the repository at this point in the history
* feat: NumberKeyboard 구현

* feature: Top Top.Line component 구현 및 행사 생성 플로우 UX 개선

* fix: 공백을 포함하지 않던 문제 수정

* refactor: useNumberKeyboard로 기능 관련 역할 분리

* feat: keyboard type에 string 추가

* style: lint 적용

* feature: CompleteCreateEventPage 변경

* refactor: api 변경에 따라, USER_API_PREFIX, ADMIN_API_PREFIX로 구분

* chore: MSW 설정 변경 중
TODO: intercept 되지 않는 오류 수정 중

* fix: 사용하지 않는 Button component의 isFull  속성 제거

* fix: mockEndpointPrefix 경로 수정

* feat: Amount Component 구현

* fix: meatball Icon 추가

* fix: 잘못 적용된 endpoint 적용

* fix: Title component 수정

* test: Top component storybook 추가

* feat: ListItem Component 추가

* feat: Chip Component 추가

* feat: ChipGroup Component 생성

* design: ChipGroup style 수정

* fix: FixedButton에 onBackClick prop 추가

* refactor: 변경된 api 구조에 맞게 수정 및 type 생성에 대한 통일화

* fix: 변경된 api에 맞게 MSW 코드 변경

* feature: ChipButton component 구현

* feature: AmountInput Component 구현

* design: Button disabled color 변경

* move: NumberKeyboard 위치 변경

* feature: AddBillFunnel page 구현

* fix: API 및 UX 변경사항으로 인해 함꼐 변경이 필요한 사항들 적용

* refactor: api 변경사항에 따른 request 함수들 및 react-query hook 변경
1. request 함수 내에서 Request type 선언하도록 변경
2. react-query에서 data를 정제 및 이름을 변경하여 return 하도록 변경
3. react-query hook들을 domain 별로 그룹화
4. react-qeury hook 및 request 함수 backEnd에서 사용하는 이름 및 model과 통일되도록 변경

Co-authored-by: Soyeon Choe <[email protected]>
Co-authored-by: JinHo Kim <[email protected]>

* move: NumberKeyboard component 위치 변경

* remove: 개선 과정에서 사용하지 않는 레거시 파일 삭제

    Co-authored-by: Soyeon Choe <[email protected]>
    Co-authored-by: JinHo Kim <[email protected]>

* fix: 현재 사용하지 않지만, 추후 사용 가능성이 있는 코드 이름 변경 및 주석 처리

    Co-authored-by: Soyeon Choe <[email protected]>
    Co-authored-by: JinHo Kim <[email protected]>

* refactor: API 변경 사항 및 전체 구조 변경에 따른 코드 반영 및 경로 수정, 이름 변경

    Co-authored-by: Soyeon Choe <[email protected]>
    Co-authored-by: JinHo Kim <[email protected]>

* fix: MSW mocking 해제

* style: lint 적용

* style: 사용하지 않는 코드 제거

* fix: NumberKeyboard import 잘못 지정된 오류 수정

* style: lint 적용

* fix: 사용하지 않는 테스트 코드 제거

---------

Co-authored-by: Soyeon Choe <[email protected]>
Co-authored-by: JinHo Kim <[email protected]>
  • Loading branch information
3 people authored Sep 20, 2024
1 parent efea07b commit 47e6bd9
Show file tree
Hide file tree
Showing 167 changed files with 2,801 additions and 3,969 deletions.
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';
18 changes: 9 additions & 9 deletions client/src/apis/request/auth.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import {BASE_URL} from '@apis/baseUrl';
import {TEMP_PREFIX} from '@apis/tempPrefix';
import {ADMIN_API_PREFIX, USER_API_PREFIX} from '@apis/endpointPrefix';
import {requestPostWithoutResponse} from '@apis/fetcher';
import {WithEventId} from '@apis/withEventId.type';

export type RequestToken = {
password: string;
};
import {WithEventId} from '@apis/withId.type';

export const requestPostAuthentication = async ({eventId}: WithEventId) => {
await requestPostWithoutResponse({
baseUrl: BASE_URL.HD,
endpoint: `${TEMP_PREFIX}/${eventId}/auth`,
endpoint: `${ADMIN_API_PREFIX}/${eventId}/auth`,
});
};

export const requestPostToken = async ({eventId, password}: WithEventId<RequestToken>) => {
export interface RequestPostToken {
password: string;
}

export const requestPostToken = async ({eventId, password}: WithEventId<RequestPostToken>) => {
await requestPostWithoutResponse({
baseUrl: BASE_URL.HD,
endpoint: `${TEMP_PREFIX}/${eventId}/login`,
endpoint: `${USER_API_PREFIX}/${eventId}/login`,
body: {
password: password,
},
Expand Down
78 changes: 41 additions & 37 deletions client/src/apis/request/bill.ts
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},
});
};
49 changes: 30 additions & 19 deletions client/src/apis/request/event.ts
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,
},
});
};
90 changes: 37 additions & 53 deletions client/src/apis/request/member.ts
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`,
});
};
18 changes: 6 additions & 12 deletions client/src/apis/request/report.ts
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;
};
15 changes: 15 additions & 0 deletions client/src/apis/request/step.ts
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;
};
17 changes: 0 additions & 17 deletions client/src/apis/request/stepList.ts

This file was deleted.

Loading

0 comments on commit 47e6bd9

Please sign in to comment.