Documents
Document templates and document requests for building renovations. Admins define reusable templates organized by labels and categories; document requests track which documents are needed for a specific project or building.
Source Files
| Layer | Path |
|---|---|
| Schema | backend/src/db/schema.ts |
| Request Routes | backend/src/routes/document-requests.ts |
| Template Routes | backend/src/routes/admin/document-templates.ts |
| Label Routes | backend/src/routes/admin/template-labels.ts |
| Request Service | backend/src/services/document-request-service.ts |
| Template Service | backend/src/services/document-template-service.ts |
Database Tables
| Table | Purpose |
|---|---|
documentRequests | Tracks individual document needs per project (status, assignee, due date) |
documentTemplates | Reusable definitions of document types (name, description, requirements) |
documentTemplateLabels | Tags/labels for organizing templates |
documentTemplateLabelCategories | Groupings for labels (e.g., “Building Type”, “Funding Body”) |
Key Concepts
- Templates define what a document is (e.g., “Energy Certificate”, “Floor Plan”). Admins manage templates, labels, and categories via the admin panel.
- Requests are instances tied to a project: “We need document X for project Y.” Each request tracks status, assignee, and fulfillment.
- Labels & categories provide a two-level taxonomy so templates can be filtered and grouped in the UI.
Relationships
DocumentTemplate 1──* DocumentRequests
DocumentTemplate *──* DocumentTemplateLabels
DocumentTemplateLabel *──1 DocumentTemplateLabelCategory
DocumentRequest *──1 Project
DocumentRequest *──* Files (fulfillment uploads)
Workflow
- Admin creates templates and labels in the admin panel
- When a project starts, relevant document requests are created (manually or via Document Obtaining)
- Requests are assigned to team members or sent to customers via Portal
- Customers or staff upload Files to fulfill the request
- Fulfilled documents go through Document Review
Frontend
Document requests appear on the project detail page and inside the Document Obtaining dashboard. The admin template management lives at frontend/src/pages/admin/ alongside Forms and other configuration pages.
Related Pages
Document Obtaining | Document Review | Files | Portal | Forms | Projects | Buildings | Admin Dashboard | Service Layer Pattern