feat(booking): add service eligibility based on age and patch tests
- Add eligibility filtering to /api/services: exclude services below
user's
age, gray out services requiring patch tests that are missing/expired
- Add new endpoint /api/services/eligible-for/{user_id} for admin
booking
flows to check eligibility for a specific user
- Add image metadata stripping: uploads now strip all EXIF/GPS data
via imaging library (security improvement)
- Update ServiceCard frontend: show grayed-out state for ineligible
services with "contact us" link (public) or just warning (admin)
- Add 2 patch test services to seed data: Gel Polish Full Set,
Luxury Gel Manicure (48h each)
- Remove deprecated local-dev.sh script
This commit is contained in:
@@ -61,7 +61,24 @@
|
||||
|
||||
if (response.ok) {
|
||||
const data: Service[] = await response.json();
|
||||
services = data;
|
||||
// Sort: valid patch tests first (by name), then grayed out (by name)
|
||||
const valid: Service[] = [];
|
||||
const grayedOut: Service[] = [];
|
||||
|
||||
for (const service of data) {
|
||||
if (service.patch_test_status === 'required' || service.patch_test_status === 'expired') {
|
||||
grayedOut.push(service);
|
||||
} else {
|
||||
valid.push(service);
|
||||
}
|
||||
}
|
||||
|
||||
// Sort each group alphabetically
|
||||
valid.sort((a, b) => a.name.localeCompare(b.name));
|
||||
grayedOut.sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
// Combine: valid first, then grayed out
|
||||
services = [...valid, ...grayedOut];
|
||||
} else {
|
||||
console.error('Failed to fetch services:', response.status);
|
||||
toast.error('Failed to load services');
|
||||
|
||||
Reference in New Issue
Block a user