Activity Log, Notifications & Support
Nhật ký hoạt động, thông báo và hỗ trợ.
Activity Log, Notifications & Support
Ba module này tạo thành hệ thống quan sát cho tenant: audit, realtime notifications và tickets.
Activity Log
/dashboard/activity-log — audit, filter, export
Notifications
/dashboard/notifications — list, markRead
Support
/dashboard/support — tickets + thread
Bạn tìm thấy gì ở đâu
| Trang | Đường dẫn | Mô tả |
|---|---|---|
| Activity Log | /dashboard/activity-log | Prefetch list + getStats + getActors + myWatches |
| Notifications | /dashboard/notifications | Prefetch list(page1,20) + unreadCount |
| Support | /dashboard/support | Prefetch list(page1,20) |
| Ticket Detail | /dashboard/support/[id] | Thread messages |
| Contact | /contact (marketing) | Form public, không cần login |
Activity Log
| Chức năng | Mô tả |
|---|---|
list({ limit, cursor, type, dateRange }) | Cursor pagination, bounded 50/page |
getStats / getActors | Thống kê và danh sách actors |
getMemberActivity | Activity per member |
exportCsv | Xuất CSV |
watch / unwatch / myWatches | Theo dõi activity |
Activity Types
| Type | Ví dụ metadata |
|---|---|
draft.created / approved / published | draftId, jobId, publisherId |
job.created / triggered / paused | jobId, instanceId |
publisher.connected / tested | publisherId, platform, success |
document.uploaded | documentId, fileName |
settings.updated | field, masked value |
member.invited | email, role |
Activity log append-only, không có delete/update. Mọi thay đổi nhạy cảm (billing, credentials, role) bắt buộc ghi audit với actorId, orgId, action.
Notifications
| Chức năng | Mô tả |
|---|---|
list({ unreadOnly }) | List, filter unread |
markRead({ id }) / markAllRead() | Đánh dấu đã đọc |
unreadCount | Badge trên sidebar Bell |
getPreferences / updatePreference | Cài đặt thông báo |
| Type | Khi nào nhận |
|---|---|
draft.review_ready | Draft chờ duyệt |
job.failed | Job fail liên tiếp |
quota.warning | Đạt 80% quota |
publisher.failed | Publish fail |
support.reply | Ticket có phản hồi |
system.announcement | Broadcast từ admin |
Realtime channel: notifications:{orgId}:{userId} → tự invalidate cache khi có mới.
Support
| Chức năng | Mô tả |
|---|---|
list({ status }) | List tickets, filter open/in_progress/resolved/closed |
getById({ id }) | Ticket + messages thread created_at asc |
create({ subject, message }) | Tạo ticket, validate Zod, ghi audit |
addMessage({ ticketId, body }) | Thêm message vào thread |
| Status | Transition |
|---|---|
open | Mới tạo |
in_progress | Đang xử lý |
waiting_user | Chờ bạn phản hồi |
resolved | Đã giải quyết |
closed | Đóng, read-only |
Tạo ticket:
support.create — ghi audit.Thread:
getById trả messages, addMessage để trả lời.Admin reply: admin trả lời qua
admin.support, bạn nhận notifications type support.reply.Đóng:
resolved → closed, sau đó read-only.Contact (Public)
contact.submit là publicProcedure cho /contact:
- Validate
name/email/message+companyoptional, rate limited - Lưu vào
contact_submissions— không cần login
Lưu ý
- Mọi route
/dashboard/activity-log,/notifications,/supportđều là/orgs/{slug}/dashboard/...— không hardcode - Audit queries luôn bounded — không load toàn bộ
- Impersonation (admin) luôn audit và read-only — tenant không thấy nhưng cần biết admin có thể xem để hỗ trợ