feat(users, contents): extend admin update functionality and role management

- Added `moderator` role to `User` type for improved role assignment flexibility.
- Introduced `updateAdmin` method in user and content services to handle partial admin-specific updates.
- Enhanced `Content` type with `categoryId` and `iconUrl` to support richer categorization.
This commit is contained in:
Mathis HERRIOT
2026-01-21 13:22:07 +01:00
parent 68b5071f6d
commit 764c4c07c8
5 changed files with 21 additions and 1 deletions

View File

@@ -65,4 +65,9 @@ export const ContentService = {
async removeAdmin(id: string): Promise<void> {
await api.delete(`/contents/${id}/admin`);
},
async updateAdmin(id: string, update: Partial<Content>): Promise<Content> {
const { data } = await api.patch<Content>(`/contents/${id}/admin`, update);
return data;
},
};

View File

@@ -34,6 +34,11 @@ export const UserService = {
await api.delete(`/users/${uuid}`);
},
async updateAdmin(uuid: string, update: Partial<User>): Promise<User> {
const { data } = await api.patch<User>(`/users/admin/${uuid}`, update);
return data;
},
async updateAvatar(file: File): Promise<User> {
const formData = new FormData();
formData.append("file", file);