feat: add recurring bookings feature with related handlers and services
- Introduced recurring booking groups with the ability to create and cancel them. - Added database migrations for recurring bookings, including new tables and relationships. - Implemented handlers for creating and canceling recurring bookings in the admin booking module. - Enhanced existing booking services to support recurring bookings logic. - Updated API contract to include new schemas for recurring bookings. - Refactored existing code for improved readability and maintainability.
This commit is contained in:
@@ -6,8 +6,10 @@ import type {
|
||||
PublicAvailabilityResponse,
|
||||
PublicBooking,
|
||||
PublicBookingConfirmation,
|
||||
RecurringBookingGroup,
|
||||
UpdateAdminBookingStatusInput,
|
||||
} from '@repo/api-contract';
|
||||
import type { CreateRecurringBookingInput } from '@repo/api-contract';
|
||||
import { http } from '../http';
|
||||
|
||||
export async function getAvailability(
|
||||
@@ -52,6 +54,21 @@ export async function createAdmin(complexId: string, payload: CreateAdminBooking
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export async function createRecurring(complexId: string, payload: CreateRecurringBookingInput) {
|
||||
const response = await http.post<RecurringBookingGroup>(
|
||||
`/api/admin-bookings/complex/${complexId}/recurring`,
|
||||
payload
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export async function cancelRecurringGroup(groupId: string) {
|
||||
const response = await http.post<{ ok: boolean }>(
|
||||
`/api/admin-bookings/recurring/${groupId}/cancel`
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export async function cancelPublic(complexSlug: string, payload: CancelPublicBookingInput) {
|
||||
const response = await http.post<PublicBooking>(
|
||||
`/api/public-bookings/complex/${complexSlug}/cancel`,
|
||||
|
||||
Reference in New Issue
Block a user