feat(documents): add Epson scanner inbox and document shelf

This commit is contained in:
2026-09-29 12:42:05 +02:00
parent 552a90e9e1
commit 2192fa5bb4
13 changed files with 942 additions and 0 deletions

View File

@@ -100,3 +100,4 @@ export * from "./serialtypes"
export * from "./serialexecutions"
export * from "./public_links"
export * from "./wikipages"
export * from "./scanner_inbox"

View 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),
}))