Document manages project documentation through CategoryController, CategoryService, and DocumentController, including category creation, trees, updates, deletion, and document ordering. It creates, lists, searches, updates, deletes, renders, and organizes documents; handles draft-to-publish state, publication, versions, revisions, comparisons, and restoration; and exposes public document and navigation access with audience filtering. It rejects category, project, and document operations when resources are absent or organization access is unauthorized.
182 entities in atloria-monorepo/apps/api/src/document. 7 other subsystems depend on it, which makes it the 7th most depended-upon part of this codebase.
What it is made of
Its 182 entities sit in 26 files under atloria-monorepo/apps/api/src/document: 88 doc comments, 41 HTTP endpoints, 17 interfaces, 16 classes and 20 more.
document.controller.ts holds 32 of them — more than any other file here.
DocumentService is what the rest of it leans on: 3 of its own members depend on it, more than on anything else inside the boundary.
Where work enters
4 controllers publish 41 HTTP endpoints — 20 GET, 14 POST, 4 PATCH and 3 DELETE. They answer under /categories, /documents and /public. DocumentController carries 29 of them; the remaining 12 are split across 3 other controllers. Every one of them declares a guard — JwtAuthGuard on 37 and OrganizationGuard on 29.
CategoryController—atloria-monorepo/apps/api/src/document/category.controller.ts:23create—atloria-monorepo/apps/api/src/document/category.controller.ts:33list—atloria-monorepo/apps/api/src/document/category.controller.ts:45getTree—atloria-monorepo/apps/api/src/document/category.controller.ts:55get—atloria-monorepo/apps/api/src/document/category.controller.ts:70update—atloria-monorepo/apps/api/src/document/category.controller.ts:81
How work moves through it
mermaidflowchart LR CategoryController0["CategoryController"] CategoryService10["CategoryService"] CategoryController0 --> CategoryService10 PrismaService20["PrismaService"] CategoryService10 --> PrismaService20 stop["refused"] CategoryService10 -. "NotFoundException" .-> stop
Work enters at CategoryController and passes through 2 other components. Each step below is a dependency edge between two entities in this repository, followed outward in order.
CategoryControllertakes the work first —atloria-monorepo/apps/api/src/document/category.controller.ts:23.- Next,
CategoryControllerhands off toCategoryService—atloria-monorepo/apps/api/src/document/category.service.ts:14. - Finally,
CategoryServicehands off toPrismaService—atloria-monorepo/libs/database/src/lib/prisma.service.ts:28.
Where the work stops
CategoryServicestops the work withNotFoundExceptionwhen!project— “Project not found”, in 3 places.CategoryServicestops the work withNotFoundExceptionwhen!category— “Category not found”, in 3 places.
When a step fails
PrismaServicehandles failure in 1 place: it lets it reach the caller in all 1.
How it refuses and fails
6 of its components record a refusal or a failure handler.
All 6 of them refuse work outright, under a condition written into the component itself.
Their catch blocks handle a failure that already happened in 7 places.
Of those 7, 3 log it and continue, 3 discard it without recording anything and 1 turns it into a return value.
DocumentService holds 3 of the silent ones — a failure discarded silently leaves no trace for whoever debugs this later.
Boundaries
7 other subsystems depend on this one — Api, Capture, Documentation, Manuals Insights, Project, Suggestion, Technical Docs. Changing what it exposes changes them.
Those 7 hold 15 edges between them, unevenly: Project reaches in across 5 edges, while 2 of them hold one each. 15 edges arrive against 12 leaving — more of this repository reaches into it than it reaches out to. What they reach is narrower than the folder: 7 of its 182 members carry every inbound edge — DraftDocumentModule (3), DraftDocumentService (3) and UrlService (3), plus 4 more. Of the 12 it sends out, 8 go to Database — more than to any other.
It depends on Database, Auth, Docs Repo, Documentation, and on nothing else in this repository.
How this code is named
These conventions cover most of the codebase. Learning them is faster than reading an index — each one lets you find any member of its family without looking it up.
| Pattern | Where | Count | Examples |
|---|---|---|---|
*.dto.ts | src/document/dto/ | 11 | category.dto.ts, create-version.dto.ts, document-stats.dto.ts, bulk-operations.dto.ts |
*.service.ts | across the repository | 7 | url.service.ts, category.service.ts, document.service.ts, toc-builder.service.ts |
Was this page helpful?