Appearance
Mô hình dữ liệu (D1)
Một brand = một dòng trong brands; mọi thứ còn lại trỏ về nó bằng brand_id. Vì vậy thêm brand không cần thêm bảng hay code.
text
erDiagram
brands ||--o{ sessions : "lịch cố định"
brands ||--o{ agenda_items : "agenda (nhiều variant)"
brands ||--o{ tasks : "checklist theo thứ"
tasks ||--o{ task_checks : "tick theo tuần"
brands ||--o{ risks : ""
brands ||--o{ rubrics : "5 tiêu chí"
brands ||--o{ reflections : ""
brands ||--o{ actions : "action items"| Bảng | Trường chính | Ghi chú |
|---|---|---|
brands | slug, name, grp, tagline, color, status, cadence, venue, audience, owner, notes, goals[], success[], links[], extra{}, fields[] | status: active · draft · paused. extra = giá trị trường bổ sung của brand; fields = định nghĩa trường, chỉ dùng ở dòng _template. Brand _template là template gốc |
sessions | brand_id, weekday (1=Thứ 2 … 7=CN), start, end, format | Nguồn của khối màu trên lịch tuần |
agenda_items | brand_id, variant, start, end, goal, activity, content, host, sort | variant nhóm các mục (vd "Học thử", "Chính thức") |
tasks | brand_id, phase (before/during/after), weekday, time, title, detail, owner | Mẫu lặp lại hằng tuần |
task_checks | task_id, week (ngày Thứ 2 của tuần), done_by | Có dòng = đã xong trong tuần đó |
risks | brand_id, grp, level 1–3, risk, mitigation, pic | |
rubrics | brand_id, criterion, levels[5], score 0–5 | score là điểm tự chấm hiện tại |
reflections | brand_id, date, author, title, keep, improve, next | |
actions | brand_id, text, owner, due, status | status: open · done |
API (Pages Functions)
GET /api/bootstrap?week=YYYY-MM-DD | Toàn bộ dữ liệu + tick của tuần |
POST/PUT/DELETE /api/<bảng>[/<id>] | CRUD cho 8 bảng ở trên (chỉ cho phép các cột được khai báo) |
POST /api/brands | Tạo brand và sao chép checklist, rủi ro, agenda khung, rubrics từ _template |
POST /api/checks | {task_id, week, done} |