Appearance
API: api.anhdac.com
Mọi request dùng cookie kmx_sid. Client gọi với credentials: "include".
Auth
| Method | Path | Mô tả |
|---|---|---|
| POST | /auth/google | Body { credential } (Google ID token). Tạo phiên, set cookie |
| GET | /auth/me | { user } hoặc { user: null } |
| POST | /auth/logout | Ghi thời điểm logout, xóa cookie |
Đặt lịch công khai (không cần đăng nhập)
| Method | Path | Mô tả |
|---|---|---|
| GET | /public/services | Dịch vụ đang bán + ngày hôm nay, số ngày cho đặt trước, ngày mở cửa |
| GET | /public/availability?service_id=&date= | { slots: [phút] } các giờ còn trống |
| POST | /public/bookings | { service_id, date, start_min, name, phone, note } → { booking: { code, … } } |
| POST | /public/bookings/lookup | { code, phone } |
| POST | /public/bookings/cancel | { code, phone }, chỉ lịch chưa diễn ra |
Lịch hẹn & xếp lịch (cần đăng nhập)
| Method | Path | Mô tả |
|---|---|---|
| GET | /api/bookings?from=&to= | Lịch hẹn kèm KTV, giường |
| POST | /api/bookings | Lễ tân tạo lịch hẹn |
| PUT | /api/bookings/:id/status | booked / done / cancelled / no_show (khôi phục sẽ gán lại KTV) |
| GET | /api/availability?service_id=&date= | Như bản public |
| GET | /api/schedule?week= | Ca của tuần (tự xếp nếu chưa có), nhân viên, giường, tham số |
| POST | /api/schedule/generate | { week } xếp lại ca và gán lại lịch hẹn |
| PUT | /api/schedule/params | { key: value, … } |
| POST | /api/staff, /api/beds | Thêm nhân viên / giường; sửa qua PUT /api/staff/:id, /api/beds/:id |
Dữ liệu (cần đăng nhập)
| Method | Path | Trả về |
|---|---|---|
| GET | /api/capabilities | { domains: [{ ..., processes: [] }] } |
| GET | /api/journey | { stages: [] } |
| GET | /api/services | { services: [] } |
| GET | /api/scenarios | { scenarios: [] } |
| GET | /api/params | { params: [] } |
| GET | /api/roles | { roles: [] } |
| GET | /api/jtbd | { jobs: [{ ..., pains: [] }] } |
| PUT | /api/:entity/:id | { item }. Entity ∈ processes, journey, services, scenarios, roles, jtbd, pains, params (id = key) |
Các trường sửa được:
| Entity | Trường |
|---|---|
| processes | question, name, description, owner, kpi, maturity (1–5), target_maturity (1–5), priority |
| journey | goal, customer_actions, pain_points, touchpoints[], kpis[], capability_codes[], emotion (1–5) |
| services | name, price, duration_min, cogs_pct, mix_pct, description, active (0/1), importance (High/Medium/Low) |
| scenarios | name, description, technicians, sessions_per_tech_per_day, working_days_per_month, customers_per_month, visits_per_customer, ramp[12] |
| roles | name_vi, purpose, responsibilities[], skills[], kpis[], reports_to, headcount, salary_range |
| jtbd | name, statement, job_type, is_core, outcomes[], solutions[{text, selected}] |
| pains | pain, severity, frequency, moment, quote, consequence, metric, stage_code, solutions[{text, selected}] |
| params | value |
Admin
| Method | Path | Mô tả |
|---|---|---|
| GET | /api/admin/logins | 500 lượt đăng nhập gần nhất |
| GET | /api/admin/changes | 500 thay đổi gần nhất |
| GET | /api/admin/activity?email=&type= | 1000 hoạt động gần nhất, top trang 30 ngày, danh sách người dùng |
| POST | /api/activity | (client) mảng sự kiện page_view / click, body text/plain JSON, tối đa 50 sự kiện/lần |
Lỗi trả về { error: string } với HTTP 400/401/403/404/500.