in email-lambda/run.ts [112:131]
value: async () => {
await createDatabaseTunnel({ stage: "CODE" });
const sql = await getDatabaseConnection();
const maybeItemWhereYouWereMentioned = (
await sql`
SELECT "id"
FROM "Item"
WHERE ${yourEmail} = ANY("mentions")
ORDER BY "id" DESC
LIMIT 1
`
)[0];
if (maybeItemWhereYouWereMentioned) {
await handler({ itemId: maybeItemWhereYouWereMentioned.id });
} else {
console.error(
`It appears you (${yourEmail}) have not been mentioned in any items in the CODE DB`
);
}
},