feat(user-profile): add avatar upload functionality and update UserProfile entity
This commit is contained in:
@@ -154,3 +154,27 @@ Delete a user profile.
|
||||
| `ERR_AUTH_001` | 401 | Missing token |
|
||||
| `ERR_AUTH_006` | 403 | Not admin |
|
||||
| `ERR_NOT_FOUND_001` | 404 | Profile not found |
|
||||
|
||||
---
|
||||
|
||||
## POST `/api/v1/user-profile/avatar`
|
||||
|
||||
Upload the current user's profile avatar. Creates the profile if it doesn't exist yet.
|
||||
|
||||
**Permission:** `IS_AUTHENTICATED_FULLY`
|
||||
|
||||
### Request
|
||||
Raw file body with `Content-Disposition: filename="..."` and `Content-Type: application/octet-stream`.
|
||||
|
||||
### Response `200`
|
||||
```json
|
||||
{ "success": true, "data": { "avatar": "/uploads/avatars/2026-06/xxx.jpg", "url": "/uploads/avatars/2026-06/xxx.jpg" } }
|
||||
```
|
||||
|
||||
The stored path is also returned as `avatar` in the profile GET/PATCH responses.
|
||||
|
||||
### Errors
|
||||
| Code | HTTP | Description |
|
||||
|------|------|-------------|
|
||||
| `ERR_VALIDATION_001` | 422 | Missing or invalid file |
|
||||
| `ERR_AUTH_001` | 401 | Missing token |
|
||||
|
||||
Reference in New Issue
Block a user