MED-238: Improve logging
This commit is contained in:
@@ -377,7 +377,7 @@ export async function readPrivateMessageResponse({
|
||||
messageResponse,
|
||||
});
|
||||
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({
|
||||
action: 'sync_analysis_results_from_medipost',
|
||||
|
||||
@@ -509,18 +509,9 @@ class UserAnalysesApi {
|
||||
}
|
||||
const analysisOrder = await this.getAnalysisOrder({ analysisOrderId });
|
||||
const userId = analysisOrder.user_id;
|
||||
const { data: account } = await this.client
|
||||
.schema('medreport')
|
||||
.from('accounts')
|
||||
.select('id')
|
||||
.eq('primary_owner_user_id', userId)
|
||||
.maybeSingle()
|
||||
.throwOnError();
|
||||
|
||||
const accountId = account?.id;
|
||||
if (!accountId) {
|
||||
if (!userId) {
|
||||
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;
|
||||
}
|
||||
@@ -534,7 +525,7 @@ class UserAnalysesApi {
|
||||
|
||||
if (hasFullAnalysisResponse || hasPartialAnalysisResponse) {
|
||||
await notificationsApi.createNotification({
|
||||
account_id: accountId,
|
||||
account_id: userId,
|
||||
body: t('analysis-results:notification.body'),
|
||||
link: `${pathsConfig.app.analysisResults}/${analysisOrderId}`,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user