Skip to content

Commit be9508d

Browse files
authored
πŸ‘½οΈ Add an API to cancel registrations (#115)
### πŸ“ μž‘μ—… λ‚΄μš© - μ‹ μ²­ μ·¨μ†Œ apiλ₯Ό μΆ”κ°€ν–ˆμŠ΅λ‹ˆλ‹€. - μ‹ μ²­ μ·¨μ†Œ λ‘œμ§μ— μ—°κ²°ν•˜κ³ , msw의 μ‹ μ²­ μ·¨μ†Œλ„ μˆ˜μ •ν–ˆμŠ΅λ‹ˆλ‹€. ### πŸ“Έ μŠ€ν¬λ¦°μƒ· (선택) ### πŸš€ 리뷰 μš”κ΅¬μ‚¬ν•­ (선택) - 였늘 μ°¬κ·œλ‹˜μ΄ 말씀해주신 λ‚΄μš©μΈλ°, ν˜„μž¬ λͺ¨μ§‘ μ’…λ£Œλœ μΌμ •μ—μ„œλ„ μ°Έμ—¬ μ·¨μ†Œκ°€ κ°€λŠ₯ν•©λ‹ˆλ‹€. λ§Œμ•½ λ§‰λŠ”λ‹€κ³  ν•˜λ©΄ 좔가적인 μˆ˜μ •μ΄ ν•„μš”ν•  κ²ƒμœΌλ‘œ μ˜ˆμƒλ©λ‹ˆλ‹€... - 이 PRκ³Ό μ—°κ΄€ μ—†λŠ” 일이긴 ν•œλ°, dev λΈŒλ ŒμΉ˜λŠ” 리뷰 μš”κ΅¬ 없이 λ°”λ‘œ λ¨Έμ§€κ°€ λ˜λŠ” 것 κ°™μ•„ 'Settings-Rules-Rulesets'μ—μ„œ `main` λ‚΄μš© λ³΅μ‚¬ν•΄μ„œ `dev`λ₯Ό μƒˆλ‘œ λ§Œλ“€μ—ˆμŠ΅λ‹ˆλ‹€.
1 parent 2c726a0 commit be9508d

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

β€Žsrc/api/registrations/registration.tsβ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ export async function patchRegistration(
2323
const response = await apiClient.patch(`/registrations/${id}`, data);
2424
return response.data;
2525
}
26+
27+
// μ‹ μ²­ μ·¨μ†Œ (DELETE /api/registrations/:id)
28+
export async function deleteRegistration(id: string): Promise<void> {
29+
await apiClient.delete(`/registrations/${id}`);
30+
}

β€Žsrc/hooks/useEventDetail.tsβ€Ž

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { deleteEvent, getEventDetail } from '@/api/events/event';
22
import { getGuests, joinEvent } from '@/api/events/registrations';
33
import {
4+
deleteRegistration,
45
getRegistrationDetail,
56
patchRegistration,
67
} from '@/api/registrations/registration';
@@ -136,9 +137,7 @@ export default function useEventDetail(id?: string) {
136137
const handleCancelEvent = async (registrationId: string) => {
137138
setLoading(true);
138139
try {
139-
await patchRegistration(registrationId, {
140-
status: 'CANCELED',
141-
});
140+
await deleteRegistration(registrationId);
142141
if (id) {
143142
removeGuestRegistration(id);
144143
await handleFetchDetail(id);

β€Žsrc/mocks/handlers/event.tsβ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ export const eventHandlers = [
8383
});
8484
}),
8585

86+
// μ‹ μ²­ μ·¨μ†Œ (DELETE /registrations/:id)
87+
http.delete(path('/registrations/:id'), async () => {
88+
await delay(200);
89+
return new HttpResponse(null, { status: 200 });
90+
}),
91+
8692
// 5. 일정 생성 (POST /events)
8793
http.post(path('/events'), async ({ request }) => {
8894
const body = (await request.json()) as CreateEventRequest;

0 commit comments

Comments
Β (0)