HarborForge.Frontend: proposal/essential tests on current branch head #11
@@ -26,6 +26,12 @@ interface TimeSlotResponse {
|
||||
updated_at: string | null
|
||||
}
|
||||
|
||||
interface DayViewResponse {
|
||||
date: string
|
||||
user_id: number
|
||||
slots: TimeSlotResponse[]
|
||||
}
|
||||
|
||||
interface SchedulePlanResponse {
|
||||
id: number
|
||||
slot_type: SlotType
|
||||
@@ -41,6 +47,10 @@ interface SchedulePlanResponse {
|
||||
updated_at: string | null
|
||||
}
|
||||
|
||||
interface PlanListResponse {
|
||||
plans: SchedulePlanResponse[]
|
||||
}
|
||||
|
||||
interface WorkloadWarning {
|
||||
period: string
|
||||
slot_type: string
|
||||
@@ -111,8 +121,8 @@ export default function CalendarPage() {
|
||||
setLoading(true)
|
||||
setError('')
|
||||
try {
|
||||
const { data } = await api.get<TimeSlotResponse[]>(`/calendar/day?date=${date}`)
|
||||
setSlots(data)
|
||||
const { data } = await api.get<DayViewResponse>(`/calendar/day?date=${date}`)
|
||||
setSlots(Array.isArray(data?.slots) ? data.slots : [])
|
||||
} catch (err: any) {
|
||||
setError(err.response?.data?.detail || 'Failed to load calendar')
|
||||
setSlots([])
|
||||
@@ -123,8 +133,8 @@ export default function CalendarPage() {
|
||||
|
||||
const fetchPlans = async () => {
|
||||
try {
|
||||
const { data } = await api.get<SchedulePlanResponse[]>('/calendar/plans')
|
||||
setPlans(data)
|
||||
const { data } = await api.get<PlanListResponse>('/calendar/plans')
|
||||
setPlans(Array.isArray(data?.plans) ? data.plans : [])
|
||||
} catch (err: any) {
|
||||
console.error('Failed to load plans:', err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user