KI-AGENT: Mobile Push Registrierung anbinden
This commit is contained in:
@@ -55,6 +55,7 @@ export * from "./movements"
|
||||
export * from "./m2m_api_keys"
|
||||
export * from "./notifications_event_types"
|
||||
export * from "./notifications_items"
|
||||
export * from "./notification_mobile_push_devices"
|
||||
export * from "./notifications_preferences"
|
||||
export * from "./notifications_preferences_defaults"
|
||||
export * from "./notification_push_subscriptions"
|
||||
|
||||
53
backend/db/schema/notification_mobile_push_devices.ts
Normal file
53
backend/db/schema/notification_mobile_push_devices.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import {
|
||||
pgTable,
|
||||
uuid,
|
||||
bigint,
|
||||
text,
|
||||
jsonb,
|
||||
timestamp,
|
||||
uniqueIndex,
|
||||
} from "drizzle-orm/pg-core"
|
||||
|
||||
import { tenants } from "./tenants"
|
||||
import { authUsers } from "./auth_users"
|
||||
|
||||
export const notificationMobilePushDevices = pgTable(
|
||||
"notification_mobile_push_devices",
|
||||
{
|
||||
id: uuid("id").primaryKey().defaultRandom(),
|
||||
|
||||
tenantId: bigint("tenant_id", { mode: "number" })
|
||||
.notNull()
|
||||
.references(() => tenants.id, { onDelete: "cascade", onUpdate: "cascade" }),
|
||||
|
||||
userId: uuid("user_id")
|
||||
.notNull()
|
||||
.references(() => authUsers.id, { onDelete: "cascade", onUpdate: "cascade" }),
|
||||
|
||||
localDeviceId: text("local_device_id").notNull(),
|
||||
centralDeviceId: text("central_device_id").notNull(),
|
||||
platform: text("platform").notNull(),
|
||||
providerTokenPreview: text("provider_token_preview"),
|
||||
deviceLabel: text("device_label"),
|
||||
meta: jsonb("meta"),
|
||||
|
||||
createdAt: timestamp("created_at", { withTimezone: true })
|
||||
.notNull()
|
||||
.defaultNow(),
|
||||
lastSeenAt: timestamp("last_seen_at", { withTimezone: true })
|
||||
.notNull()
|
||||
.defaultNow(),
|
||||
disabledAt: timestamp("disabled_at", { withTimezone: true }),
|
||||
},
|
||||
(table) => ({
|
||||
uniqueUserDevice: uniqueIndex("notification_mobile_push_devices_user_device_key")
|
||||
.on(table.tenantId, table.userId, table.localDeviceId),
|
||||
uniqueCentralDevice: uniqueIndex("notification_mobile_push_devices_central_device_key")
|
||||
.on(table.centralDeviceId),
|
||||
}),
|
||||
)
|
||||
|
||||
export type NotificationMobilePushDevice =
|
||||
typeof notificationMobilePushDevices.$inferSelect
|
||||
export type NewNotificationMobilePushDevice =
|
||||
typeof notificationMobilePushDevices.$inferInsert
|
||||
Reference in New Issue
Block a user