feat(customers): "Manage galleries" dialog on customer detail page

This commit is contained in:
Luca
2026-05-11 23:40:07 +02:00
parent 55a5846f6f
commit 6d1af7a011
9 changed files with 482 additions and 11 deletions
@@ -159,6 +159,26 @@ export const customerAdminService = {
return ((response.data as any).data ?? response.data) as { email: string; expiresAt: string };
},
/**
* Replace the full set of events this customer is assigned to.
* Empty array clears every assignment. The backend rejects any
* archived event ids it sees, so the response { added, removed }
* counts may be lower than the input length if the admin selected
* something stale — surface the numbers in a toast.
*
* Access revocation: gallery middleware re-checks the assignment
* row on every customer-minted JWT, so removing an event here
* immediately blocks the customer's next request to that gallery.
* No separate token-blacklist call needed.
*/
async setEvents(id: number, eventIds: number[]): Promise<{ added: number; removed: number }> {
const response = await api.put<{ data: { added: number; removed: number } } | { added: number; removed: number }>(
`/admin/customers/${id}/events`,
{ event_ids: eventIds },
);
return ((response.data as any).data ?? response.data) as { added: number; removed: number };
},
/**
* Invite a customer. `prefill` is an optional set of profile fields the
* admin can pre-populate on the invitation row — the customer sees them