move medipost xml to separate service to be unit tested

This commit is contained in:
2025-09-09 00:33:43 +03:00
parent c2896d77b0
commit f00899c456
3 changed files with 164 additions and 134 deletions

View File

@@ -2,7 +2,7 @@ import type { Tables } from '@/packages/supabase/src/database.types';
import { getSupabaseServerAdminClient } from '@kit/supabase/server-admin-client';
import type { IUuringElement } from "./medipost.types";
type AnalysesWithGroupsAndElements = ({
export type AnalysesWithGroupsAndElements = ({
analysis_elements: Tables<{ schema: 'medreport' }, 'analysis_elements'> & {
analysis_groups: Tables<{ schema: 'medreport' }, 'analysis_groups'>;
};
@@ -105,7 +105,13 @@ export const createMedusaSyncSuccessEntry = async () => {
});
}
export async function getAnalyses({ ids, originalIds }: { ids?: number[], originalIds?: string[] }): Promise<AnalysesWithGroupsAndElements> {
export async function getAnalyses({
ids,
originalIds,
}: {
ids?: number[];
originalIds?: string[];
}): Promise<AnalysesWithGroupsAndElements> {
const query = getSupabaseServerAdminClient()
.schema('medreport')
.from('analyses')