2025-05-02 15:12:18 +07:00

74 lines
2.4 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Thông số kỹ thuật
## File: Zee.md
### Function:
#### Description:
#### Logic:
#### Input:
#### Output:
#### Error Handling:
#### Preconditions:
#### Postconditions:
#### Internal Dependencies:
## Core Technologies
- **Backend**: Go
- **Database**: PostgreSQL
- **Frontend**: HTMX
- **Containerization**: Docker
- **Cloud Hosting**: VPS Storage
## 1. Yêu cầu hệ thống
- **Quy mô dự kiến**: 20,000+ người tham gia, 5,000 lượt matching
- **Hiệu suất**: Xử lý đồng thời 100+ request/s
- **Độ trễ API**: <500ms cho 95% request
- **Thời gian matching**: <5 phút sau khi đăng
## 2. API Endpoints
### Public APIs
- `GET /campaign/config` - Lấy cấu hình campaign
- `POST /profiles` - Đăng profile mới
- `POST /photos/upload` - Upload ảnh
- `POST /results/access` - Truy cập kết quả bằng access code
- `GET /results/{token}` - Xem kết quả matching
- `POST /results/select` - Chọn match
- `POST /results/decline` - Từ chối match
### Admin APIs
- `POST /admin/auth/login` - Đăng nhập admin
- `GET /admin/reports/summary` - Báo cáo tổng quan
- `GET /admin/campaign/status` - Trạng thái campaign
- `POST /admin/campaign/actions/{action}` - Thực hiện action campaign
- `GET/POST/PUT/DELETE /admin/gifts` - Quản quà tặng
- `GET /admin/giveaway/allocations` - Danh sách phân bổ quà
- `POST /admin/giveaway/actions/run-draw` - Chạy quay thưởng
## 3. Transaction Workflows
1. **UserRegistrationTransaction**: Đăng Tạo Profile Gửi email xác nhận
2. **MatchingTransaction**: Chạy matching Tạo MatchOutcome
3. **ResultNotificationTransaction**: Gửi thông báo kết quả
4. **MatchSelectionTransaction**: Xử lựa chọn/từ chối
5. **GiftAllocationTransaction**: Quay thưởng Tạo GiftAllocation
6. **GiftNotificationTransaction**: Gửi thông báo trúng thưởng
## Error Handling Specification
### Error Types:
- **UserInputError**: Lỗi dữ liệu đầu vào (HTTP 400)
- **NotFoundError**: Tài nguyên không tồn tại (HTTP 404)
- **UnauthorizedError**: Truy cập không được phép (HTTP 401)
- **InternalServerError**: Lỗi hệ thống (HTTP 500)
### Logging Requirements:
- Tất cả lỗi phải được ghi lại với context đầy đủ
- Sử dụng structured logging với zap
## Overall Flow:
```mermaid
sequenceDiagram
 
```
###
---