Merge branch 'main' into develop
This commit is contained in:
@@ -509,9 +509,18 @@ class UserAnalysesApi {
|
||||
}
|
||||
const analysisOrder = await this.getAnalysisOrder({ analysisOrderId });
|
||||
const userId = analysisOrder.user_id;
|
||||
if (!userId) {
|
||||
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) {
|
||||
console.warn(
|
||||
`Order ${analysisOrderId} got new responses but user_id is missing. Skipping notification. AnalysisOrder=${JSON.stringify(analysisOrder)}`,
|
||||
`Order ${analysisOrderId} got new responses but no account found for user_id=${userId}. Skipping notification. AnalysisOrder=${JSON.stringify(analysisOrder)}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -525,7 +534,7 @@ class UserAnalysesApi {
|
||||
|
||||
if (hasFullAnalysisResponse || hasPartialAnalysisResponse) {
|
||||
await notificationsApi.createNotification({
|
||||
account_id: userId,
|
||||
account_id: accountId,
|
||||
body: t('analysis-results:notification.body'),
|
||||
link: `${pathsConfig.app.analysisResults}/${analysisOrderId}`,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user