chore: update project documentation, audit reports, and initialize IDE configuration files
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 29s
CI / E2E Tests (push) Has been skipped
CodeQL Analysis / CodeQL (javascript-typescript) (push) Failing after 2m42s
Deploy / Build Web Image (push) Failing after 27s
Deploy / Build AI Services Image (push) Failing after 29s
E2E Tests / Playwright E2E (push) Failing after 43s
Deploy / Build API Image (push) Failing after 1m31s
Security Scanning / Dependency Audit (pnpm) (push) Failing after 6s
Security Scanning / Trivy Scan — API Image (push) Failing after 5m35s
Security Scanning / Trivy Scan — AI Services Image (push) Failing after 3m45s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Staging (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped
Security Scanning / Trivy Scan — Web Image (push) Failing after 13m51s
Security Scanning / Trivy Filesystem Scan (push) Failing after 14m46s
Security Scanning / Security Gate (push) Has been cancelled

This commit is contained in:
Ho Ngoc Hai
2026-04-19 03:12:54 +07:00
parent 3be106074d
commit 11f2bf26e6
101 changed files with 21312 additions and 20672 deletions

View File

@@ -1,6 +1,6 @@
# Audit Logging Architecture for GoodGo Admin Module
# Kiến Trúc Ghi Nhật Ký Kiểm Tra cho Module Admin của GoodGo
## System Design Overview
## Tổng Quan Thiết Kế Hệ Thống
```
┌─────────────────────────────────────────────────────────────────────┐
@@ -136,7 +136,7 @@
---
## Data Flow Sequence
## Trình Tự Luồng Dữ Liệu
```
Admin Action → Controller → Command → Event → AuditListener → Repository → Database
@@ -214,7 +214,7 @@ Admin Action → Controller → Command → Event → AuditListener → Reposito
---
## Prisma Schema Addition
## Bổ Sung Schema Prisma
```typescript
// Add to prisma/schema.prisma
@@ -286,9 +286,9 @@ model User {
---
## Repository Layer
## Tầng Repository
### Domain Interface
### Giao Diện Domain
```typescript
// domain/repositories/audit-log.repository.ts
@@ -326,7 +326,7 @@ export interface FindAuditLogsParams {
}
```
### Infrastructure Implementation
### Triển Khai Infrastructure
```typescript
// infrastructure/repositories/prisma-audit-log.repository.ts
@@ -394,7 +394,7 @@ export class PrismaAuditLogRepository implements IAuditLogRepository {
---
## Event Listener Implementation
## Triển Khai Event Listener
```typescript
// application/listeners/audit-logging.listener.ts
@@ -476,7 +476,7 @@ export class AuditLoggingListener {
---
## Query Handler for Retrieval
## Query Handler để Truy Xuất Dữ Liệu
```typescript
// application/queries/get-audit-logs/get-audit-logs.handler.ts
@@ -515,7 +515,7 @@ export class GetAuditLogsHandler implements IQueryHandler<GetAuditLogsQuery> {
---
## Controller Endpoint
## Endpoint Controller
```typescript
// presentation/controllers/admin.controller.ts (add to existing file)
@@ -549,7 +549,7 @@ async getAuditLogs(
---
## DI Registration
## Đăng Ký DI
```typescript
// admin.module.ts (update existing)
@@ -590,9 +590,9 @@ export class AdminModule {}
---
## Testing Strategy
## Chiến Lược Kiểm Thử
### Unit Test (AuditLoggingListener)
### Kiểm Thử Đơn Vị (AuditLoggingListener)
```typescript
describe('AuditLoggingListener', () => {
let listener: AuditLoggingListener;
@@ -628,7 +628,7 @@ describe('AuditLoggingListener', () => {
});
```
### Integration Test
### Kiểm Thử Tích Hợp
```typescript
describe('Audit Logging Integration', () => {
let app: INestApplication;
@@ -663,14 +663,13 @@ describe('Audit Logging Integration', () => {
---
## Summary
## Tóm Tắt
This architecture ensures:
**Separation of Concerns** - Audit logging as separate concern via event listener
**Non-Blocking** - Audit logging happens async, doesn't block main operation
**Reusability** - Single listener handles all admin actions
**Consistency** - Follows existing DDD/CQRS patterns
**Queryability** - Full audit trail with filtering capabilities
**Compliance** - Complete record of who did what and when
Kiến trúc này đảm bảo:
**Tách Biệt Mối Quan Tâm** - Ghi nhật ký kiểm tra là mối quan tâm riêng biệt thông qua event listener
**Không Chặn Luồng Chính** - Ghi nhật ký kiểm tra xảy ra bất đồng bộ, không chặn thao tác chính
**Khả Năng Tái Sử Dụng** - Một listener duy nhất xử lý tất cả các hành động admin
**Nhất Quán** - Tuân theo các mẫu DDD/CQRS hiện có
**Khả Năng Truy Vấn** - Lịch sử kiểm tra đầy đủ với khả năng lọc
**Tuân Thủ** - Hồ sơ đầy đủ về ai đã làm gì và khi nào