From 718ed41f8dba1d560d074c70e9b383de9e6a1d1a Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Mon, 21 Jun 2021 23:35:00 +0200 Subject: [PATCH] rename api end url to bookings --- context/book.tsx | 2 +- helpers/bill.ts | 4 ++-- helpers/booking.ts | 6 +++--- helpers/ical.ts | 4 ++-- helpers/mail.ts | 6 +++--- pages/admin/{booking => bookings}/[uuid]/bill.tsx | 0 pages/admin/{booking => bookings}/[uuid]/index.tsx | 0 pages/admin/index.tsx | 2 +- pages/api/{booking => bookings}/[uuid]/bill.ts | 0 pages/api/{booking => bookings}/[uuid]/index.ts | 0 pages/api/{booking => bookings}/index.ts | 0 pages/{booking => bookings}/[uuid]/index.tsx | 0 pages/{booking => bookings}/[uuid]/stored.tsx | 6 +++--- 13 files changed, 15 insertions(+), 15 deletions(-) rename pages/admin/{booking => bookings}/[uuid]/bill.tsx (100%) rename pages/admin/{booking => bookings}/[uuid]/index.tsx (100%) rename pages/api/{booking => bookings}/[uuid]/bill.ts (100%) rename pages/api/{booking => bookings}/[uuid]/index.ts (100%) rename pages/api/{booking => bookings}/index.ts (100%) rename pages/{booking => bookings}/[uuid]/index.tsx (100%) rename pages/{booking => bookings}/[uuid]/stored.tsx (90%) diff --git a/context/book.tsx b/context/book.tsx index 67cf92a..8266b95 100644 --- a/context/book.tsx +++ b/context/book.tsx @@ -157,7 +157,7 @@ export default function BookProvider({ children }) { try { const booking = await createBooking(state.formData) - router.push(`/booking/${booking.uuid}/stored`) + router.push(`/bookings/${booking.uuid}/stored`) } catch (error) { console.error(error) dispatch({ type: ACTIONS.POST_DATA_ERROR, payload: error.message }) diff --git a/helpers/bill.ts b/helpers/bill.ts index 73e5f4e..7fce605 100644 --- a/helpers/bill.ts +++ b/helpers/bill.ts @@ -75,7 +75,7 @@ export async function createBill( bookingUuid: string, bill: Bill ): Promise { - return fetch(`/api/booking/${bookingUuid}/bill`, { + return fetch(`/api/bookings/${bookingUuid}/bill`, { method: 'POST', body: bill, }) @@ -85,7 +85,7 @@ export async function patchBill( bookingUuid: string, bill: Bill ): Promise { - return fetch(`/api/booking/${bookingUuid}/bill`, { + return fetch(`/api/bookings/${bookingUuid}/bill`, { method: 'POST', body: bill, }) diff --git a/helpers/booking.ts b/helpers/booking.ts index ebaede5..981297f 100644 --- a/helpers/booking.ts +++ b/helpers/booking.ts @@ -17,21 +17,21 @@ export function getBookingStatus(status: BOOKING_STATUS) { } export async function createBooking(formData: object) { - return fetch('/api/booking', { + return fetch('/api/bookings', { method: 'POST', body: formData, }) } export async function cancelBooking(uuid: string) { - return fetch(`/api/booking/${uuid}`, { + return fetch(`/api/bookings/${uuid}`, { method: 'PATCH', body: { status: BOOKING_STATUS.CANCELED }, }) } export async function patchBooking(uuid: string, bookingData: object) { - return fetch(`/api/booking/${uuid}`, { + return fetch(`/api/bookings/${uuid}`, { method: 'PATCH', body: { ...bookingData }, }) diff --git a/helpers/ical.ts b/helpers/ical.ts index 0c40951..0f82208 100644 --- a/helpers/ical.ts +++ b/helpers/ical.ts @@ -23,7 +23,7 @@ export function generateCalendarEntry(booking: Booking): string { geo: { lat: 48.287044, lon: 8.726361 }, description: `Gebucht auf ${booking.name} -Buchungs-Link: ${getBaseURL()}/booking/${booking.uuid} +Buchungs-Link: ${getBaseURL()}/bookings/${booking.uuid} `, status: booking.status === BOOKING_STATUS.CONFIRMED @@ -61,7 +61,7 @@ Zeitraum: ${daysFormatFrontend(booking.days)} Email: ${booking.email} Telefon: ${booking.phone} -Link: ${getBaseURL()}/admin/booking/${booking.uuid} +Link: ${getBaseURL()}/admin/bookings/${booking.uuid} `, status: booking.status === BOOKING_STATUS.CONFIRMED diff --git a/helpers/mail.ts b/helpers/mail.ts index 0c7cbd7..c829c38 100644 --- a/helpers/mail.ts +++ b/helpers/mail.ts @@ -40,7 +40,7 @@ Nach Prüfung bestätigen wir die Buchung bald per E-Mail! Du kannst sie jederzeit unter -${getBaseURL()}/booking/${booking.uuid} +${getBaseURL()}/bookings/${booking.uuid} einsehen und auch stornieren. @@ -58,7 +58,7 @@ deine Buchunganfrage zum ${daysFormatFrontend( Bitte melde dich spätestens 7 Tage vor dem Buchungstermin per E-Mail oder Telefon um eine Schlüsselübergabe zu vereinbaren. -Du kannst deine Buchung weiterhin unter ${getBaseURL()}/booking/${booking.uuid} +Du kannst deine Buchung weiterhin unter ${getBaseURL()}/bookings/${booking.uuid} einsehen und stornieren. ${footer} @@ -81,7 +81,7 @@ ${footer} function getReceivedBookingAdminText(booking: { uuid: string }): string { return `Hallo lieber Admin, -es ging folgende Buchung ein: ${getBaseURL()}/admin/booking/${booking.uuid} +es ging folgende Buchung ein: ${getBaseURL()}/admin/bookings/${booking.uuid} MfG` } diff --git a/pages/admin/booking/[uuid]/bill.tsx b/pages/admin/bookings/[uuid]/bill.tsx similarity index 100% rename from pages/admin/booking/[uuid]/bill.tsx rename to pages/admin/bookings/[uuid]/bill.tsx diff --git a/pages/admin/booking/[uuid]/index.tsx b/pages/admin/bookings/[uuid]/index.tsx similarity index 100% rename from pages/admin/booking/[uuid]/index.tsx rename to pages/admin/bookings/[uuid]/index.tsx diff --git a/pages/admin/index.tsx b/pages/admin/index.tsx index e700c96..9d89ce2 100644 --- a/pages/admin/index.tsx +++ b/pages/admin/index.tsx @@ -38,7 +38,7 @@ export default function AdminRecentBookings({ bookings }) { >

- + Booking {booking.uuid}

diff --git a/pages/api/booking/[uuid]/bill.ts b/pages/api/bookings/[uuid]/bill.ts similarity index 100% rename from pages/api/booking/[uuid]/bill.ts rename to pages/api/bookings/[uuid]/bill.ts diff --git a/pages/api/booking/[uuid]/index.ts b/pages/api/bookings/[uuid]/index.ts similarity index 100% rename from pages/api/booking/[uuid]/index.ts rename to pages/api/bookings/[uuid]/index.ts diff --git a/pages/api/booking/index.ts b/pages/api/bookings/index.ts similarity index 100% rename from pages/api/booking/index.ts rename to pages/api/bookings/index.ts diff --git a/pages/booking/[uuid]/index.tsx b/pages/bookings/[uuid]/index.tsx similarity index 100% rename from pages/booking/[uuid]/index.tsx rename to pages/bookings/[uuid]/index.tsx diff --git a/pages/booking/[uuid]/stored.tsx b/pages/bookings/[uuid]/stored.tsx similarity index 90% rename from pages/booking/[uuid]/stored.tsx rename to pages/bookings/[uuid]/stored.tsx index 537177c..7289e17 100644 --- a/pages/booking/[uuid]/stored.tsx +++ b/pages/bookings/[uuid]/stored.tsx @@ -23,13 +23,13 @@ export default function ShowBookingStored({ booking }: { booking: Booking }) { <>
-

Vielen Dank für die Buchungsanfrage

+

Vielen Dank für die Buchungsanfrage

Nach Prüfung bestätigen wir die Buchung zeitnah per E-Mail.

Den{' '} - + Link {' '} zur Buchung schicken wir Dir auch per E-Mail. Dort kann die Buchung @@ -41,7 +41,7 @@ export default function ShowBookingStored({ booking }: { booking: Booking }) { Sollen deine Buchungsdaten für die nächste Buchung in{' '} deinem Browser gespeichert werden?

-