MED-102: clean order page for tto orders

This commit is contained in:
Danel Kungla
2025-09-25 15:30:07 +03:00
parent 5dc625c903
commit 6c3ae1eda6
12 changed files with 82 additions and 48 deletions

View File

@@ -16,8 +16,8 @@ import axios from 'axios';
import { toArray } from '@kit/shared/utils';
import { Tables } from '@kit/supabase/database';
import type { AnalysisOrder } from '~/lib/types/analysis-order';
import type { AnalysisResponseElement } from '~/lib/types/analysis-response-element';
import type { AnalysisOrder } from '~/lib/types/order';
import { getAccountAdmin } from '../account.service';
import { getAnalyses } from '../analyses.service';

View File

@@ -4,7 +4,7 @@ import type { Tables } from '@kit/supabase/database';
import { getSupabaseServerAdminClient } from '@kit/supabase/server-admin-client';
import { getSupabaseServerClient } from '@kit/supabase/server-client';
import type { AnalysisOrder } from '../types/analysis-order';
import type { AnalysisOrder, TTOOrder } from '../types/order';
export async function createAnalysisOrder({
medusaOrder,
@@ -176,10 +176,7 @@ export async function getTtoOrders({
orderStatus,
lineItemIds,
}: {
orderStatus?: Tables<
{ schema: 'medreport' },
'connected_online_reservation'
>['status'];
orderStatus?: TTOOrder['status'];
lineItemIds?: string[];
} = {}) {
const client = getSupabaseServerClient();

View File

@@ -150,16 +150,25 @@ export async function getCartReservations(
return results;
}
export async function createInitialReservation(
serviceId: number,
clinicId: number,
appointmentUserId: number,
syncUserID: number,
startTime: Date,
medusaLineItemId: string,
locationId?: number | null,
export async function createInitialReservation({
serviceId,
clinicId,
appointmentUserId,
syncUserID,
startTime,
medusaLineItemId,
locationId,
comments = '',
) {
}: {
serviceId: number;
clinicId: number;
appointmentUserId: number;
syncUserID: number;
startTime: Date;
medusaLineItemId: string;
locationId?: number | null;
comments?: string;
}) {
const logger = await getLogger();
const supabase = getSupabaseServerClient();
@@ -255,15 +264,23 @@ export async function getOrderedTtoServices({
return orderedTtoServices;
}
export async function updateReservationTime(
reservationId: number,
newStartTime: Date,
newServiceId: number,
newAppointmentUserId: number,
newSyncUserId: number,
newLocationId: number | null, // TODO stop allowing null when Connected starts returning the correct ids instead of -1
cartId: string,
) {
export async function updateReservationTime({
reservationId,
newStartTime,
newServiceId,
newAppointmentUserId,
newSyncUserId,
newLocationId, // TODO stop allowing null when Connected starts returning the correct ids instead of -1
cartId,
}: {
reservationId: number;
newStartTime: Date;
newServiceId: number;
newAppointmentUserId: number;
newSyncUserId: number;
newLocationId: number | null;
cartId: string;
}) {
const logger = await getLogger();
const supabase = getSupabaseServerClient();