fix tto order tables

This commit is contained in:
Danel Kungla
2025-10-22 10:29:07 +03:00
parent deee61e3ff
commit 86b2d02a8f
13 changed files with 130 additions and 71 deletions

View File

@@ -1,5 +1,6 @@
'use server';
import { getSupabaseServerClient } from '@/packages/supabase/src/clients/server-client';
import { updateLineItem } from '@lib/data/cart';
import { StoreProductVariant } from '@medusajs/types';
@@ -89,3 +90,22 @@ export async function cancelTtoBooking(
console.error('Error cancelling booking: ', error);
}
}
export async function isPaymentRequiredForService(serviceId: number) {
const supabaseClient = getSupabaseServerClient();
try {
const { data } = await supabaseClient
.schema('medreport')
.from('connected_online_services')
.select('requires_payment')
.eq('id', serviceId)
.is('requires_payment', true)
.maybeSingle();
return !!data;
} catch (error) {
console.error('Error checking payment requirement: ', error);
return false;
}
}