Skip to content

Commit bf4fa6e

Browse files
committed
check conversation existence in activityRelations
1 parent e94e119 commit bf4fa6e

File tree

1 file changed

+18
-0
lines changed
  • services/libs/data-access-layer/src/activities

1 file changed

+18
-0
lines changed

services/libs/data-access-layer/src/activities/sql.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,6 +1511,24 @@ export async function createOrUpdateRelations(
15111511
}
15121512
}
15131513

1514+
// check conversation exists
1515+
if (data.conversationId !== undefined && data.conversationId !== null) {
1516+
const conversation = await qe.select(
1517+
`
1518+
SELECT id
1519+
FROM conversations
1520+
WHERE id = $(conversationId)
1521+
`,
1522+
{
1523+
conversationId: data.conversationId,
1524+
},
1525+
)
1526+
1527+
if (conversation.length === 0) {
1528+
data.conversationId = null
1529+
}
1530+
}
1531+
15141532
// check member exists
15151533
let member = await qe.select(
15161534
`

0 commit comments

Comments
 (0)