feat(documents): add Epson scanner inbox and document shelf
This commit is contained in:
@@ -100,3 +100,4 @@ export * from "./serialtypes"
|
||||
export * from "./serialexecutions"
|
||||
export * from "./public_links"
|
||||
export * from "./wikipages"
|
||||
export * from "./scanner_inbox"
|
||||
|
||||
23
backend/db/schema/scanner_inbox.ts
Normal file
23
backend/db/schema/scanner_inbox.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { bigint, boolean, index, pgTable, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core"
|
||||
import { tenants } from "./tenants"
|
||||
import { files } from "./files"
|
||||
|
||||
export const scannerInboxConnections = pgTable("scanner_inbox_connections", {
|
||||
tenantId: bigint("tenant_id", { mode: "number" }).primaryKey().references(() => tenants.id, { onDelete: "cascade" }),
|
||||
username: text("username").notNull().unique(),
|
||||
passwordHash: text("password_hash").notNull(),
|
||||
active: boolean("active").notNull().default(true),
|
||||
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
||||
updatedAt: timestamp("updated_at", { withTimezone: true }),
|
||||
})
|
||||
|
||||
export const scannerInboxDocuments = pgTable("scanner_inbox_documents", {
|
||||
fileId: uuid("file_id").primaryKey().references(() => files.id, { onDelete: "cascade" }),
|
||||
tenantId: bigint("tenant_id", { mode: "number" }).notNull().references(() => tenants.id, { onDelete: "cascade" }),
|
||||
remoteFilename: text("remote_filename").notNull(),
|
||||
checksum: text("checksum").notNull(),
|
||||
receivedAt: timestamp("received_at", { withTimezone: true }).notNull().defaultNow(),
|
||||
}, table => ({
|
||||
filenameKey: uniqueIndex("scanner_inbox_documents_filename_key").on(table.tenantId, table.remoteFilename),
|
||||
receivedIdx: index("scanner_inbox_documents_received_idx").on(table.tenantId, table.receivedAt),
|
||||
}))
|
||||
Reference in New Issue
Block a user