Files
reader-api/FLOWS.md
T
virtus c985df7579
Build and Push Reader API Image / docker (push) Successful in 1m3s
chore: update architecture and documentation to reflect removal of MongoDB and transition to NAS storage for chapter content
- Updated `.env.example` to remove MongoDB configuration.
- Revised `ARCHITECTURE.md` to reflect changes in data orchestration and storage strategy.
- Removed `CHAPTER_SAVE_DEBUG.md` and `FIXES_APPLIED.md` as they are no longer relevant.
- Updated `CONTRACT.md` to include new error codes.
- Adjusted endpoint documentation in `CROSS_REPO_ENDPOINT_MATRIX.md` and `README.md` to align with the new import flow.
- Removed legacy import scripts and tables from the codebase.
2026-05-11 15:27:56 +07:00

1.4 KiB

Flows - Reader API

Backend flow theo domain, de web/mobile follow giong nhau.

Flow A: Auth Identity Unification

  • Input:
    • Web session cookie (NextAuth)
    • Mobile bearer JWT
  • Behavior:
    1. Resolve current user identity.
    2. Validate role/permission.
    3. Return consistent auth errors (401/403).

Flow B: Discovery and Reading

  • Discovery:
    • /api/genres
    • /api/novels/browse
    • /api/novels/{idOrSlug}
  • Reading:
    • /api/truyen/{id}/chapters
    • /api/chapters/{chapterId} or chapter-by-number variant
  • Rule: response shape on dinh de client render.

Flow C: User Personalization

  • Bookmark: /api/user/bookmarks.
  • Progress: /api/user/reading-progress.
  • Settings: /api/user/settings.
  • Recommendations: /api/user/recommendations.
  • Rule: idempotent where possible, clear conflict semantics.

Flow D: Social Interaction

  • Comments: /api/truyen/{id}/comments.
  • Rating: /api/truyen/{id}/rate.
  • Rule: enforce auth + anti-invalid payload + stable error format.

Flow E: EPUB Import (MOD/ADMIN)

Luồng trên web (reader /mod/import):

  • Thể loại: GET/POST/PUT/DELETE /api/mod/the-loai
  • Upload EPUB preview: POST /api/import/uploads/preview (multipart)
  • Gợi ý metadata: POST /api/mod/epub/ai-suggest
  • Import EPUB: POST /api/mod/epub

Rules:

  • Import ghi nội dung NAS / refs chương và cập nhật metadata novel khi hoàn tất.