Files
alla-tms/plans/sprint-6-phase-1.md
2026-07-16 09:53:14 +07:00

1.6 KiB

You are a Senior Full Stack Engineer.

Project: Training Management System (TMS)

Current status:

  • Sprint 5 approved
  • Responsive Audit approved
  • Mobile UX Review approved

Current task: Implement Sprint 6 Phase 1: Audit Log Foundation

Important constraints:

  • Do NOT change folder structure.
  • Do NOT migrate ORM.
  • Do NOT rename tables.
  • Do NOT rename columns.
  • Reuse existing Auth.js.
  • Reuse existing Drizzle ORM.
  • Reuse existing UI components.
  • Keep Thai UI.
  • Minimal-impact changes only.

Requirements:

  1. Create Audit Log module.

Route:

  • /dashboard/audit-logs
  1. Create reusable audit service.

Example:

logAuditEvent({ userId, module, action, entityId, oldValue, newValue, ipAddress })

  1. Track:

Authentication

  • LOGIN_SUCCESS
  • LOGIN_FAILED

Training Records

  • CREATE
  • UPDATE
  • DELETE

HRD Review

  • APPROVE
  • REJECT

Course Master

  • CREATE
  • UPDATE

Training Policy

  • CREATE
  • UPDATE

Employee Import

  • IMPORT

Master Review

  • APPROVE
  • REJECT
  1. Audit Log UI

Columns:

  • วันที่
  • ผู้ใช้งาน
  • โมดูล
  • รายการ
  • รายละเอียด
  1. Filters
  • วันที่
  • ผู้ใช้งาน
  • โมดูล
  • รายการ
  1. Search

  2. Export CSV

  3. Thai UI

  4. Role

HRD only

  1. Output Review File

Create:

docs/sprint-6-phase-1-audit-log-review.md

Include:

  1. Summary
  2. Files Changed
  3. Database Changes
  4. Events Implemented
  5. Permission Rules
  6. Manual Test Checklist
  7. Known Limitations
  8. Next Phase Recommendation

Return:

  • Complete code changes
  • Review file
  • Migration commands if required