c985df7579
Build and Push Reader API Image / docker (push) Successful in 1m3s
- 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.
52 lines
1.4 KiB
Markdown
52 lines
1.4 KiB
Markdown
# 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.
|