Enhance type safety in BookNowPage and useAppointments hook. Update availableDates and availableDaysOfWeek mapping to specify string types. Add getUserAppointmentStats and AvailableDatesResponse types to useAppointments for improved type definitions. Modify Appointment interface to include 'completed' status for better appointment management.

This commit is contained in:
iamkiddy 2025-11-25 21:31:20 +00:00
parent a1611e1782
commit 9d3cc84816
5 changed files with 6 additions and 4 deletions

0
17 Normal file
View File

View File

@ -142,7 +142,7 @@ export default function BookNowPage() {
const daysSet = new Set<string>(); const daysSet = new Set<string>();
const dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; const dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
availableDates.forEach((dateStr) => { availableDates.forEach((dateStr: string) => {
try { try {
// Parse date string (YYYY-MM-DD format) // Parse date string (YYYY-MM-DD format)
const [year, month, day] = dateStr.split('-').map(Number); const [year, month, day] = dateStr.split('-').map(Number);
@ -651,7 +651,7 @@ export default function BookNowPage() {
) : ( ) : (
<> <>
<div className="flex flex-wrap gap-3"> <div className="flex flex-wrap gap-3">
{availableDaysOfWeek.map((day) => ( {availableDaysOfWeek.map((day: string) => (
<label <label
key={day} key={day}
className={`flex items-center gap-2 cursor-pointer px-4 py-2 rounded-lg border transition-all ${ className={`flex items-center gap-2 cursor-pointer px-4 py-2 rounded-lg border transition-all ${

View File

@ -7,6 +7,7 @@ import {
getAvailableDates, getAvailableDates,
listAppointments, listAppointments,
getUserAppointments, getUserAppointments,
getUserAppointmentStats,
getAppointmentDetail, getAppointmentDetail,
scheduleAppointment, scheduleAppointment,
rejectAppointment, rejectAppointment,
@ -25,6 +26,8 @@ import type {
Appointment, Appointment,
AdminAvailability, AdminAvailability,
AppointmentStats, AppointmentStats,
UserAppointmentStats,
AvailableDatesResponse,
JitsiMeetingInfo, JitsiMeetingInfo,
} from "@/lib/models/appointments"; } from "@/lib/models/appointments";

View File

@ -14,7 +14,6 @@ import {
refreshToken, refreshToken,
getStoredTokens, getStoredTokens,
getStoredUser, getStoredUser,
getStoredUserSync,
storeTokens, storeTokens,
storeUser, storeUser,
clearAuthData, clearAuthData,

View File

@ -9,7 +9,7 @@ export interface Appointment {
reason?: string; reason?: string;
preferred_dates: string[]; // YYYY-MM-DD format preferred_dates: string[]; // YYYY-MM-DD format
preferred_time_slots: string[]; // "morning", "afternoon", "evening" preferred_time_slots: string[]; // "morning", "afternoon", "evening"
status: "pending_review" | "scheduled" | "rejected"; status: "pending_review" | "scheduled" | "rejected" | "completed";
created_at: string; created_at: string;
updated_at: string; updated_at: string;
scheduled_datetime?: string; scheduled_datetime?: string;