* 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
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
'use server';
|
|
|
|
import { useService } from '../lib/service';
|
|
import { wrapServerAction } from '@/utils/actions';
|
|
import { OrdersService } from '@repo/graphql/api/orders';
|
|
|
|
const getServicesService = useService(OrdersService);
|
|
|
|
export async function createOrder(...variables: Parameters<OrdersService['createOrder']>) {
|
|
const service = await getServicesService();
|
|
|
|
return wrapServerAction(() => service.createOrder(...variables));
|
|
}
|
|
|
|
export async function getOrder(...variables: Parameters<OrdersService['getOrder']>) {
|
|
const service = await getServicesService();
|
|
|
|
return wrapServerAction(() => service.getOrder(...variables));
|
|
}
|
|
|
|
export async function getOrders(...variables: Parameters<OrdersService['getOrders']>) {
|
|
const service = await getServicesService();
|
|
|
|
return wrapServerAction(() => service.getOrders(...variables));
|
|
}
|
|
|
|
export async function updateOrder(...variables: Parameters<OrdersService['updateOrder']>) {
|
|
const service = await getServicesService();
|
|
|
|
return wrapServerAction(() => service.updateOrder(...variables));
|
|
}
|