34 lines
883 B
TypeScript
34 lines
883 B
TypeScript
import {
|
|
pgTable,
|
|
uuid,
|
|
timestamp,
|
|
text,
|
|
jsonb,
|
|
bigint,
|
|
} from "drizzle-orm/pg-core"
|
|
|
|
import { tenants } from "./tenants"
|
|
import { authUsers } from "./auth_users"
|
|
|
|
export const helpdesk_routing_rules = pgTable("helpdesk_routing_rules", {
|
|
id: uuid("id").primaryKey().defaultRandom(),
|
|
|
|
tenantId: bigint("tenant_id", { mode: "number" })
|
|
.notNull()
|
|
.references(() => tenants.id, { onDelete: "cascade" }),
|
|
|
|
name: text("name").notNull(),
|
|
|
|
condition: jsonb("condition").notNull(),
|
|
action: jsonb("action").notNull(),
|
|
|
|
createdBy: uuid("created_by").references(() => authUsers.id),
|
|
|
|
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
|
|
})
|
|
|
|
export type HelpdeskRoutingRule =
|
|
typeof helpdesk_routing_rules.$inferSelect
|
|
export type NewHelpdeskRoutingRule =
|
|
typeof helpdesk_routing_rules.$inferInsert
|