feat(MED-161): update results sync validations
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user