feat(push): add phase7 offline push queue, worker, APIs, and simulator inbox

This commit is contained in:
2026-01-24 15:20:00 +00:00
parent bccc049fc3
commit 6d6c77f77e
9 changed files with 392 additions and 6 deletions

View File

@@ -135,6 +135,21 @@ export const notifications = pgTable('notifications', {
isRead: boolean('is_read').default(false).notNull(),
});
export const pushNotifications = pgTable('push_notifications', {
id: uuid('id').defaultRandom().primaryKey(),
ownerUserId: uuid('owner_user_id').notNull().references(() => users.id),
recipientDeviceId: uuid('recipient_device_id').notNull().references(() => devices.id),
type: varchar('type', { length: 64 }).notNull(),
payload: jsonb('payload').$type<Record<string, unknown> | null>().default(null),
status: varchar('status', { length: 32 }).default('queued').notNull(),
attempts: integer('attempts').default(0).notNull(),
lastError: text('last_error'),
sentAt: timestamp('sent_at', { withTimezone: true }),
nextAttemptAt: timestamp('next_attempt_at', { withTimezone: true }).defaultNow().notNull(),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
});
export const accounts = pgTable('account', {
id: uuid('id').defaultRandom().primaryKey(),
userId: uuid('user_id').notNull().references(() => users.id),
@@ -181,6 +196,7 @@ export const schema = {
events,
videos,
notifications,
pushNotifications,
accounts,
sessions,
verifications,