feat: portal cross-event my-shifts endpoint and dashboard page

GET /portal/my-shifts aggregates shift assignments across all events
the logged-in user is linked to via Person records. Groups by event
then date, showing only active assignments (approved/pending_approval)
for approved/pending persons.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 15:07:08 +02:00
parent d4004c798c
commit 53100d4f6d
7 changed files with 812 additions and 9 deletions

View File

@@ -1,12 +1,25 @@
import { useQuery, useMutation, useQueryClient } from '@tanstack/vue-query'
import type { Ref } from 'vue'
import { apiClient } from '@/lib/axios'
import type { AvailableShiftsDay, MyShiftsResponse } from '@/types/portal-shift'
import type { AllMyShiftsEventGroup, AvailableShiftsDay, MyShiftsResponse } from '@/types/portal-shift'
interface ApiResponse<T> {
data: T
}
export function useAllMyShifts() {
return useQuery({
queryKey: ['portal-all-my-shifts'],
queryFn: async () => {
const { data } = await apiClient.get<ApiResponse<AllMyShiftsEventGroup[]>>(
'/portal/my-shifts',
)
return data.data
},
})
}
export function useAvailableShifts(eventId: Ref<string | null>) {
return useQuery({
queryKey: ['available-shifts', eventId],