diff --git a/src/stores/schedules.ts b/src/stores/schedules.ts index d4c03d8607e0cdd9358dab3d58a7b0f1a7e28c51..737609319f089aab729e8796fba0abf762333f07 100644 --- a/src/stores/schedules.ts +++ b/src/stores/schedules.ts @@ -12,16 +12,21 @@ import { createSteeringURL } from '@/api' import { steeringAuthInit } from '@/stores/auth' import { Schedule, ScheduleConflictSolution, ScheduleCreateData } from '@/types' import { computed } from 'vue' +import { aggregateWithIdsParameter } from '@/util/api' export const useScheduleStore = defineStore('schedules', () => { const endpoint = createSteeringURL.prefix('schedules') const { api, base } = createExtendableAPI<Schedule>(endpoint, steeringAuthInit) + const listOperations = APIListPaginated(api) const { update } = APIUpdate<Schedule, ScheduleCreateData>(api) return { ...base, update, + ...listOperations, + ...APIRetrieve(api, { + aggregate: aggregateWithIdsParameter(listOperations.listIsolated), + }), ...APICreate<Schedule, ScheduleCreateData>(api), - ...APIListPaginated(api), ...APIRetrieve(api), ...APIRemove(api), } diff --git a/src/stores/shows.ts b/src/stores/shows.ts index 126841a6a2759003c6cb3ac8dc653a8422cc91f9..cead10124f097b26302f3ba4ae1fe37d5e1f02e4 100644 --- a/src/stores/shows.ts +++ b/src/stores/shows.ts @@ -17,6 +17,7 @@ import { createSteeringURL } from '@/api' import { components } from '@/steering-types' import { steeringAuthInit, useAuthStore, useOnAuthBehaviour } from '@/stores/auth' import { KeysFrom, Show } from '@/types' +import { aggregateWithIdsParameter } from '@/util/api' type ReadonlyAttrs = KeysFrom<Show, 'id' | 'createdAt' | 'createdBy' | 'updatedAt' | 'updatedBy'> type ShowCreateData = Omit<Show, ReadonlyAttrs | 'slug'> & { slug?: string } @@ -115,6 +116,7 @@ export const useShowStore = defineStore('shows', () => { const endpoint = createSteeringURL.prefix('shows') const { api, base } = createExtendableAPI<Show>(endpoint, steeringAuthInit) const { selectedShow, selectedShowId } = useSelectedShowBehaviour(api) + const listOperations = APIListPaginated(api) useRouteSyncBehaviour(selectedShowId, selectedShow) // Make sure the store contains a list of all shows, which are @@ -123,8 +125,10 @@ export const useShowStore = defineStore('shows', () => { return { ...base, - ...APIListPaginated(api), - ...APIRetrieve(api), + ...listOperations, + ...APIRetrieve(api, { + aggregate: aggregateWithIdsParameter(listOperations.listIsolated), + }), ...APICreate<Show, ShowCreateData>(api), ...APIUpdate<Show, ShowUpdateData, ShowPartialUpdateData>(api), ...APIRemove(api), diff --git a/src/stores/timeslots.ts b/src/stores/timeslots.ts index a34d1d3442b7f0547272afe8ef13cfd2b53f36ab..716d6b575d60a1a95bc7aa5d6997207a38ff5060 100644 --- a/src/stores/timeslots.ts +++ b/src/stores/timeslots.ts @@ -11,6 +11,7 @@ import { createSteeringURL } from '@/api' import { components } from '@/steering-types' import { steeringAuthInit } from '@/stores/auth' import { KeysFrom, TimeSlot } from '@/types' +import { aggregateWithIdsParameter } from '@/util/api' type ReadonlyAttrs = KeysFrom<TimeSlot, 'id'> type TimeSlotUpdateData = Omit<TimeSlot, ReadonlyAttrs> @@ -19,10 +20,13 @@ type TimeSlotPartialUpdateData = components['schemas']['PatchedTimeSlot'] export const useTimeSlotStore = defineStore('timeslots', () => { const endpoint = createSteeringURL.prefix('timeslots') const { api, base } = createExtendableAPI<TimeSlot>(endpoint, steeringAuthInit) + const listOperations = APIListPaginated(api) return { ...base, - ...APIListPaginated(api), - ...APIRetrieve(api), + ...listOperations, + ...APIRetrieve(api, { + aggregate: aggregateWithIdsParameter(listOperations.listIsolated), + }), ...APIUpdate<TimeSlot, TimeSlotUpdateData, TimeSlotPartialUpdateData>(api), ...APIRemove(api), }