feat(push): add phase7 offline push queue, worker, APIs, and simulator inbox
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user