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:
@@ -202,6 +202,13 @@
|
||||
wasOpen = open;
|
||||
});
|
||||
|
||||
// Refetch services when selected user changes (for eligibility)
|
||||
$effect(() => {
|
||||
if (open && selectedUserId) {
|
||||
fetchServices();
|
||||
}
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
if (open && currentStep === 4) {
|
||||
const dateToCheck = selectedDate || placeholder;
|
||||
@@ -265,7 +272,12 @@
|
||||
async function fetchServices() {
|
||||
loadingServices = true;
|
||||
try {
|
||||
const response = await fetch('/api/services', {
|
||||
let url = '/api/services';
|
||||
// If a user is selected, get eligibility for that user
|
||||
if (selectedUserId) {
|
||||
url = `/api/services/eligible-for/${selectedUserId}`;
|
||||
}
|
||||
const response = await fetch(url, {
|
||||
headers: { Authorization: `Bearer ${authStore.currentToken}` }
|
||||
});
|
||||
if (response.ok) {
|
||||
@@ -910,6 +922,7 @@
|
||||
selected={selectedServices}
|
||||
loading={loadingServices}
|
||||
ontoggle={toggleService}
|
||||
showContactLink={false}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user