eCourt-note/drizzle/meta/_journal.json
Suphonchai Phoonsawat 765946f0d5 feat(docver): add document versioning API (docx+pdf in MinIO)
Stand-alone API group at /api/documents/{docId}/versions — one document
per docId (unique), each version stores .docx + optional .pdf as MinIO
objects with uploader userId/userName/createdAt (no auth, like
api/template; callers identify themselves per docs/PLAN-DOCVER.md).

- POST versions (multipart): validates fields/magic bytes/100MB cap,
  uploads to MinIO first, cleans up objects if the DB insert fails;
  returns {hasPdf, versionId, versionNumber} with server-authoritative
  numbering (tx: upsert + SELECT FOR UPDATE, safe under parallel calls)
- GET versions: DocumentVersionDTO[] newest-first (404 for unknown docId)
- GET versions/{versionId}/download-link?format=docx|pdf: presigned URL
  (docId+versionId matched together; pdf-missing = 404)
- tables documents/document_versions + migration drizzle/0005
- docker-compose.yml: judes-note-db + judes-note-minio (quay.io image,
  host ports 19000/19001, POSTGRES_DB ecourt-note, pinned volume names)
- lib/openapi.ts: documents tag + paths for Swagger UI
- middleware: exempt api/documents from login redirect
- unit tests tests/lib/document-versioning.test.ts (23 cases)

wordaddin untouched — swap the mock later via NEXT_PUBLIC_ADDIN_API_BASE_URL.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-20 10:52:35 +07:00

48 lines
No EOL
933 B
JSON

{
"version": "7",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "7",
"when": 1789031603082,
"tag": "0000_narrow_quentin_quire",
"breakpoints": true
},
{
"idx": 1,
"version": "7",
"when": 1789544914887,
"tag": "0001_bright_celestials",
"breakpoints": true
},
{
"idx": 2,
"version": "7",
"when": 1790067045038,
"tag": "0002_mushy_excalibur",
"breakpoints": true
},
{
"idx": 3,
"version": "7",
"when": 1790069992426,
"tag": "0003_lively_stone_men",
"breakpoints": true
},
{
"idx": 4,
"version": "7",
"when": 1790072946313,
"tag": "0004_right_ted_forrester",
"breakpoints": true
},
{
"idx": 5,
"version": "7",
"when": 1792467537332,
"tag": "0005_icy_bloodaxe",
"breakpoints": true
}
]
}