MED-102: clean order page for tto orders
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import type { Tables } from '@kit/supabase/database';
|
||||
|
||||
export type AnalysisOrder = Tables<{ schema: 'medreport' }, 'analysis_orders'>;
|
||||
12
lib/types/order.ts
Normal file
12
lib/types/order.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { Tables } from '@kit/supabase/database';
|
||||
|
||||
export type AnalysisOrder = Tables<{ schema: 'medreport' }, 'analysis_orders'>;
|
||||
export type TTOOrder = Tables<
|
||||
{ schema: 'medreport' },
|
||||
'connected_online_reservation'
|
||||
>;
|
||||
export type Order = {
|
||||
medusaOrderId?: string;
|
||||
id?: number;
|
||||
status?: string;
|
||||
};
|
||||
Reference in New Issue
Block a user