feat(MED-161): update results sync validations

This commit is contained in:
2025-09-17 11:17:23 +03:00
parent b729ad9ffa
commit ecc8c2b982
2 changed files with 75 additions and 42 deletions

View File

@@ -28,36 +28,41 @@ export function getLatestMessage({
}
export async function createMedipostActionLog({
action,
xml,
hasAnalysisResults = false,
medusaOrderId,
responseXml,
hasError = false,
}: {
action:
| 'send_order_to_medipost'
| 'sync_analysis_results_from_medipost'
| 'send_fake_analysis_results_to_medipost'
| 'send_analysis_results_to_medipost';
xml: string;
hasAnalysisResults?: boolean;
medusaOrderId?: string | null;
responseXml?: string | null;
hasError?: boolean;
}) {
await getSupabaseServerAdminClient()
.schema('medreport')
.from('medipost_actions')
.insert({
action,
xml,
has_analysis_results: hasAnalysisResults,
medusa_order_id: medusaOrderId,
response_xml: responseXml,
has_error: hasError,
})
.select('id')
.throwOnError();
}
action,
xml,
hasAnalysisResults = false,
medusaOrderId,
responseXml,
hasError = false,
medipostExternalOrderId,
medipostPrivateMessageId,
}: {
action:
| 'send_order_to_medipost'
| 'sync_analysis_results_from_medipost'
| 'send_fake_analysis_results_to_medipost'
| 'send_analysis_results_to_medipost';
xml: string;
hasAnalysisResults?: boolean;
medusaOrderId?: string | null;
responseXml?: string | null;
hasError?: boolean;
medipostExternalOrderId?: string | null;
medipostPrivateMessageId?: string | null;
}) {
await getSupabaseServerAdminClient()
.schema('medreport')
.from('medipost_actions')
.insert({
action,
xml,
has_analysis_results: hasAnalysisResults,
medusa_order_id: medusaOrderId,
response_xml: responseXml,
has_error: hasError,
medipost_external_order_id: medipostExternalOrderId,
medipost_private_message_id: medipostPrivateMessageId,
})
.select('id')
.throwOnError();
}