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:
2026-02-20 18:46:38 +00:00
parent eb1a719fc3
commit 41dc839830
13 changed files with 385 additions and 1647 deletions
@@ -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');