fix: multi device lost notifications
Some checks failed
/ build (map[dockerfile:./services/api/Dockerfile name:api]) (push) Successful in 1m28s
/ build (map[dockerfile:./services/app/Dockerfile name:app]) (push) Successful in 1m45s
/ build (map[dockerfile:./services/files/Dockerfile name:files]) (push) Successful in 1m55s
/ build (map[dockerfile:./services/watchers/Dockerfile name:watchers]) (push) Successful in 2m10s
/ build (map[dockerfile:./services/tasks/Dockerfile name:tasks]) (push) Successful in 2m18s
/ build (map[dockerfile:./services/hasura/Dockerfile name:hasura]) (push) Successful in 2m20s
/ build (map[dockerfile:./services/web/Dockerfile name:web]) (push) Failing after 12m45s
/ deploy (push) Has been cancelled
Some checks failed
/ build (map[dockerfile:./services/api/Dockerfile name:api]) (push) Successful in 1m28s
/ build (map[dockerfile:./services/app/Dockerfile name:app]) (push) Successful in 1m45s
/ build (map[dockerfile:./services/files/Dockerfile name:files]) (push) Successful in 1m55s
/ build (map[dockerfile:./services/watchers/Dockerfile name:watchers]) (push) Successful in 2m10s
/ build (map[dockerfile:./services/tasks/Dockerfile name:tasks]) (push) Successful in 2m18s
/ build (map[dockerfile:./services/hasura/Dockerfile name:hasura]) (push) Successful in 2m20s
/ build (map[dockerfile:./services/web/Dockerfile name:web]) (push) Failing after 12m45s
/ deploy (push) Has been cancelled
This commit is contained in:
parent
1cc35a57c9
commit
74e1b5f10b
1 changed files with 11 additions and 28 deletions
|
@ -134,34 +134,17 @@ module.exports = async function () {
|
|||
const { reason, alertId, userId: alertingUserId } = alertingRow
|
||||
logger.debug({ reason, alertId, alertingUserId }, "Found alerting record")
|
||||
|
||||
let devicesList
|
||||
if (reason === "relative") {
|
||||
logger.debug({ alertingUserId }, "Querying device record for user")
|
||||
devicesList = await sql`
|
||||
SELECT
|
||||
"id",
|
||||
"fcm_token" as "fcmToken",
|
||||
"notification_alert_level" as "notificationAlertLevel"
|
||||
FROM
|
||||
"device"
|
||||
WHERE
|
||||
"user_id" = ${alertingUserId}
|
||||
AND "fcm_token" IS NOT NULL
|
||||
`
|
||||
} else {
|
||||
const { deviceId } = alertingRow
|
||||
logger.debug({ deviceId }, "Querying device record")
|
||||
devicesList = await sql`
|
||||
SELECT
|
||||
"fcm_token" as "fcmToken",
|
||||
"notification_alert_level" as "notificationAlertLevel"
|
||||
FROM
|
||||
"device"
|
||||
WHERE
|
||||
"user_id" = ${alertingUserId}
|
||||
AND "fcm_token" IS NOT NULL
|
||||
`
|
||||
}
|
||||
const devicesList = await sql`
|
||||
SELECT
|
||||
"id",
|
||||
"fcm_token" as "fcmToken",
|
||||
"notification_alert_level" as "notificationAlertLevel"
|
||||
FROM
|
||||
"device"
|
||||
WHERE
|
||||
"user_id" = ${alertingUserId}
|
||||
AND "fcm_token" IS NOT NULL
|
||||
`
|
||||
const devices = devicesList.map((device) => ({ ...device }))
|
||||
|
||||
logger.debug({ alertId }, "Querying alert record")
|
||||
|
|
Loading…
Add table
Reference in a new issue