Tóm tắt endpoint
| Method | Path | Mô tả | Auth | Rate limit |
|---|
| POST | /api/v1/admin/login | Admin login. | Public | Global apiLimiter; một số flow có Redis/domain limit riêng. |
| GET | /api/v1/admin/users | List users. | Bearer ADMIN | Global apiLimiter; một số flow có Redis/domain limit riêng. |
| PATCH | /api/v1/admin/users/:userId/ban | Ban user. | Bearer ADMIN | Global apiLimiter; một số flow có Redis/domain limit riêng. |
| GET | /api/v1/admin/reports | List reports. | Bearer ADMIN | Global apiLimiter; một số flow có Redis/domain limit riêng. |
| PATCH | /api/v1/admin/reports/:reportId | Moderate report. [CẦN XÁC NHẬN] service còn TODO. | Bearer ADMIN | Global apiLimiter; một số flow có Redis/domain limit riêng. |
| GET | /api/v1/admin/hashtags/trending | Trending hashtags. | Bearer ADMIN | Global apiLimiter; một số flow có Redis/domain limit riêng. |
| GET | /api/v1/admin/stats | Admin stats. | Bearer ADMIN | Global apiLimiter; một số flow có Redis/domain limit riêng. |
| POST | /api/v1/admin/daily-quests | Create daily quest. | Bearer ADMIN | Global apiLimiter; một số flow có Redis/domain limit riêng. |
| GET | /api/v1/admin/daily-quests/actions | Quest actions. | Bearer ADMIN | Global apiLimiter; một số flow có Redis/domain limit riêng. |
| GET | /api/v1/admin/daily-quests | List daily quests. | Bearer ADMIN | Global apiLimiter; một số flow có Redis/domain limit riêng. |
| PATCH | /api/v1/admin/daily-quests/:code/disable | Disable quest. | Bearer ADMIN | Global apiLimiter; một số flow có Redis/domain limit riêng. |
POST /api/v1/admin/login
POST Auth varies apiLimiter
Endpoint này dùng để admin login. Gọi endpoint này khi client cần thao tác đúng phạm vi module admin.
Request
| Header | Giá trị | Bắt buộc | Mô tả |
|---|
| Authorization | Bearer accessToken | Không/Tùy route | JWT access token nếu route protected |
| x-refresh-token | raw refresh token | Không | Refresh token header theo middleware |
| Parameter | Kiểu | Mô tả | Ví dụ |
|---|
| path params | string | Các phần :publicId, :username, :code nếu path có | cm123 |
| query params | string/number | take, after, page, limit hoặc module-specific query | take=20 |
| Field | Kiểu | Bắt buộc | Validation | Mô tả | Ví dụ giá trị |
|---|
| body | object | Tùy endpoint | Theo DTO Zod nếu route có validate() | Payload nghiệp vụ của endpoint | {"content":"Hello"} |
Ví dụ request
curl -X POST http://localhost:3302/api/v1/admin/login \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json"
Response
200/201 — Thành công
| Field | Kiểu | Luôn có? | Mô tả |
|---|
| success | boolean | Có | true khi request thành công |
| message | string | Không | Một số controller truyền message |
| data | object/array | Tùy endpoint | Dữ liệu trả về từ service |
| pagination | object | Với list | Cursor/offset pagination |
{
"success": true,
"data": {
"module": "admin",
"endpoint": "/api/v1/admin/login"
}
}
Lỗi có thể xảy ra
| HTTP Status | Error Code | Khi nào xảy ra | Cách xử lý ở client |
|---|
| 401 | UNAUTHORIZED | Unauthorized | Login lại hoặc refresh token. |
| 400 | VALIDATION_FAILED | Validation failed | Client sửa field sai. |
| 404 | NOT_FOUND | Resource not found | Refresh dữ liệu. |
| 403 | FORBIDDEN | Forbidden | Ẩn action trong UI. |
| 500 | INTERNAL_SERVER_ERROR | External dependency fail | On-call kiểm tra provider/log. |
Ví dụ lỗi
{
"success": false,
"message": "Validation failed"
}
Ghi chú
- Endpoint đi qua global
apiLimiter. - Idempotency không được đảm bảo trừ khi service có upsert/unique constraint riêng.
- permission.ts trống, admin route dùng checkRole riêng.
GET /api/v1/admin/users
GET Auth required apiLimiter
Endpoint này dùng để list users. Gọi endpoint này khi client cần thao tác đúng phạm vi module admin.
Request
| Header | Giá trị | Bắt buộc | Mô tả |
|---|
| Authorization | Bearer accessToken | Có | JWT access token nếu route protected |
| x-refresh-token | raw refresh token | Không | Refresh token header theo middleware |
| Parameter | Kiểu | Mô tả | Ví dụ |
|---|
| path params | string | Các phần :publicId, :username, :code nếu path có | cm123 |
| query params | string/number | take, after, page, limit hoặc module-specific query | take=20 |
| Field | Kiểu | Bắt buộc | Validation | Mô tả | Ví dụ giá trị |
|---|
| body | object | Không | Theo DTO Zod nếu route có validate() | Payload nghiệp vụ của endpoint | {"content":"Hello"} |
Ví dụ request
curl -X GET http://localhost:3302/api/v1/admin/users \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json"
Response
200/201 — Thành công
| Field | Kiểu | Luôn có? | Mô tả |
|---|
| success | boolean | Có | true khi request thành công |
| message | string | Không | Một số controller truyền message |
| data | object/array | Tùy endpoint | Dữ liệu trả về từ service |
| pagination | object | Với list | Cursor/offset pagination |
{
"success": true,
"data": {
"module": "admin",
"endpoint": "/api/v1/admin/users"
}
}
Lỗi có thể xảy ra
| HTTP Status | Error Code | Khi nào xảy ra | Cách xử lý ở client |
|---|
| 401 | UNAUTHORIZED | Unauthorized | Login lại hoặc refresh token. |
| 400 | VALIDATION_FAILED | Validation failed | Client sửa field sai. |
| 404 | NOT_FOUND | Resource not found | Refresh dữ liệu. |
| 403 | FORBIDDEN | Forbidden | Ẩn action trong UI. |
| 500 | INTERNAL_SERVER_ERROR | External dependency fail | On-call kiểm tra provider/log. |
Ví dụ lỗi
{
"success": false,
"message": "Validation failed"
}
Ghi chú
- Endpoint đi qua global
apiLimiter. - Idempotency không được đảm bảo trừ khi service có upsert/unique constraint riêng.
- permission.ts trống, admin route dùng checkRole riêng.
PATCH /api/v1/admin/users/:userId/ban
PATCH Auth required apiLimiter
Endpoint này dùng để ban user. Gọi endpoint này khi client cần thao tác đúng phạm vi module admin.
Request
| Header | Giá trị | Bắt buộc | Mô tả |
|---|
| Authorization | Bearer accessToken | Có | JWT access token nếu route protected |
| x-refresh-token | raw refresh token | Không | Refresh token header theo middleware |
| Parameter | Kiểu | Mô tả | Ví dụ |
|---|
| path params | string | Các phần :publicId, :username, :code nếu path có | cm123 |
| query params | string/number | take, after, page, limit hoặc module-specific query | take=20 |
| Field | Kiểu | Bắt buộc | Validation | Mô tả | Ví dụ giá trị |
|---|
| body | object | Tùy endpoint | Theo DTO Zod nếu route có validate() | Payload nghiệp vụ của endpoint | {"content":"Hello"} |
Ví dụ request
curl -X PATCH http://localhost:3302/api/v1/admin/users/user_123/ban \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json"
Response
200/201 — Thành công
| Field | Kiểu | Luôn có? | Mô tả |
|---|
| success | boolean | Có | true khi request thành công |
| message | string | Không | Một số controller truyền message |
| data | object/array | Tùy endpoint | Dữ liệu trả về từ service |
| pagination | object | Với list | Cursor/offset pagination |
{
"success": true,
"data": {
"module": "admin",
"endpoint": "/api/v1/admin/users/:userId/ban"
}
}
Lỗi có thể xảy ra
| HTTP Status | Error Code | Khi nào xảy ra | Cách xử lý ở client |
|---|
| 401 | UNAUTHORIZED | Unauthorized | Login lại hoặc refresh token. |
| 400 | VALIDATION_FAILED | Validation failed | Client sửa field sai. |
| 404 | NOT_FOUND | Resource not found | Refresh dữ liệu. |
| 403 | FORBIDDEN | Forbidden | Ẩn action trong UI. |
| 500 | INTERNAL_SERVER_ERROR | External dependency fail | On-call kiểm tra provider/log. |
Ví dụ lỗi
{
"success": false,
"message": "Validation failed"
}
Ghi chú
- Endpoint đi qua global
apiLimiter. - Idempotency không được đảm bảo trừ khi service có upsert/unique constraint riêng.
- permission.ts trống, admin route dùng checkRole riêng.
GET /api/v1/admin/reports
GET Auth required apiLimiter
Endpoint này dùng để list reports. Gọi endpoint này khi client cần thao tác đúng phạm vi module admin.
Request
| Header | Giá trị | Bắt buộc | Mô tả |
|---|
| Authorization | Bearer accessToken | Có | JWT access token nếu route protected |
| x-refresh-token | raw refresh token | Không | Refresh token header theo middleware |
| Parameter | Kiểu | Mô tả | Ví dụ |
|---|
| path params | string | Các phần :publicId, :username, :code nếu path có | cm123 |
| query params | string/number | take, after, page, limit hoặc module-specific query | take=20 |
| Field | Kiểu | Bắt buộc | Validation | Mô tả | Ví dụ giá trị |
|---|
| body | object | Không | Theo DTO Zod nếu route có validate() | Payload nghiệp vụ của endpoint | {"content":"Hello"} |
Ví dụ request
curl -X GET http://localhost:3302/api/v1/admin/reports \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json"
Response
200/201 — Thành công
| Field | Kiểu | Luôn có? | Mô tả |
|---|
| success | boolean | Có | true khi request thành công |
| message | string | Không | Một số controller truyền message |
| data | object/array | Tùy endpoint | Dữ liệu trả về từ service |
| pagination | object | Với list | Cursor/offset pagination |
{
"success": true,
"data": {
"module": "admin",
"endpoint": "/api/v1/admin/reports"
}
}
Lỗi có thể xảy ra
| HTTP Status | Error Code | Khi nào xảy ra | Cách xử lý ở client |
|---|
| 401 | UNAUTHORIZED | Unauthorized | Login lại hoặc refresh token. |
| 400 | VALIDATION_FAILED | Validation failed | Client sửa field sai. |
| 404 | NOT_FOUND | Resource not found | Refresh dữ liệu. |
| 403 | FORBIDDEN | Forbidden | Ẩn action trong UI. |
| 500 | INTERNAL_SERVER_ERROR | External dependency fail | On-call kiểm tra provider/log. |
Ví dụ lỗi
{
"success": false,
"message": "Validation failed"
}
Ghi chú
- Endpoint đi qua global
apiLimiter. - Idempotency không được đảm bảo trừ khi service có upsert/unique constraint riêng.
- permission.ts trống, admin route dùng checkRole riêng.
PATCH /api/v1/admin/reports/:reportId
PATCH Auth required apiLimiter
Endpoint này dùng để moderate report. [CẦN XÁC NHẬN] service còn TODO. Gọi endpoint này khi client cần thao tác đúng phạm vi module admin.
Request
| Header | Giá trị | Bắt buộc | Mô tả |
|---|
| Authorization | Bearer accessToken | Có | JWT access token nếu route protected |
| x-refresh-token | raw refresh token | Không | Refresh token header theo middleware |
| Parameter | Kiểu | Mô tả | Ví dụ |
|---|
| path params | string | Các phần :publicId, :username, :code nếu path có | cm123 |
| query params | string/number | take, after, page, limit hoặc module-specific query | take=20 |
| Field | Kiểu | Bắt buộc | Validation | Mô tả | Ví dụ giá trị |
|---|
| body | object | Tùy endpoint | Theo DTO Zod nếu route có validate() | Payload nghiệp vụ của endpoint | {"content":"Hello"} |
Ví dụ request
curl -X PATCH http://localhost:3302/api/v1/admin/reports/report_123 \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json"
Response
200/201 — Thành công
| Field | Kiểu | Luôn có? | Mô tả |
|---|
| success | boolean | Có | true khi request thành công |
| message | string | Không | Một số controller truyền message |
| data | object/array | Tùy endpoint | Dữ liệu trả về từ service |
| pagination | object | Với list | Cursor/offset pagination |
{
"success": true,
"data": {
"module": "admin",
"endpoint": "/api/v1/admin/reports/:reportId"
}
}
Lỗi có thể xảy ra
| HTTP Status | Error Code | Khi nào xảy ra | Cách xử lý ở client |
|---|
| 401 | UNAUTHORIZED | Unauthorized | Login lại hoặc refresh token. |
| 400 | VALIDATION_FAILED | Validation failed | Client sửa field sai. |
| 404 | NOT_FOUND | Resource not found | Refresh dữ liệu. |
| 403 | FORBIDDEN | Forbidden | Ẩn action trong UI. |
| 500 | INTERNAL_SERVER_ERROR | External dependency fail | On-call kiểm tra provider/log. |
Ví dụ lỗi
{
"success": false,
"message": "Validation failed"
}
Ghi chú
- Endpoint đi qua global
apiLimiter. - Idempotency không được đảm bảo trừ khi service có upsert/unique constraint riêng.
- permission.ts trống, admin route dùng checkRole riêng.
GET /api/v1/admin/hashtags/trending
GET Auth required apiLimiter
Endpoint này dùng để trending hashtags. Gọi endpoint này khi client cần thao tác đúng phạm vi module admin.
Request
| Header | Giá trị | Bắt buộc | Mô tả |
|---|
| Authorization | Bearer accessToken | Có | JWT access token nếu route protected |
| x-refresh-token | raw refresh token | Không | Refresh token header theo middleware |
| Parameter | Kiểu | Mô tả | Ví dụ |
|---|
| path params | string | Các phần :publicId, :username, :code nếu path có | cm123 |
| query params | string/number | take, after, page, limit hoặc module-specific query | take=20 |
| Field | Kiểu | Bắt buộc | Validation | Mô tả | Ví dụ giá trị |
|---|
| body | object | Không | Theo DTO Zod nếu route có validate() | Payload nghiệp vụ của endpoint | {"content":"Hello"} |
Ví dụ request
curl -X GET http://localhost:3302/api/v1/admin/hashtags/trending \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json"
Response
200/201 — Thành công
| Field | Kiểu | Luôn có? | Mô tả |
|---|
| success | boolean | Có | true khi request thành công |
| message | string | Không | Một số controller truyền message |
| data | object/array | Tùy endpoint | Dữ liệu trả về từ service |
| pagination | object | Với list | Cursor/offset pagination |
{
"success": true,
"data": {
"module": "admin",
"endpoint": "/api/v1/admin/hashtags/trending"
}
}
Lỗi có thể xảy ra
| HTTP Status | Error Code | Khi nào xảy ra | Cách xử lý ở client |
|---|
| 401 | UNAUTHORIZED | Unauthorized | Login lại hoặc refresh token. |
| 400 | VALIDATION_FAILED | Validation failed | Client sửa field sai. |
| 404 | NOT_FOUND | Resource not found | Refresh dữ liệu. |
| 403 | FORBIDDEN | Forbidden | Ẩn action trong UI. |
| 500 | INTERNAL_SERVER_ERROR | External dependency fail | On-call kiểm tra provider/log. |
Ví dụ lỗi
{
"success": false,
"message": "Validation failed"
}
Ghi chú
- Endpoint đi qua global
apiLimiter. - Idempotency không được đảm bảo trừ khi service có upsert/unique constraint riêng.
- permission.ts trống, admin route dùng checkRole riêng.
GET /api/v1/admin/stats
GET Auth required apiLimiter
Endpoint này dùng để admin stats. Gọi endpoint này khi client cần thao tác đúng phạm vi module admin.
Request
| Header | Giá trị | Bắt buộc | Mô tả |
|---|
| Authorization | Bearer accessToken | Có | JWT access token nếu route protected |
| x-refresh-token | raw refresh token | Không | Refresh token header theo middleware |
| Parameter | Kiểu | Mô tả | Ví dụ |
|---|
| path params | string | Các phần :publicId, :username, :code nếu path có | cm123 |
| query params | string/number | take, after, page, limit hoặc module-specific query | take=20 |
| Field | Kiểu | Bắt buộc | Validation | Mô tả | Ví dụ giá trị |
|---|
| body | object | Không | Theo DTO Zod nếu route có validate() | Payload nghiệp vụ của endpoint | {"content":"Hello"} |
Ví dụ request
curl -X GET http://localhost:3302/api/v1/admin/stats \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json"
Response
200/201 — Thành công
| Field | Kiểu | Luôn có? | Mô tả |
|---|
| success | boolean | Có | true khi request thành công |
| message | string | Không | Một số controller truyền message |
| data | object/array | Tùy endpoint | Dữ liệu trả về từ service |
| pagination | object | Với list | Cursor/offset pagination |
{
"success": true,
"data": {
"module": "admin",
"endpoint": "/api/v1/admin/stats"
}
}
Lỗi có thể xảy ra
| HTTP Status | Error Code | Khi nào xảy ra | Cách xử lý ở client |
|---|
| 401 | UNAUTHORIZED | Unauthorized | Login lại hoặc refresh token. |
| 400 | VALIDATION_FAILED | Validation failed | Client sửa field sai. |
| 404 | NOT_FOUND | Resource not found | Refresh dữ liệu. |
| 403 | FORBIDDEN | Forbidden | Ẩn action trong UI. |
| 500 | INTERNAL_SERVER_ERROR | External dependency fail | On-call kiểm tra provider/log. |
Ví dụ lỗi
{
"success": false,
"message": "Validation failed"
}
Ghi chú
- Endpoint đi qua global
apiLimiter. - Idempotency không được đảm bảo trừ khi service có upsert/unique constraint riêng.
- permission.ts trống, admin route dùng checkRole riêng.
POST /api/v1/admin/daily-quests
POST Auth required apiLimiter
Endpoint này dùng để create daily quest. Gọi endpoint này khi client cần thao tác đúng phạm vi module admin.
Request
| Header | Giá trị | Bắt buộc | Mô tả |
|---|
| Authorization | Bearer accessToken | Có | JWT access token nếu route protected |
| x-refresh-token | raw refresh token | Không | Refresh token header theo middleware |
| Parameter | Kiểu | Mô tả | Ví dụ |
|---|
| path params | string | Các phần :publicId, :username, :code nếu path có | cm123 |
| query params | string/number | take, after, page, limit hoặc module-specific query | take=20 |
| Field | Kiểu | Bắt buộc | Validation | Mô tả | Ví dụ giá trị |
|---|
| body | object | Tùy endpoint | Theo DTO Zod nếu route có validate() | Payload nghiệp vụ của endpoint | {"content":"Hello"} |
Ví dụ request
curl -X POST http://localhost:3302/api/v1/admin/daily-quests \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json"
Response
200/201 — Thành công
| Field | Kiểu | Luôn có? | Mô tả |
|---|
| success | boolean | Có | true khi request thành công |
| message | string | Không | Một số controller truyền message |
| data | object/array | Tùy endpoint | Dữ liệu trả về từ service |
| pagination | object | Với list | Cursor/offset pagination |
{
"success": true,
"data": {
"module": "admin",
"endpoint": "/api/v1/admin/daily-quests"
}
}
Lỗi có thể xảy ra
| HTTP Status | Error Code | Khi nào xảy ra | Cách xử lý ở client |
|---|
| 401 | UNAUTHORIZED | Unauthorized | Login lại hoặc refresh token. |
| 400 | VALIDATION_FAILED | Validation failed | Client sửa field sai. |
| 404 | NOT_FOUND | Resource not found | Refresh dữ liệu. |
| 403 | FORBIDDEN | Forbidden | Ẩn action trong UI. |
| 500 | INTERNAL_SERVER_ERROR | External dependency fail | On-call kiểm tra provider/log. |
Ví dụ lỗi
{
"success": false,
"message": "Validation failed"
}
Ghi chú
- Endpoint đi qua global
apiLimiter. - Idempotency không được đảm bảo trừ khi service có upsert/unique constraint riêng.
- permission.ts trống, admin route dùng checkRole riêng.
GET /api/v1/admin/daily-quests/actions
GET Auth required apiLimiter
Endpoint này dùng để quest actions. Gọi endpoint này khi client cần thao tác đúng phạm vi module admin.
Request
| Header | Giá trị | Bắt buộc | Mô tả |
|---|
| Authorization | Bearer accessToken | Có | JWT access token nếu route protected |
| x-refresh-token | raw refresh token | Không | Refresh token header theo middleware |
| Parameter | Kiểu | Mô tả | Ví dụ |
|---|
| path params | string | Các phần :publicId, :username, :code nếu path có | cm123 |
| query params | string/number | take, after, page, limit hoặc module-specific query | take=20 |
| Field | Kiểu | Bắt buộc | Validation | Mô tả | Ví dụ giá trị |
|---|
| body | object | Không | Theo DTO Zod nếu route có validate() | Payload nghiệp vụ của endpoint | {"content":"Hello"} |
Ví dụ request
curl -X GET http://localhost:3302/api/v1/admin/daily-quests/actions \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json"
Response
200/201 — Thành công
| Field | Kiểu | Luôn có? | Mô tả |
|---|
| success | boolean | Có | true khi request thành công |
| message | string | Không | Một số controller truyền message |
| data | object/array | Tùy endpoint | Dữ liệu trả về từ service |
| pagination | object | Với list | Cursor/offset pagination |
{
"success": true,
"data": {
"module": "admin",
"endpoint": "/api/v1/admin/daily-quests/actions"
}
}
Lỗi có thể xảy ra
| HTTP Status | Error Code | Khi nào xảy ra | Cách xử lý ở client |
|---|
| 401 | UNAUTHORIZED | Unauthorized | Login lại hoặc refresh token. |
| 400 | VALIDATION_FAILED | Validation failed | Client sửa field sai. |
| 404 | NOT_FOUND | Resource not found | Refresh dữ liệu. |
| 403 | FORBIDDEN | Forbidden | Ẩn action trong UI. |
| 500 | INTERNAL_SERVER_ERROR | External dependency fail | On-call kiểm tra provider/log. |
Ví dụ lỗi
{
"success": false,
"message": "Validation failed"
}
Ghi chú
- Endpoint đi qua global
apiLimiter. - Idempotency không được đảm bảo trừ khi service có upsert/unique constraint riêng.
- permission.ts trống, admin route dùng checkRole riêng.
GET /api/v1/admin/daily-quests
GET Auth required apiLimiter
Endpoint này dùng để list daily quests. Gọi endpoint này khi client cần thao tác đúng phạm vi module admin.
Request
| Header | Giá trị | Bắt buộc | Mô tả |
|---|
| Authorization | Bearer accessToken | Có | JWT access token nếu route protected |
| x-refresh-token | raw refresh token | Không | Refresh token header theo middleware |
| Parameter | Kiểu | Mô tả | Ví dụ |
|---|
| path params | string | Các phần :publicId, :username, :code nếu path có | cm123 |
| query params | string/number | take, after, page, limit hoặc module-specific query | take=20 |
| Field | Kiểu | Bắt buộc | Validation | Mô tả | Ví dụ giá trị |
|---|
| body | object | Không | Theo DTO Zod nếu route có validate() | Payload nghiệp vụ của endpoint | {"content":"Hello"} |
Ví dụ request
curl -X GET http://localhost:3302/api/v1/admin/daily-quests \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json"
Response
200/201 — Thành công
| Field | Kiểu | Luôn có? | Mô tả |
|---|
| success | boolean | Có | true khi request thành công |
| message | string | Không | Một số controller truyền message |
| data | object/array | Tùy endpoint | Dữ liệu trả về từ service |
| pagination | object | Với list | Cursor/offset pagination |
{
"success": true,
"data": {
"module": "admin",
"endpoint": "/api/v1/admin/daily-quests"
}
}
Lỗi có thể xảy ra
| HTTP Status | Error Code | Khi nào xảy ra | Cách xử lý ở client |
|---|
| 401 | UNAUTHORIZED | Unauthorized | Login lại hoặc refresh token. |
| 400 | VALIDATION_FAILED | Validation failed | Client sửa field sai. |
| 404 | NOT_FOUND | Resource not found | Refresh dữ liệu. |
| 403 | FORBIDDEN | Forbidden | Ẩn action trong UI. |
| 500 | INTERNAL_SERVER_ERROR | External dependency fail | On-call kiểm tra provider/log. |
Ví dụ lỗi
{
"success": false,
"message": "Validation failed"
}
Ghi chú
- Endpoint đi qua global
apiLimiter. - Idempotency không được đảm bảo trừ khi service có upsert/unique constraint riêng.
- permission.ts trống, admin route dùng checkRole riêng.
PATCH /api/v1/admin/daily-quests/:code/disable
PATCH Auth required apiLimiter
Endpoint này dùng để disable quest. Gọi endpoint này khi client cần thao tác đúng phạm vi module admin.
Request
| Header | Giá trị | Bắt buộc | Mô tả |
|---|
| Authorization | Bearer accessToken | Có | JWT access token nếu route protected |
| x-refresh-token | raw refresh token | Không | Refresh token header theo middleware |
| Parameter | Kiểu | Mô tả | Ví dụ |
|---|
| path params | string | Các phần :publicId, :username, :code nếu path có | cm123 |
| query params | string/number | take, after, page, limit hoặc module-specific query | take=20 |
| Field | Kiểu | Bắt buộc | Validation | Mô tả | Ví dụ giá trị |
|---|
| body | object | Tùy endpoint | Theo DTO Zod nếu route có validate() | Payload nghiệp vụ của endpoint | {"content":"Hello"} |
Ví dụ request
curl -X PATCH http://localhost:3302/api/v1/admin/daily-quests/POST_1/disable \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json"
Response
200/201 — Thành công
| Field | Kiểu | Luôn có? | Mô tả |
|---|
| success | boolean | Có | true khi request thành công |
| message | string | Không | Một số controller truyền message |
| data | object/array | Tùy endpoint | Dữ liệu trả về từ service |
| pagination | object | Với list | Cursor/offset pagination |
{
"success": true,
"data": {
"module": "admin",
"endpoint": "/api/v1/admin/daily-quests/:code/disable"
}
}
Lỗi có thể xảy ra
| HTTP Status | Error Code | Khi nào xảy ra | Cách xử lý ở client |
|---|
| 401 | UNAUTHORIZED | Unauthorized | Login lại hoặc refresh token. |
| 400 | VALIDATION_FAILED | Validation failed | Client sửa field sai. |
| 404 | NOT_FOUND | Resource not found | Refresh dữ liệu. |
| 403 | FORBIDDEN | Forbidden | Ẩn action trong UI. |
| 500 | INTERNAL_SERVER_ERROR | External dependency fail | On-call kiểm tra provider/log. |
Ví dụ lỗi
{
"success": false,
"message": "Validation failed"
}
Ghi chú
- Endpoint đi qua global
apiLimiter. - Idempotency không được đảm bảo trừ khi service có upsert/unique constraint riêng.
- permission.ts trống, admin route dùng checkRole riêng.