Merge branch 'develop' into add-eslint

This commit is contained in:
Danel Kungla
2025-09-23 10:56:41 +03:00
7 changed files with 118 additions and 53 deletions

View File

@@ -51,27 +51,29 @@ export async function upsertMedipostActionLog({
medipostExternalOrderId?: string | null;
medipostPrivateMessageId?: string | null;
}) {
const { data } = await getSupabaseServerAdminClient()
const recordData = {
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,
};
const query = getSupabaseServerAdminClient()
.schema('medreport')
.from('medipost_actions')
.upsert(
{
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,
},
{
onConflict: 'medipost_private_message_id',
ignoreDuplicates: false,
},
)
.select('id')
.throwOnError();
.from('medipost_actions');
const { data } = medipostPrivateMessageId
? await query
.upsert(recordData, {
onConflict: 'medipost_private_message_id',
ignoreDuplicates: false,
})
.select('id')
.throwOnError()
: await query.insert(recordData).select('id').throwOnError();
const medipostActionId = data?.[0]?.id;
if (!medipostActionId) {