diff --git a/server/db/pg/schema/schema.ts b/server/db/pg/schema/schema.ts index be1ffcb9..f9be4601 100644 --- a/server/db/pg/schema/schema.ts +++ b/server/db/pg/schema/schema.ts @@ -611,7 +611,7 @@ export const clients = pgTable("clients", { // optionally tied to a user and in this case delete when the user deletes onDelete: "cascade" }), - olmId: text("olmId"), // to lock it to a specific olm optionally + olmId: text("olmId"), // to lock it to a specific olm optionally name: varchar("name").notNull(), pubKey: varchar("pubKey"), subnet: varchar("subnet").notNull(), @@ -764,6 +764,21 @@ export const requestAuditLog = pgTable( ] ); +export const deviceWebAuthCodes = pgTable("deviceWebAuthCodes", { + codeId: serial("codeId").primaryKey(), + code: text("code").notNull().unique(), + ip: text("ip"), + city: text("city"), + deviceName: text("deviceName"), + applicationName: text("applicationName").notNull(), + expiresAt: bigint("expiresAt", { mode: "number" }).notNull(), + createdAt: bigint("createdAt", { mode: "number" }).notNull(), + verified: boolean("verified").notNull().default(false), + userId: varchar("userId").references(() => users.userId, { + onDelete: "cascade" + }) +}); + export type Org = InferSelectModel; export type User = InferSelectModel; export type Site = InferSelectModel; @@ -819,4 +834,5 @@ export type Blueprint = InferSelectModel; export type LicenseKey = InferSelectModel; export type SecurityKey = InferSelectModel; export type WebauthnChallenge = InferSelectModel; +export type DeviceWebAuthCode = InferSelectModel; export type RequestAuditLog = InferSelectModel;