MED-103: add booking functionality

This commit is contained in:
Helena
2025-09-17 18:11:13 +03:00
parent 7c92b787ce
commit 22f7fa134b
44 changed files with 1923 additions and 479 deletions

View File

@@ -152,3 +152,29 @@ export async function getAnalysisOrdersAdmin({
const orders = await query.order('created_at', { ascending: false }).throwOnError();
return orders.data;
}
export async function getTtoOrders({
orderStatus,
}: {
orderStatus?: Tables<{ schema: 'medreport' }, 'connected_online_reservation'>['status'];
} = {}) {
const client = getSupabaseServerClient();
const {
data: { user },
} = await client.auth.getUser();
if (!user) {
throw new Error('Unauthorized');
}
const query = client
.schema('medreport')
.from('connected_online_reservation')
.select('*')
.eq("user_id", user.id)
if (orderStatus) {
query.eq('status', orderStatus);
}
const orders = await query.order('created_at', { ascending: false }).throwOnError();
return orders.data;
}