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

@@ -29,7 +29,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '1744-2', analysisElementOriginalId: '1744-2',
}, },
}, },
@@ -49,7 +49,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '1920-8', analysisElementOriginalId: '1920-8',
}, },
}, },
@@ -69,7 +69,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '1988-5', analysisElementOriginalId: '1988-5',
}, },
}, },
@@ -89,7 +89,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '57747-8', analysisElementOriginalId: '57747-8',
}, },
}, },
@@ -109,7 +109,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '2276-4', analysisElementOriginalId: '2276-4',
}, },
}, },
@@ -129,7 +129,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '14771-0', analysisElementOriginalId: '14771-0',
}, },
}, },
@@ -149,7 +149,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: false, responseValueIsWithinNorm: false,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '59156-0', analysisElementOriginalId: '59156-0',
}, },
}, },
@@ -169,7 +169,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: true, responseValueIsWithinNorm: true,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '59156-0', analysisElementOriginalId: '59156-0',
}, },
}, },
@@ -189,7 +189,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '13955-0', analysisElementOriginalId: '13955-0',
}, },
}, },
@@ -209,7 +209,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '14646-4', analysisElementOriginalId: '14646-4',
}, },
}, },
@@ -229,7 +229,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '2000-8', analysisElementOriginalId: '2000-8',
}, },
}, },
@@ -249,7 +249,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '59158-6', analysisElementOriginalId: '59158-6',
}, },
}, },
@@ -269,7 +269,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '14647-2', analysisElementOriginalId: '14647-2',
}, },
}, },
@@ -289,7 +289,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '14682-9', analysisElementOriginalId: '14682-9',
}, },
}, },
@@ -309,7 +309,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '22748-8', analysisElementOriginalId: '22748-8',
}, },
}, },
@@ -329,7 +329,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '58805-3', analysisElementOriginalId: '58805-3',
}, },
}, },
@@ -349,7 +349,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '2601-3', analysisElementOriginalId: '2601-3',
}, },
}, },
@@ -370,7 +370,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '70204-3', analysisElementOriginalId: '70204-3',
}, },
}, },
@@ -390,7 +390,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '14798-3', analysisElementOriginalId: '14798-3',
}, },
}, },
@@ -411,7 +411,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '14927-8', analysisElementOriginalId: '14927-8',
}, },
}, },
@@ -431,7 +431,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '3016-3', analysisElementOriginalId: '3016-3',
}, },
}, },
@@ -451,7 +451,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '22664-7', analysisElementOriginalId: '22664-7',
}, },
}, },
@@ -471,7 +471,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '50561-0', analysisElementOriginalId: '50561-0',
}, },
}, },
@@ -492,7 +492,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '60493-4', analysisElementOriginalId: '60493-4',
}, },
}, },
@@ -512,7 +512,7 @@ const big1: AnalysisTestResponse = {
responseValueIsWithinNorm: true, responseValueIsWithinNorm: true,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '60025-4', analysisElementOriginalId: '60025-4',
}, },
}, },
@@ -538,7 +538,7 @@ const big2: AnalysisTestResponse = {
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
status: '4', status: 4,
analysisElementOriginalId: '1988-5', analysisElementOriginalId: '1988-5',
}, },
}, },
@@ -558,6 +558,8 @@ const big2: AnalysisTestResponse = {
responseValue: 150, responseValue: 150,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '718-7', analysisElementOriginalId: '718-7',
}, },
{ {
@@ -570,6 +572,8 @@ const big2: AnalysisTestResponse = {
responseValue: 45, responseValue: 45,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '4544-3', analysisElementOriginalId: '4544-3',
}, },
{ {
@@ -582,6 +586,8 @@ const big2: AnalysisTestResponse = {
responseValue: 5, responseValue: 5,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '6690-2', analysisElementOriginalId: '6690-2',
}, },
{ {
@@ -594,6 +600,8 @@ const big2: AnalysisTestResponse = {
responseValue: 5, responseValue: 5,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '789-8', analysisElementOriginalId: '789-8',
}, },
{ {
@@ -606,6 +614,8 @@ const big2: AnalysisTestResponse = {
responseValue: 85, responseValue: 85,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '787-2', analysisElementOriginalId: '787-2',
}, },
{ {
@@ -618,6 +628,8 @@ const big2: AnalysisTestResponse = {
responseValue: 30, responseValue: 30,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '785-6', analysisElementOriginalId: '785-6',
}, },
{ {
@@ -630,6 +642,8 @@ const big2: AnalysisTestResponse = {
responseValue: 355, responseValue: 355,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '786-4', analysisElementOriginalId: '786-4',
}, },
{ {
@@ -642,6 +656,8 @@ const big2: AnalysisTestResponse = {
responseValue: 15, responseValue: 15,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '788-0', analysisElementOriginalId: '788-0',
}, },
{ {
@@ -654,6 +670,8 @@ const big2: AnalysisTestResponse = {
responseValue: 255, responseValue: 255,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '777-3', analysisElementOriginalId: '777-3',
}, },
{ {
@@ -666,6 +684,8 @@ const big2: AnalysisTestResponse = {
responseValue: 0.2, responseValue: 0.2,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '51637-7', analysisElementOriginalId: '51637-7',
}, },
{ {
@@ -678,6 +698,8 @@ const big2: AnalysisTestResponse = {
responseValue: 10, responseValue: 10,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '32623-1', analysisElementOriginalId: '32623-1',
}, },
{ {
@@ -690,6 +712,8 @@ const big2: AnalysisTestResponse = {
responseValue: 15, responseValue: 15,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '32207-3', analysisElementOriginalId: '32207-3',
}, },
{ {
@@ -702,6 +726,8 @@ const big2: AnalysisTestResponse = {
responseValue: 0.05, responseValue: 0.05,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '704-7', analysisElementOriginalId: '704-7',
}, },
{ {
@@ -714,6 +740,8 @@ const big2: AnalysisTestResponse = {
responseValue: 0.05, responseValue: 0.05,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '711-2', analysisElementOriginalId: '711-2',
}, },
{ {
@@ -726,6 +754,8 @@ const big2: AnalysisTestResponse = {
responseValue: 5, responseValue: 5,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '751-8', analysisElementOriginalId: '751-8',
}, },
{ {
@@ -738,6 +768,8 @@ const big2: AnalysisTestResponse = {
responseValue: 0.5, responseValue: 0.5,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '742-7', analysisElementOriginalId: '742-7',
}, },
{ {
@@ -750,6 +782,8 @@ const big2: AnalysisTestResponse = {
responseValue: 1.5, responseValue: 1.5,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '731-0', analysisElementOriginalId: '731-0',
}, },
{ {
@@ -762,6 +796,8 @@ const big2: AnalysisTestResponse = {
responseValue: 0, responseValue: 0,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '51584-1', analysisElementOriginalId: '51584-1',
}, },
{ {
@@ -774,6 +810,8 @@ const big2: AnalysisTestResponse = {
responseValue: 0, responseValue: 0,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '38518-7', analysisElementOriginalId: '38518-7',
}, },
{ {
@@ -782,8 +820,12 @@ const big2: AnalysisTestResponse = {
normStatus: 0, normStatus: 0,
responseTime: '2025-09-12 14:02:04', responseTime: '2025-09-12 14:02:04',
responseValue: 0, responseValue: 0,
normUpper: null,
normLower: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '771-6', analysisElementOriginalId: '771-6',
}, },
{ {
@@ -792,8 +834,12 @@ const big2: AnalysisTestResponse = {
normStatus: 0, normStatus: 0,
responseTime: '2025-09-12 14:02:04', responseTime: '2025-09-12 14:02:04',
responseValue: 0, responseValue: 0,
normUpper: null,
normLower: null,
normLowerIncluded: false, normLowerIncluded: false,
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null,
responseValueIsWithinNorm: null,
analysisElementOriginalId: '58413-6', analysisElementOriginalId: '58413-6',
}, },
], ],
@@ -807,7 +853,7 @@ const big2: AnalysisTestResponse = {
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: false, responseValueIsNegative: false,
responseValueIsWithinNorm: false, responseValueIsWithinNorm: false,
status: '4', status: 4,
analysisElementOriginalId: '57021-8', analysisElementOriginalId: '57021-8',
}, },
}, },
@@ -828,7 +874,7 @@ const big2: AnalysisTestResponse = {
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: false, responseValueIsNegative: false,
responseValueIsWithinNorm: false, responseValueIsWithinNorm: false,
status: '5', status: 5,
analysisElementOriginalId: '43583-4', analysisElementOriginalId: '43583-4',
}, },
}, },
@@ -850,7 +896,7 @@ const big2: AnalysisTestResponse = {
normUpperIncluded: false, normUpperIncluded: false,
responseValueIsNegative: null, responseValueIsNegative: null,
responseValueIsWithinNorm: null, responseValueIsWithinNorm: null,
status: '4', status: 4,
analysisElementOriginalId: '60493-4', analysisElementOriginalId: '60493-4',
}, },
}, },

View File

@@ -181,8 +181,12 @@ async function sendAnalysisPackageOrderEmail({
partnerLocationName, partnerLocationName,
language, language,
}); });
console.info(`Successfully sent analysis package order email to ${email}`);
} catch (error) { } catch (error) {
console.error('Failed to send email', error); console.error(
`Failed to send analysis package order email to ${email}`,
error,
);
} }
} }

View File

@@ -51,11 +51,7 @@ export async function upsertMedipostActionLog({
medipostExternalOrderId?: string | null; medipostExternalOrderId?: string | null;
medipostPrivateMessageId?: string | null; medipostPrivateMessageId?: string | null;
}) { }) {
const { data } = await getSupabaseServerAdminClient() const recordData = {
.schema('medreport')
.from('medipost_actions')
.upsert(
{
action, action,
xml, xml,
has_analysis_results: hasAnalysisResults, has_analysis_results: hasAnalysisResults,
@@ -64,14 +60,20 @@ export async function upsertMedipostActionLog({
has_error: hasError, has_error: hasError,
medipost_external_order_id: medipostExternalOrderId, medipost_external_order_id: medipostExternalOrderId,
medipost_private_message_id: medipostPrivateMessageId, medipost_private_message_id: medipostPrivateMessageId,
}, };
{
const query = getSupabaseServerAdminClient()
.schema('medreport')
.from('medipost_actions');
const { data } = medipostPrivateMessageId
? await query
.upsert(recordData, {
onConflict: 'medipost_private_message_id', onConflict: 'medipost_private_message_id',
ignoreDuplicates: false, ignoreDuplicates: false,
}, })
)
.select('id') .select('id')
.throwOnError(); .throwOnError()
: await query.insert(recordData).select('id').throwOnError();
const medipostActionId = data?.[0]?.id; const medipostActionId = data?.[0]?.id;
if (!medipostActionId) { if (!medipostActionId) {

View File

@@ -369,6 +369,7 @@ export async function readPrivateMessageResponse({
const hasInvalidOrderId = isNaN(analysisOrderId); const hasInvalidOrderId = isNaN(analysisOrderId);
if (hasInvalidOrderId || !messageResponse || !patientPersonalCode) { if (hasInvalidOrderId || !messageResponse || !patientPersonalCode) {
console.error(`Invalid order id or message response or patient personal code, medipostExternalOrderId=${medipostExternalOrderId}, privateMessageId=${privateMessageId}`);
await upsertMedipostActionLog({ await upsertMedipostActionLog({
action: 'sync_analysis_results_from_medipost', action: 'sync_analysis_results_from_medipost',
xml: privateMessageXml, xml: privateMessageXml,
@@ -415,6 +416,7 @@ export async function readPrivateMessageResponse({
order: analysisOrder, order: analysisOrder,
}); });
console.info(`Successfully synced analysis results from Medipost message privateMessageId=${privateMessageId}`);
await upsertMedipostActionLog({ await upsertMedipostActionLog({
action: 'sync_analysis_results_from_medipost', action: 'sync_analysis_results_from_medipost',
xml: privateMessageXml, xml: privateMessageXml,
@@ -571,6 +573,7 @@ export async function sendOrderToMedipost({
isMedipostError, isMedipostError,
errorMessage: e.response, errorMessage: e.response,
}); });
console.error(`Failed to send order to Medipost, medusaOrderId=${medusaOrderId}, error=${e.response}`);
await upsertMedipostActionLog({ await upsertMedipostActionLog({
action: 'send_order_to_medipost', action: 'send_order_to_medipost',
xml: orderXml, xml: orderXml,
@@ -580,6 +583,7 @@ export async function sendOrderToMedipost({
hasError: true, hasError: true,
}); });
} else { } else {
console.error(`Failed to send order to Medipost, medusaOrderId=${medusaOrderId}, error=${e}`);
await logMedipostDispatch({ await logMedipostDispatch({
medusaOrderId, medusaOrderId,
isSuccess: false, isSuccess: false,
@@ -596,6 +600,7 @@ export async function sendOrderToMedipost({
throw e; throw e;
} }
console.info(`Successfully sent order to Medipost, medusaOrderId=${medusaOrderId}`);
await logMedipostDispatch({ await logMedipostDispatch({
medusaOrderId, medusaOrderId,
isSuccess: true, isSuccess: true,

View File

@@ -9,8 +9,6 @@ import { z } from 'zod';
import { getSupabaseServerClient } from '@kit/supabase/server-client'; import { getSupabaseServerClient } from '@kit/supabase/server-client';
import { requireUserInServerComponent } from '../server/require-user-in-server-component';
const env = () => const env = () =>
z z
.object({ .object({

View File

@@ -355,7 +355,7 @@ export async function medusaLoginOrRegister(
return await medusaLogin(email, password); return await medusaLogin(email, password);
} catch (registerError) { } catch (registerError) {
console.error( console.error(
'Failed to create Medusa account for user with email=${email}', `Failed to create Medusa account for user with email=${email}`,
registerError, registerError,
); );
throw medusaError(registerError); throw medusaError(registerError);

View File

@@ -0,0 +1,10 @@
create table if not exists medreport.ai_responses (
id uuid unique not null default extensions.uuid_generate_v4 (),
account_id uuid references medreport.accounts(id) on delete cascade not null,
prompt_name varchar(50) not null,
prompt_id varchar(50) not null,
input jsonb not null,
response jsonb not null,
created_at timestamp with time zone not null default now(),
latest_data_change timestamp with time zone not null
);