feat(04-03): add AddDocumentModal, PdfViewer, and document detail page

- Create AddDocumentModal: searchable forms library list + custom file picker
- Wire Add Document button into ClientProfileClient in Documents section header
- Update DocumentsTable: document names now link to /portal/documents/{id}
- Create PdfViewer with page nav, zoom, and download controls (pdfjs worker via import.meta.url)
- Create /portal/documents/[docId] page: server component with auth check, doc/client query
- Add documentsRelations and clientsRelations to schema.ts for db.query with-relations support
- Build verified: /portal/documents/[docId] route present, no errors
This commit is contained in:
Chandler Copeland
2026-03-19 21:44:17 -06:00
parent 63e5888968
commit c1f60cadf6
6 changed files with 306 additions and 53 deletions

View File

@@ -1,4 +1,5 @@
import { pgEnum, pgTable, text, timestamp } from "drizzle-orm/pg-core";
import { relations } from "drizzle-orm";
export const users = pgTable("users", {
id: text("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
@@ -42,3 +43,11 @@ export const documents = pgTable("documents", {
formTemplateId: text("form_template_id").references(() => formTemplates.id),
filePath: text("file_path"),
});
export const documentsRelations = relations(documents, ({ one }) => ({
client: one(clients, { fields: [documents.clientId], references: [clients.id] }),
}));
export const clientsRelations = relations(clients, ({ many }) => ({
documents: many(documents),
}));