style: fix no-explicit-any — replace with proper TypeScript types

This commit is contained in:
2026-06-25 14:46:51 +01:00
parent 6291d04b47
commit a8d04b77e2
6 changed files with 10 additions and 9 deletions
@@ -11,7 +11,7 @@
import { Input } from '$lib/components/ui/input'; import { Input } from '$lib/components/ui/input';
import { Textarea } from '$lib/components/ui/textarea'; import { Textarea } from '$lib/components/ui/textarea';
import CharCounter from '$lib/components/ui/CharCounter.svelte'; import CharCounter from '$lib/components/ui/CharCounter.svelte';
import type { Booking, BookingService, Service } from '$lib/types/booking'; import type { Booking, BookingService, Payment, Service } from '$lib/types/booking';
interface Props { interface Props {
open: boolean; open: boolean;
@@ -112,7 +112,7 @@
override_price: s.override_price, override_price: s.override_price,
override_duration_minutes: s.override_duration_minutes override_duration_minutes: s.override_duration_minutes
})), })),
payments: (data.payments || []).map((p: any) => ({ payments: (data.payments || []).map((p: Payment) => ({
id: p.id, id: p.id,
booking_id: p.booking_id, booking_id: p.booking_id,
payment_type: p.payment_type, payment_type: p.payment_type,
@@ -151,13 +151,13 @@
if (data === null || data.length === 0) { if (data === null || data.length === 0) {
return; return;
} }
exceptionGroups = data.map((group: any) => ({ exceptionGroups = data.map((group: ExceptionGroup) => ({
id: group.id, id: group.id,
name: group.name, name: group.name,
description: group.description, description: group.description,
weekStarts: group.weekStarts || [], weekStarts: group.weekStarts || [],
hours: hours:
group.hours?.map((h: any) => ({ group.hours?.map((h: { id: number; weekday: number; startTime: string; endTime: string; isOpen: boolean }) => ({
id: h.id, id: h.id,
weekday: h.weekday, weekday: h.weekday,
start_time: formatTime(h.startTime), start_time: formatTime(h.startTime),
@@ -363,7 +363,7 @@
if (response.ok) { if (response.ok) {
const data = await response.json(); const data = await response.json();
const list = data.services || data; const list = data.services || data;
customServices = list.map((cs: any) => ({ ...cs, is_custom: true })); customServices = list.map((cs: CustomService) => ({ ...cs, is_custom: true }));
} }
} catch { } catch {
console.error('Failed to fetch custom services'); console.error('Failed to fetch custom services');
@@ -112,7 +112,7 @@
if (response.ok) { if (response.ok) {
const data = await response.json(); const data = await response.json();
defaultHours = data.map((hour: any) => ({ defaultHours = data.map((hour: { weekday: number; startTime: string; endTime: string; isOpen: boolean }) => ({
weekday: hour.weekday, weekday: hour.weekday,
start_time: formatTime(hour.startTime), start_time: formatTime(hour.startTime),
end_time: formatTime(hour.endTime), end_time: formatTime(hour.endTime),
@@ -543,7 +543,7 @@
try { try {
await applyLoyaltyRedemption(); await applyLoyaltyRedemption();
const body: any = { const body: { amount: number; payment_type: string; payment_method: string; gift_card_id?: string } = {
amount: payAmountCents, amount: payAmountCents,
payment_type: 'full', payment_type: 'full',
payment_method: 'giftcard' payment_method: 'giftcard'
@@ -14,6 +14,7 @@
import UserModal from '$lib/components/admin/UserModal.svelte'; import UserModal from '$lib/components/admin/UserModal.svelte';
import EditRequestModal from '$lib/components/admin/EditRequestModal.svelte'; import EditRequestModal from '$lib/components/admin/EditRequestModal.svelte';
import { toast } from 'svelte-sonner'; import { toast } from 'svelte-sonner';
import type { Booking } from '$lib/types/booking';
interface Notification { interface Notification {
id: number; id: number;
@@ -68,7 +69,7 @@
let includeAcknowledged = $state(false); let includeAcknowledged = $state(false);
let showApprovalModal = $state(false); let showApprovalModal = $state(false);
let selectedBooking = $state<any>(null); let selectedBooking = $state<Booking | null>(null);
let showBookingModal = $state(false); let showBookingModal = $state(false);
let showUserModal = $state(false); let showUserModal = $state(false);
let selectedUserId = $state<string | null>(null); let selectedUserId = $state<string | null>(null);
@@ -154,7 +155,7 @@
} }
} }
async function fetchBookingDetails(bookingId: string): Promise<any> { async function fetchBookingDetails(bookingId: string): Promise<Booking | null> {
const response = await fetch(`/api/admin/bookings/${bookingId}`, { const response = await fetch(`/api/admin/bookings/${bookingId}`, {
headers: { Authorization: `Bearer ${authStore.currentToken}` } headers: { Authorization: `Bearer ${authStore.currentToken}` }
}); });