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:
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user