Giao diện
Tham chiếu API
Endpoints
| Endpoint | Method | Mô tả |
|---|---|---|
{collection}:export | POST | Export XLSX (override — tự chọn sync/async theo ngưỡng) |
{collection}:exportAttachments | POST | Export tất cả attachments thành ZIP (luôn async) |
asyncTasks:fetchFile/{taskId} | GET | Tải file kết quả từ async task |
{collection}:export (override)
Plugin override handler export của plugin cơ bản. Luồng xử lý:
- Server đếm số bản ghi phù hợp filter.
- So sánh với ngưỡng
EXPORT_AUTO_MODE_THRESHOLD. - Nếu dưới ngưỡng → export đồng bộ, trả binary XLSX ngay.
- Nếu vượt ngưỡng → tạo async job topic
exportXlsxPro, trả job ID về client.
Request params: giống endpoint export cơ bản (columns, filter, sort, appends, title).
{collection}:exportAttachments
Method: POST
Xuất tất cả file đính kèm (attachment fields) của các bản ghi khớp filter thành archive ZIP. Luôn chạy ở chế độ async.
Request params: filter, fields (attachment field names).
Response: Job ID (async task).
asyncTasks:fetchFile/{taskId}
Method: GET
Tải file kết quả (XLSX hoặc ZIP) từ async task đã hoàn tất.
Response: Binary file stream.
Job topics
| Topic | Mô tả |
|---|---|
exportXlsxPro | Job xuất dữ liệu ra file XLSX (async mode) |
exportAttachments | Job xuất file đính kèm ra ZIP |
CLI commands
| Command | Mô tả |
|---|---|
export-xlsx-command | Chạy export XLSX từ command line (hữu ích cho batch processing) |
export-attachment-command | Chạy export attachments từ command line |
Biến môi trường
| Biến | Mặc định | Mô tả |
|---|---|---|
EXPORT_AUTO_MODE_THRESHOLD | (hệ thống) | Ngưỡng số bản ghi để tự chuyển sang async mode |