* chore(docker): add healthcheck to service in docker-compose.yml and update deploy workflow to include docker compose down * refactor(orders): add useOrdersInfiniteQuery for improved pagination and add load more button in orders list components * refactor(graphql): remove NotifyService and related notification logic from orders and API, clean up unused dependencies * refactor(api): streamline customer, order, service, and slot actions by wrapping server functions with client action utility to rethrow error messages to client
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
'use server';
|
|
|
|
import { useService } from '../lib/service';
|
|
import { wrapServerAction } from '@/utils/actions';
|
|
import { SlotsService } from '@repo/graphql/api/slots';
|
|
|
|
const getService = useService(SlotsService);
|
|
|
|
export async function createSlot(...variables: Parameters<SlotsService['createSlot']>) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.createSlot(...variables));
|
|
}
|
|
|
|
export async function deleteSlot(...variables: Parameters<SlotsService['deleteSlot']>) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.deleteSlot(...variables));
|
|
}
|
|
|
|
export async function getAvailableTimeSlots(
|
|
...variables: Parameters<SlotsService['getAvailableTimeSlots']>
|
|
) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.getAvailableTimeSlots(...variables));
|
|
}
|
|
|
|
export async function getSlot(...variables: Parameters<SlotsService['getSlot']>) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.getSlot(...variables));
|
|
}
|
|
|
|
export async function getSlots(...variables: Parameters<SlotsService['getSlots']>) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.getSlots(...variables));
|
|
}
|
|
|
|
export async function updateSlot(...variables: Parameters<SlotsService['updateSlot']>) {
|
|
const service = await getService();
|
|
|
|
return wrapServerAction(() => service.updateSlot(...variables));
|
|
}
|