MED-238: Improve logging
This commit is contained in:
@@ -377,7 +377,7 @@ export async function readPrivateMessageResponse({
|
|||||||
messageResponse,
|
messageResponse,
|
||||||
});
|
});
|
||||||
console.error(
|
console.error(
|
||||||
`Invalid !order id or message response or patient personal code, medipostExternalOrderId=${medipostExternalOrderId}, privateMessageId=${privateMessageId}`,
|
`Invalid order id or message response or patient personal code, medipostExternalOrderId=${medipostExternalOrderId}, privateMessageId=${privateMessageId}, patientPersonalCode=${patientPersonalCode}`,
|
||||||
);
|
);
|
||||||
await upsertMedipostActionLog({
|
await upsertMedipostActionLog({
|
||||||
action: 'sync_analysis_results_from_medipost',
|
action: 'sync_analysis_results_from_medipost',
|
||||||
|
|||||||
@@ -509,18 +509,9 @@ class UserAnalysesApi {
|
|||||||
}
|
}
|
||||||
const analysisOrder = await this.getAnalysisOrder({ analysisOrderId });
|
const analysisOrder = await this.getAnalysisOrder({ analysisOrderId });
|
||||||
const userId = analysisOrder.user_id;
|
const userId = analysisOrder.user_id;
|
||||||
const { data: account } = await this.client
|
if (!userId) {
|
||||||
.schema('medreport')
|
|
||||||
.from('accounts')
|
|
||||||
.select('id')
|
|
||||||
.eq('primary_owner_user_id', userId)
|
|
||||||
.maybeSingle()
|
|
||||||
.throwOnError();
|
|
||||||
|
|
||||||
const accountId = account?.id;
|
|
||||||
if (!accountId) {
|
|
||||||
console.warn(
|
console.warn(
|
||||||
`Order ${analysisOrderId} got new responses but no account found for user_id=${userId}. Skipping notification.`,
|
`Order ${analysisOrderId} got new responses but user_id is missing. Skipping notification. AnalysisOrder=${JSON.stringify(analysisOrder)}`,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -534,7 +525,7 @@ class UserAnalysesApi {
|
|||||||
|
|
||||||
if (hasFullAnalysisResponse || hasPartialAnalysisResponse) {
|
if (hasFullAnalysisResponse || hasPartialAnalysisResponse) {
|
||||||
await notificationsApi.createNotification({
|
await notificationsApi.createNotification({
|
||||||
account_id: accountId,
|
account_id: userId,
|
||||||
body: t('analysis-results:notification.body'),
|
body: t('analysis-results:notification.body'),
|
||||||
link: `${pathsConfig.app.analysisResults}/${analysisOrderId}`,
|
link: `${pathsConfig.app.analysisResults}/${analysisOrderId}`,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user