docs: dịch 22 file Markdown còn lại sang tiếng Việt có dấu (TEC-2881)
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 18s
CI / E2E Tests (push) Has been skipped
CodeQL Analysis / CodeQL (javascript-typescript) (push) Failing after 2m15s
Deploy / Build API Image (push) Failing after 28s
Deploy / Build Web Image (push) Failing after 16s
Deploy / Build AI Services Image (push) Failing after 17s
E2E Tests / Playwright E2E (push) Failing after 31s
Security Scanning / Dependency Audit (pnpm) (push) Failing after 3s
Security Scanning / Trivy Scan — API Image (push) Failing after 1m46s
Security Scanning / Trivy Scan — Web Image (push) Failing after 1m7s
Security Scanning / Trivy Scan — AI Services Image (push) Failing after 53s
Security Scanning / Trivy Filesystem Scan (push) Failing after 35s
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
Security Scanning / Security Gate (push) Failing after 0s
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 18s
CI / E2E Tests (push) Has been skipped
CodeQL Analysis / CodeQL (javascript-typescript) (push) Failing after 2m15s
Deploy / Build API Image (push) Failing after 28s
Deploy / Build Web Image (push) Failing after 16s
Deploy / Build AI Services Image (push) Failing after 17s
E2E Tests / Playwright E2E (push) Failing after 31s
Security Scanning / Dependency Audit (pnpm) (push) Failing after 3s
Security Scanning / Trivy Scan — API Image (push) Failing after 1m46s
Security Scanning / Trivy Scan — Web Image (push) Failing after 1m7s
Security Scanning / Trivy Scan — AI Services Image (push) Failing after 53s
Security Scanning / Trivy Filesystem Scan (push) Failing after 35s
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
Security Scanning / Security Gate (push) Failing after 0s
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped
Hoàn tất đợt cuối của nhiệm vụ chuyển toàn bộ tài liệu sang tiếng Việt. Đã dịch 22 file `.md` còn sót (~9.7k dòng) — gồm RUNBOOK, audits, docs/architecture, docs/load-testing, libs READMEs và các quick references. Giữ nguyên code blocks, đường dẫn, identifier kỹ thuật, URL và biến môi trường. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
# GoodGo Platform API — K6 Load Testing Guide
|
||||
# GoodGo Platform API — Hướng Dẫn K6 Load Testing
|
||||
|
||||
## 🎯 Quick Summary
|
||||
## 🎯 Tóm Tắt Nhanh
|
||||
|
||||
**Base URL**: `http://localhost:3001/api/v1`
|
||||
**Node Version**: >= 22.0.0
|
||||
**Phiên bản Node**: >= 22.0.0
|
||||
**Testing Framework**: Playwright (E2E), Vitest (Unit)
|
||||
**No existing K6 or load testing setup found**
|
||||
**Chưa có thiết lập K6 hoặc load testing nào tồn tại**
|
||||
|
||||
---
|
||||
|
||||
## 📋 Project Structure
|
||||
## 📋 Cấu Trúc Dự Án
|
||||
|
||||
### Root Directory
|
||||
### Thư Mục Gốc
|
||||
```
|
||||
goodgo-platform/
|
||||
├── apps/api # NestJS backend (port 3001)
|
||||
@@ -25,7 +25,7 @@ goodgo-platform/
|
||||
└── playwright.config.ts # Playwright configuration
|
||||
```
|
||||
|
||||
### Key Scripts (package.json)
|
||||
### Các Script Chính (package.json)
|
||||
```bash
|
||||
pnpm dev # Start all apps (API :3001, Web :3000)
|
||||
pnpm test # Unit tests via Vitest (API only)
|
||||
@@ -39,11 +39,11 @@ pnpm typecheck # TypeScript checking
|
||||
|
||||
---
|
||||
|
||||
## 🏗️ API Module Structure
|
||||
## 🏗️ Cấu Trúc Module API
|
||||
|
||||
### API Base Architecture: `apps/api/src/modules/`
|
||||
### Kiến Trúc Cơ Sở API: `apps/api/src/modules/`
|
||||
|
||||
Each module follows DDD layers: `domain/` → `application/` → `infrastructure/` → `presentation/`
|
||||
Mỗi module tuân theo các tầng DDD: `domain/` → `application/` → `infrastructure/` → `presentation/`
|
||||
|
||||
```
|
||||
modules/
|
||||
@@ -64,22 +64,22 @@ modules/
|
||||
|
||||
---
|
||||
|
||||
## 🔐 AUTH MODULE
|
||||
## 🔐 MODULE AUTH
|
||||
|
||||
### Controllers & Endpoints
|
||||
|
||||
#### File: `apps/api/src/modules/auth/presentation/controllers/auth.controller.ts`
|
||||
|
||||
| Method | Endpoint | Rate Limit | Auth | Description |
|
||||
| Method | Endpoint | Rate Limit | Auth | Mô tả |
|
||||
|--------|----------|-----------|------|-------------|
|
||||
| POST | `/auth/register` | 5/hour | No | Register new user |
|
||||
| POST | `/auth/login` | 5/hour | LocalAuth | Login with phone + password |
|
||||
| POST | `/auth/refresh` | 5/hour | No | Refresh access token |
|
||||
| POST | `/auth/logout` | No limit | No | Clear auth cookies |
|
||||
| POST | `/auth/exchange-token` | No limit | No | Exchange OAuth tokens for cookies |
|
||||
| GET | `/auth/profile` | No limit | JWT | Get current user profile |
|
||||
| GET | `/auth/profile/agent` | No limit | JWT | Get agent profile for user |
|
||||
| PATCH | `/auth/kyc` | No limit | JWT+Admin | Verify user KYC (admin only) |
|
||||
| POST | `/auth/register` | 5/giờ | Không | Đăng ký người dùng mới |
|
||||
| POST | `/auth/login` | 5/giờ | LocalAuth | Đăng nhập bằng số điện thoại + mật khẩu |
|
||||
| POST | `/auth/refresh` | 5/giờ | Không | Làm mới access token |
|
||||
| POST | `/auth/logout` | Không giới hạn | Không | Xóa cookie xác thực |
|
||||
| POST | `/auth/exchange-token` | Không giới hạn | Không | Đổi OAuth token lấy cookie |
|
||||
| GET | `/auth/profile` | Không giới hạn | JWT | Lấy hồ sơ người dùng hiện tại |
|
||||
| GET | `/auth/profile/agent` | Không giới hạn | JWT | Lấy hồ sơ agent của người dùng |
|
||||
| PATCH | `/auth/kyc` | Không giới hạn | JWT+Admin | Xác minh KYC người dùng (chỉ admin) |
|
||||
|
||||
### DTOs
|
||||
|
||||
@@ -117,50 +117,50 @@ modules/
|
||||
}
|
||||
```
|
||||
|
||||
### Cookies & Authentication
|
||||
### Cookies & Xác Thực
|
||||
|
||||
**Access Token**:
|
||||
- Cookie: `access_token`
|
||||
- Max Age: 15 minutes (900s)
|
||||
- Max Age: 15 phút (900s)
|
||||
- HttpOnly: true
|
||||
- Secure: true (production only)
|
||||
- Secure: true (chỉ production)
|
||||
- SameSite: strict
|
||||
- Path: /
|
||||
|
||||
**Refresh Token**:
|
||||
- Cookie: `refresh_token`
|
||||
- Max Age: 30 days
|
||||
- Max Age: 30 ngày
|
||||
- HttpOnly: true
|
||||
- Secure: true (production only)
|
||||
- Secure: true (chỉ production)
|
||||
- SameSite: strict
|
||||
- Path: `/auth`
|
||||
|
||||
**Session Indicator**:
|
||||
**Chỉ Báo Phiên**:
|
||||
- Cookie: `goodgo_authenticated` = "1"
|
||||
- HttpOnly: false (visible to frontend)
|
||||
- HttpOnly: false (frontend nhìn thấy được)
|
||||
|
||||
### OAuth Support
|
||||
### Hỗ Trợ OAuth
|
||||
- Google OAuth 2.0
|
||||
- Zalo OAuth (Vietnamese platform)
|
||||
- Zalo OAuth (nền tảng Việt Nam)
|
||||
- Environment: `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET`, `ZALO_APP_ID`, `ZALO_APP_SECRET`
|
||||
|
||||
---
|
||||
|
||||
## 🏠 LISTINGS MODULE
|
||||
## 🏠 MODULE LISTINGS
|
||||
|
||||
### Controllers & Endpoints
|
||||
|
||||
#### File: `apps/api/src/modules/listings/presentation/controllers/listings.controller.ts`
|
||||
|
||||
| Method | Endpoint | Auth | Quota | Description |
|
||||
| Method | Endpoint | Auth | Quota | Mô tả |
|
||||
|--------|----------|------|-------|-------------|
|
||||
| POST | `/listings` | JWT | Yes | Create new listing |
|
||||
| GET | `/listings` | No | No | Search/filter listings (public) |
|
||||
| GET | `/listings/:id` | No | No | Get listing detail |
|
||||
| GET | `/listings/pending` | JWT+Admin | No | Get listings pending moderation |
|
||||
| PATCH | `/listings/:id/status` | JWT | No | Update listing status |
|
||||
| POST | `/listings/:id/media` | JWT | No | Upload photo/video |
|
||||
| PATCH | `/listings/:id/moderate` | JWT+Admin | No | Moderate a listing (admin) |
|
||||
| POST | `/listings` | JWT | Có | Tạo listing mới |
|
||||
| GET | `/listings` | Không | Không | Tìm kiếm/lọc listing (công khai) |
|
||||
| GET | `/listings/:id` | Không | Không | Lấy chi tiết listing |
|
||||
| GET | `/listings/pending` | JWT+Admin | Không | Lấy listing đang chờ kiểm duyệt |
|
||||
| PATCH | `/listings/:id/status` | JWT | Không | Cập nhật trạng thái listing |
|
||||
| POST | `/listings/:id/media` | JWT | Không | Tải lên ảnh/video |
|
||||
| PATCH | `/listings/:id/moderate` | JWT+Admin | Không | Kiểm duyệt listing (admin) |
|
||||
|
||||
### DTOs
|
||||
|
||||
@@ -233,10 +233,10 @@ modules/
|
||||
}
|
||||
```
|
||||
|
||||
### Response Structures
|
||||
### Cấu Trúc Phản Hồi
|
||||
|
||||
#### ListingDetailData
|
||||
Contains full listing information including:
|
||||
Chứa thông tin đầy đủ về listing bao gồm:
|
||||
- id, title, description
|
||||
- propertyType, transactionType
|
||||
- address, latitude, longitude, ward, district, city
|
||||
@@ -244,7 +244,7 @@ Contains full listing information including:
|
||||
- areaM2, usableAreaM2, bedrooms, bathrooms, floors
|
||||
- amenities, nearbyPOIs
|
||||
- legalStatus, yearBuilt, direction
|
||||
- mediaUrls (photos/videos)
|
||||
- mediaUrls (ảnh/video)
|
||||
- agentInfo
|
||||
- createdAt, updatedAt
|
||||
|
||||
@@ -261,19 +261,19 @@ Contains full listing information including:
|
||||
|
||||
---
|
||||
|
||||
## 💳 PAYMENTS MODULE
|
||||
## 💳 MODULE PAYMENTS
|
||||
|
||||
### Controllers & Endpoints
|
||||
|
||||
#### File: `apps/api/src/modules/payments/presentation/controllers/payments.controller.ts`
|
||||
|
||||
| Method | Endpoint | Auth | Rate Limit | Description |
|
||||
| Method | Endpoint | Auth | Rate Limit | Mô tả |
|
||||
|--------|----------|------|-----------|-------------|
|
||||
| POST | `/payments` | JWT | No | Create payment |
|
||||
| GET | `/payments` | JWT | No | List user transactions |
|
||||
| GET | `/payments/:id` | JWT | No | Get payment status |
|
||||
| POST | `/payments/callback/:provider` | No | 20/min | Handle payment callback (webhook) |
|
||||
| POST | `/payments/:id/refund` | JWT+Admin | No | Refund payment (admin) |
|
||||
| POST | `/payments` | JWT | Không | Tạo thanh toán |
|
||||
| GET | `/payments` | JWT | Không | Liệt kê giao dịch của người dùng |
|
||||
| GET | `/payments/:id` | JWT | Không | Lấy trạng thái thanh toán |
|
||||
| POST | `/payments/callback/:provider` | Không | 20/phút | Xử lý callback thanh toán (webhook) |
|
||||
| POST | `/payments/:id/refund` | JWT+Admin | Không | Hoàn tiền (admin) |
|
||||
|
||||
### DTOs
|
||||
|
||||
@@ -306,47 +306,47 @@ Contains full listing information including:
|
||||
}
|
||||
```
|
||||
|
||||
### Payment Providers
|
||||
### Nhà Cung Cấp Thanh Toán
|
||||
|
||||
- **VNPay** (Primary for Vietnam)
|
||||
- **VNPay** (Chính cho Việt Nam)
|
||||
- Environment: `VNPAY_TMN_CODE`, `VNPAY_HASH_SECRET`
|
||||
- Sandbox: `https://sandbox.vnpayment.vn/paymentv2/vpcpay.html`
|
||||
- API: `https://sandbox.vnpayment.vn/merchant_webapi/api/transaction`
|
||||
|
||||
- **MoMo** (Mobile wallet)
|
||||
- **MoMo** (Ví di động)
|
||||
- Environment: `MOMO_PARTNER_CODE`, `MOMO_ACCESS_KEY`, `MOMO_SECRET_KEY`
|
||||
- Endpoint: `https://test-payment.momo.vn/v2/gateway/api`
|
||||
|
||||
- **ZaloPay** (Zalo integrated)
|
||||
- **ZaloPay** (Tích hợp Zalo)
|
||||
- Environment: `ZALOPAY_APP_ID`, `ZALOPAY_KEY1`, `ZALOPAY_KEY2`
|
||||
- Endpoint: `https://sb-openapi.zalopay.vn/v2`
|
||||
|
||||
### Callback Processing
|
||||
### Xử Lý Callback
|
||||
|
||||
**Webhook URL Pattern**: `/payments/callback/{provider}`
|
||||
**Mẫu URL Webhook**: `/payments/callback/{provider}`
|
||||
|
||||
Supports both:
|
||||
Hỗ trợ cả:
|
||||
- Query parameters (VNPay)
|
||||
- Request body (MoMo, ZaloPay)
|
||||
- Merged data handling internally
|
||||
- Xử lý dữ liệu hợp nhất nội bộ
|
||||
|
||||
---
|
||||
|
||||
## 🔍 SEARCH MODULE
|
||||
## 🔍 MODULE SEARCH
|
||||
|
||||
### Controllers & Endpoints
|
||||
|
||||
#### File: `apps/api/src/modules/search/presentation/controllers/search.controller.ts`
|
||||
|
||||
| Method | Endpoint | Auth | Description |
|
||||
| Method | Endpoint | Auth | Mô tả |
|
||||
|--------|----------|------|-------------|
|
||||
| GET | `/search` | No | Full-text search (public) |
|
||||
| GET | `/search/geo` | No | Geographic radius search (public) |
|
||||
| POST | `/search/reindex` | JWT+Admin | Reindex all properties (admin) |
|
||||
| GET | `/search` | Không | Tìm kiếm full-text (công khai) |
|
||||
| GET | `/search/geo` | Không | Tìm kiếm theo bán kính địa lý (công khai) |
|
||||
| POST | `/search/reindex` | JWT+Admin | Lập chỉ mục lại tất cả bất động sản (admin) |
|
||||
|
||||
### DTOs
|
||||
|
||||
#### SearchPropertiesDto (Full-text search)
|
||||
#### SearchPropertiesDto (Tìm kiếm full-text)
|
||||
```typescript
|
||||
{
|
||||
q?: string, // Free-text query, e.g., 'chung cu quan 7'
|
||||
@@ -365,7 +365,7 @@ Supports both:
|
||||
}
|
||||
```
|
||||
|
||||
#### GeoSearchDto (Geographic search)
|
||||
#### GeoSearchDto (Tìm kiếm địa lý)
|
||||
```typescript
|
||||
{
|
||||
lat: number, // Latitude, -90 to 90
|
||||
@@ -383,11 +383,11 @@ Supports both:
|
||||
|
||||
### Search Engine
|
||||
|
||||
**Typesense** integration for fast full-text & faceted search
|
||||
Tích hợp **Typesense** cho tìm kiếm full-text & faceted nhanh
|
||||
- Environment: `TYPESENSE_HOST`, `TYPESENSE_PORT`, `TYPESENSE_API_KEY`
|
||||
- Default: `http://localhost:8108`
|
||||
- Mặc định: `http://localhost:8108`
|
||||
|
||||
### Response Structure
|
||||
### Cấu Trúc Phản Hồi
|
||||
|
||||
#### SearchResult
|
||||
```typescript
|
||||
@@ -409,7 +409,7 @@ Supports both:
|
||||
|
||||
## 🗄️ Database & Environment
|
||||
|
||||
### PostgreSQL with PostGIS
|
||||
### PostgreSQL với PostGIS
|
||||
|
||||
```
|
||||
DB_HOST=localhost
|
||||
@@ -426,7 +426,7 @@ DATABASE_URL=postgresql://goodgo:password@localhost:5432/goodgo?schema=public
|
||||
REDIS_URL=redis://localhost:6379
|
||||
```
|
||||
|
||||
### Key Environment Variables
|
||||
### Các Biến Môi Trường Chính
|
||||
|
||||
```bash
|
||||
# JWT Secrets (REQUIRED)
|
||||
@@ -472,9 +472,9 @@ LOG_LEVEL=info
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Existing Test Setup
|
||||
## 🧪 Thiết Lập Test Hiện Có
|
||||
|
||||
### Playwright Configuration
|
||||
### Cấu Hình Playwright
|
||||
|
||||
**File**: `playwright.config.ts`
|
||||
|
||||
@@ -490,7 +490,7 @@ Projects:
|
||||
baseURL: http://localhost:3000
|
||||
```
|
||||
|
||||
### Playwright Scripts
|
||||
### Các Script Playwright
|
||||
|
||||
```bash
|
||||
pnpm test:e2e # Run all E2E tests
|
||||
@@ -499,14 +499,14 @@ pnpm test:e2e:web # Web tests only
|
||||
pnpm test:e2e:report # Show HTML report
|
||||
```
|
||||
|
||||
### Test Database
|
||||
### Database Test
|
||||
|
||||
- CI uses `goodgo_test` database
|
||||
- Local uses `.env.test` for test database URL
|
||||
- Migrations & seed run in `global-setup.ts`
|
||||
- Cleanup in `global-teardown.ts`
|
||||
- CI sử dụng database `goodgo_test`
|
||||
- Local sử dụng `.env.test` cho URL database test
|
||||
- Migration & seed chạy trong `global-setup.ts`
|
||||
- Dọn dẹp trong `global-teardown.ts`
|
||||
|
||||
### Example E2E Test
|
||||
### Ví Dụ E2E Test
|
||||
|
||||
**File**: `e2e/api/auth-register.spec.ts`
|
||||
|
||||
@@ -536,51 +536,51 @@ pnpm test:integration # Integration tests
|
||||
|
||||
---
|
||||
|
||||
## 🔄 CI/CD Setup
|
||||
## 🔄 Thiết Lập CI/CD
|
||||
|
||||
### GitHub Actions Workflows
|
||||
### Workflow GitHub Actions
|
||||
|
||||
#### `ci.yml` - Lint → Typecheck → Test → Build
|
||||
- Runs on: `push main` and `pull_request`
|
||||
- Chạy khi: `push main` và `pull_request`
|
||||
- Services: PostgreSQL 16 + PostGIS
|
||||
- Steps: lint → typecheck → test → build
|
||||
- Các bước: lint → typecheck → test → build
|
||||
|
||||
#### `e2e.yml` - Playwright E2E Tests
|
||||
- Runs on: `push main` and `pull_request`
|
||||
- Chạy khi: `push main` và `pull_request`
|
||||
- Services:
|
||||
- PostgreSQL 16 + PostGIS
|
||||
- Redis 7
|
||||
- Typesense 27.1
|
||||
- MinIO (S3-compatible storage)
|
||||
- MinIO (lưu trữ tương thích S3)
|
||||
- Artifacts: HTML report + traces
|
||||
|
||||
#### `security.yml` - Code Security
|
||||
- Dependency scanning
|
||||
- SAST analysis
|
||||
#### `security.yml` - Bảo Mật Mã Nguồn
|
||||
- Quét dependency
|
||||
- Phân tích SAST
|
||||
|
||||
#### `deploy.yml` - Production Deployment
|
||||
- Docker builds
|
||||
- Registry push
|
||||
- Deployment orchestration
|
||||
#### `deploy.yml` - Triển Khai Production
|
||||
- Build Docker
|
||||
- Push registry
|
||||
- Điều phối triển khai
|
||||
|
||||
---
|
||||
|
||||
## 📊 Architecture Patterns
|
||||
## 📊 Mẫu Kiến Trúc
|
||||
|
||||
### NestJS CQRS Pattern
|
||||
### Mẫu CQRS NestJS
|
||||
|
||||
Each module uses:
|
||||
- **Commands** (Write operations)
|
||||
Mỗi module sử dụng:
|
||||
- **Commands** (Thao tác ghi)
|
||||
- `CommandBus.execute(command)`
|
||||
- Located in `application/commands/`
|
||||
- Handlers in `application/commands/{command}/`
|
||||
- Đặt trong `application/commands/`
|
||||
- Handlers trong `application/commands/{command}/`
|
||||
|
||||
- **Queries** (Read operations)
|
||||
- **Queries** (Thao tác đọc)
|
||||
- `QueryBus.execute(query)`
|
||||
- Located in `application/queries/`
|
||||
- Handlers in `application/queries/{query}/`
|
||||
- Đặt trong `application/queries/`
|
||||
- Handlers trong `application/queries/{query}/`
|
||||
|
||||
Example:
|
||||
Ví dụ:
|
||||
```typescript
|
||||
// In controller
|
||||
const result = await this.commandBus.execute(
|
||||
@@ -594,17 +594,17 @@ const profile = await this.queryBus.execute(
|
||||
|
||||
### Guards & Interceptors
|
||||
|
||||
- `JwtAuthGuard` - Validates JWT token
|
||||
- `LocalAuthGuard` - Email/password validation
|
||||
- `RolesGuard` - Role-based access control
|
||||
- `QuotaGuard` - Subscription quota enforcement
|
||||
- `FileValidationPipe` - File upload validation
|
||||
- `JwtAuthGuard` - Xác thực JWT token
|
||||
- `LocalAuthGuard` - Xác thực email/mật khẩu
|
||||
- `RolesGuard` - Kiểm soát truy cập dựa trên vai trò
|
||||
- `QuotaGuard` - Thi hành hạn ngạch subscription
|
||||
- `FileValidationPipe` - Xác thực file upload
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Starting the API
|
||||
## 🚀 Khởi Động API
|
||||
|
||||
### Local Development
|
||||
### Phát Triển Cục Bộ
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
@@ -627,7 +627,7 @@ pnpm dev
|
||||
# Swagger UI: http://localhost:3001/api/v1/docs
|
||||
```
|
||||
|
||||
### With Docker
|
||||
### Với Docker
|
||||
|
||||
```bash
|
||||
docker-compose up
|
||||
@@ -636,37 +636,37 @@ docker-compose up
|
||||
|
||||
---
|
||||
|
||||
## 🎯 K6 Load Testing Recommendations
|
||||
## 🎯 Khuyến Nghị K6 Load Testing
|
||||
|
||||
### Key Endpoints to Test
|
||||
### Các Endpoint Chính Cần Test
|
||||
|
||||
1. **Authentication** (High priority)
|
||||
1. **Authentication** (Ưu tiên cao)
|
||||
- Register: `POST /auth/register`
|
||||
- Login: `POST /auth/login`
|
||||
- Refresh: `POST /auth/refresh`
|
||||
- Profile: `GET /auth/profile` (authenticated)
|
||||
- Profile: `GET /auth/profile` (đã xác thực)
|
||||
|
||||
2. **Listings** (High priority)
|
||||
- Create: `POST /listings` (quota-gated)
|
||||
- Search: `GET /listings` (public, high volume)
|
||||
- Detail: `GET /listings/:id` (public, high volume)
|
||||
2. **Listings** (Ưu tiên cao)
|
||||
- Create: `POST /listings` (giới hạn quota)
|
||||
- Search: `GET /listings` (công khai, lưu lượng cao)
|
||||
- Detail: `GET /listings/:id` (công khai, lưu lượng cao)
|
||||
|
||||
3. **Search** (High priority)
|
||||
- Full-text: `GET /search?q=...` (public, high volume)
|
||||
- Geo: `GET /search/geo?lat=...&lng=...` (public, high volume)
|
||||
3. **Search** (Ưu tiên cao)
|
||||
- Full-text: `GET /search?q=...` (công khai, lưu lượng cao)
|
||||
- Geo: `GET /search/geo?lat=...&lng=...` (công khai, lưu lượng cao)
|
||||
|
||||
4. **Payments** (Medium priority)
|
||||
- Create: `POST /payments` (authenticated)
|
||||
- List: `GET /payments` (authenticated)
|
||||
- Webhook: `POST /payments/callback/:provider` (unthrottled)
|
||||
4. **Payments** (Ưu tiên trung bình)
|
||||
- Create: `POST /payments` (đã xác thực)
|
||||
- List: `GET /payments` (đã xác thực)
|
||||
- Webhook: `POST /payments/callback/:provider` (không giới hạn throttle)
|
||||
|
||||
5. **Admin Endpoints** (Medium priority, restricted)
|
||||
- Moderate listings: `PATCH /listings/:id/moderate`
|
||||
- List pending: `GET /listings/pending`
|
||||
- Verify KYC: `PATCH /auth/kyc`
|
||||
5. **Endpoint Admin** (Ưu tiên trung bình, hạn chế)
|
||||
- Kiểm duyệt listing: `PATCH /listings/:id/moderate`
|
||||
- Liệt kê pending: `GET /listings/pending`
|
||||
- Xác minh KYC: `PATCH /auth/kyc`
|
||||
- Reindex: `POST /search/reindex`
|
||||
|
||||
### K6 Script Structure
|
||||
### Cấu Trúc Script K6
|
||||
|
||||
```javascript
|
||||
import http from 'k6/http';
|
||||
@@ -692,16 +692,16 @@ export default function() {
|
||||
}
|
||||
```
|
||||
|
||||
### Data Generation Tips
|
||||
### Mẹo Tạo Dữ Liệu
|
||||
|
||||
- Use test fixture users from Playwright tests
|
||||
- Leverage Prisma seed data (districts, property types)
|
||||
- Generate realistic search queries
|
||||
- Test with various geo coordinates (Ho Chi Minh City: ~10.77°N, 106.70°E)
|
||||
- Sử dụng test fixture user từ Playwright tests
|
||||
- Tận dụng dữ liệu Prisma seed (quận, loại bất động sản)
|
||||
- Tạo các truy vấn tìm kiếm thực tế
|
||||
- Test với các tọa độ địa lý khác nhau (TP.HCM: ~10.77°N, 106.70°E)
|
||||
|
||||
---
|
||||
|
||||
## 📁 File Locations Quick Reference
|
||||
## 📁 Tham Khảo Nhanh Vị Trí File
|
||||
|
||||
```
|
||||
apps/api/
|
||||
@@ -768,38 +768,37 @@ playwright.config.ts # Playwright config
|
||||
|
||||
---
|
||||
|
||||
## 🔗 Useful Links & References
|
||||
## 🔗 Liên Kết & Tham Khảo Hữu Ích
|
||||
|
||||
- **API Swagger Docs**: `http://localhost:3001/api/v1/docs`
|
||||
- **Project Root Docs**: `CLAUDE.md`
|
||||
- **Existing Analysis**: `CODEBASE_ANALYSIS.md`, `EXPLORATION_REPORT.md`
|
||||
- **Frontend Docs**: `docs/audits/FRONTEND_EXPLORATION.md`
|
||||
- **Tài Liệu Gốc Dự Án**: `CLAUDE.md`
|
||||
- **Phân Tích Hiện Có**: `CODEBASE_ANALYSIS.md`, `EXPLORATION_REPORT.md`
|
||||
- **Tài Liệu Frontend**: `docs/audits/FRONTEND_EXPLORATION.md`
|
||||
|
||||
---
|
||||
|
||||
## ✅ Summary for K6 Implementation
|
||||
## ✅ Tóm Tắt Triển Khai K6
|
||||
|
||||
**No existing K6 setup** — you have a clean slate!
|
||||
**Chưa có thiết lập K6 nào** — bạn có một khởi đầu hoàn toàn mới!
|
||||
|
||||
**Key endpoints** identified across:
|
||||
**Các endpoint chính** được xác định trên các module:
|
||||
- Auth (register, login, refresh, profile)
|
||||
- Listings (create, search, detail, moderate)
|
||||
- Search (full-text, geo)
|
||||
- Payments (create, callback, list, refund)
|
||||
- Admin (moderate, KYC, reindex)
|
||||
|
||||
**Rate limits** to consider:
|
||||
- Auth: 5/hour per endpoint
|
||||
- Payments callback: 20/min
|
||||
- Others: No limit (except quota guards on create operations)
|
||||
**Rate limit** cần xem xét:
|
||||
- Auth: 5/giờ mỗi endpoint
|
||||
- Payments callback: 20/phút
|
||||
- Khác: Không giới hạn (trừ quota guard cho thao tác create)
|
||||
|
||||
**Infrastructure ready**:
|
||||
- Turbo monorepo for dependency management
|
||||
- PostgreSQL + PostGIS for spatial data
|
||||
- Typesense for search indexing
|
||||
- Redis for caching
|
||||
- MinIO for media storage
|
||||
- Prometheus metrics endpoint
|
||||
|
||||
**Tests can be integrated** into CI/CD pipeline via `.github/workflows/` (suggested: new `load-test.yml`)
|
||||
**Hạ tầng sẵn sàng**:
|
||||
- Turbo monorepo cho quản lý dependency
|
||||
- PostgreSQL + PostGIS cho dữ liệu không gian
|
||||
- Typesense cho lập chỉ mục tìm kiếm
|
||||
- Redis cho caching
|
||||
- MinIO cho lưu trữ media
|
||||
- Endpoint Prometheus metrics
|
||||
|
||||
**Tests có thể được tích hợp** vào CI/CD pipeline qua `.github/workflows/` (đề xuất: `load-test.yml` mới)
|
||||
|
||||
Reference in New Issue
Block a user