feat(push): fan out web push to subscribed devices on defect filed
Prune endpoints the push service rejects with 404/410; log and skip transient failures so one bad device never blocks the rest. (T11/F7)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { asc, sql } from 'drizzle-orm'
|
||||
import { asc, eq, sql } from 'drizzle-orm'
|
||||
import type { NodePgDatabase } from 'drizzle-orm/node-postgres'
|
||||
import type * as schema from '../schema'
|
||||
import { projects } from '../schema'
|
||||
@@ -34,6 +34,16 @@ export async function createProject(db: Db, rawName: string): Promise<Project> {
|
||||
}
|
||||
}
|
||||
|
||||
/** A project's name by id — used to label the push notification on file (T11). */
|
||||
export async function getProjectName(db: Db, id: string): Promise<string | undefined> {
|
||||
const [row] = await db
|
||||
.select({ name: projects.name })
|
||||
.from(projects)
|
||||
.where(eq(projects.id, id))
|
||||
.limit(1)
|
||||
return row?.name
|
||||
}
|
||||
|
||||
async function findByName(db: Db, name: string): Promise<Project | undefined> {
|
||||
const [row] = await db
|
||||
.select()
|
||||
|
||||
Reference in New Issue
Block a user