Photo du bénévole ajoutée par la coordination
Section « Photo » sur la fiche bénévole (ajouter / remplacer / retirer),
PUT/DELETE /editions/{id}/volunteers/{vid}/photo (COORDINATION),
validation de l'image partagée avec le formulaire public (read_photo).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
54cba467fc
commit
6892e0307d
@@ -1069,6 +1069,21 @@ export function createMockApi(): PlanningApi {
|
||||
if (!dataUrl) return null;
|
||||
return (await fetch(dataUrl)).blob();
|
||||
},
|
||||
setPhoto: async (_edition, id, file) => {
|
||||
const v = state.volunteers.find((x) => x.id === id) ?? notFound();
|
||||
if (!['image/png', 'image/jpeg'].includes(file.type)) {
|
||||
throw new ApiError(422, 'form.photo_type_not_supported');
|
||||
}
|
||||
state.photos.set(id, await fileToDataUrl(file));
|
||||
Object.assign(v, { has_photo: true, updated_at: touch() });
|
||||
return delay(v);
|
||||
},
|
||||
removePhoto: (_edition, id) => {
|
||||
const v = state.volunteers.find((x) => x.id === id) ?? notFound();
|
||||
state.photos.delete(id);
|
||||
Object.assign(v, { has_photo: false, updated_at: touch() });
|
||||
return delay(v);
|
||||
},
|
||||
exportXlsx: () => delay(MOCK_XLSX_BLOB()),
|
||||
exportMecenatReceipts: () => {
|
||||
const paid = state.volunteers.some(
|
||||
|
||||
Reference in New Issue
Block a user