mirror of
https://github.com/fosrl/pangolin.git
synced 2026-01-28 22:00:51 +00:00
🗃️ use clientId and fix bad column name for decision and add userId
This commit is contained in:
@@ -17,7 +17,7 @@ import {
|
||||
users,
|
||||
exitNodes,
|
||||
sessions,
|
||||
olms
|
||||
clients
|
||||
} from "./schema";
|
||||
|
||||
export const certificates = pgTable("certificates", {
|
||||
@@ -305,14 +305,14 @@ export const approvals = pgTable("approvals", {
|
||||
onDelete: "cascade"
|
||||
})
|
||||
.notNull(),
|
||||
olmId: varchar("olmId").references(() => olms.olmId, {
|
||||
clientId: integer("clientId").references(() => clients.clientId, {
|
||||
onDelete: "cascade"
|
||||
}), // olms reference user devices clients (in this case)
|
||||
}), // clients reference user devices (in this case)
|
||||
userId: varchar("userId").references(() => users.userId, {
|
||||
// optionally tied to a user and in this case delete when the user deletes
|
||||
onDelete: "cascade"
|
||||
}),
|
||||
decision: varchar("type")
|
||||
decision: varchar("decision")
|
||||
.$type<"approved" | "denied" | "pending">()
|
||||
.default("pending")
|
||||
.notNull(),
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
sqliteTable,
|
||||
text
|
||||
} from "drizzle-orm/sqlite-core";
|
||||
import { domains, exitNodes, olms, orgs, sessions, users } from "./schema";
|
||||
import { clients, domains, exitNodes, orgs, sessions, users } from "./schema";
|
||||
|
||||
export const certificates = sqliteTable("certificates", {
|
||||
certId: integer("certId").primaryKey({ autoIncrement: true }),
|
||||
@@ -297,10 +297,14 @@ export const approvals = sqliteTable("approvals", {
|
||||
onDelete: "cascade"
|
||||
})
|
||||
.notNull(),
|
||||
olmId: text("olmId").references(() => olms.olmId, {
|
||||
clientId: integer("clientId").references(() => clients.clientId, {
|
||||
onDelete: "cascade"
|
||||
}), // olms reference user devices clients
|
||||
decision: text("type")
|
||||
userId: text("userId").references(() => users.userId, {
|
||||
// optionally tied to a user and in this case delete when the user deletes
|
||||
onDelete: "cascade"
|
||||
}),
|
||||
decision: text("decision")
|
||||
.$type<"approved" | "denied" | "pending">()
|
||||
.default("pending")
|
||||
.notNull(),
|
||||
|
||||
Reference in New Issue
Block a user