From e7af5771f4a89d042fa50dcbc14a37b5f732d8bb Mon Sep 17 00:00:00 2001 From: buchananwill <139961977+buchananwill@users.noreply.github.com> Date: Thu, 11 Apr 2024 21:37:39 +0100 Subject: [PATCH] Removed a few more superseded API calls. --- app/api/actions/custom/option-blocks.ts | 20 ------------------ app/api/actions/custom/premises.ts | 21 ------------------- app/navbar/navbar.tsx | 5 ++--- app/playground/page.tsx | 9 +++----- .../asset-string-map-context-provider.tsx | 2 +- 5 files changed, 6 insertions(+), 51 deletions(-) delete mode 100644 app/api/actions/custom/option-blocks.ts delete mode 100644 app/api/actions/custom/premises.ts diff --git a/app/api/actions/custom/option-blocks.ts b/app/api/actions/custom/option-blocks.ts deleted file mode 100644 index cc01dc7..0000000 --- a/app/api/actions/custom/option-blocks.ts +++ /dev/null @@ -1,20 +0,0 @@ -'use server'; -import { API_ACADEMIC_URL } from '../../main'; -import { ActionResponsePromise } from '../actionResponse'; -import { CarouselGroupDto } from '../../dtos/CarouselGroupDtoSchema'; -import { getWithoutBody } from '../template-actions'; - -export async function getOptionBlocks(): ActionResponsePromise< - CarouselGroupDto[] -> { - const fullUrl = `${API_ACADEMIC_URL}/carousel-groups`; - - return getWithoutBody(fullUrl); -} - -export async function getCoAppearanceMatrix( - yearGroupCohort: number -): ActionResponsePromise { - const fullUrl = `${API_ACADEMIC_URL}/electives/coAppearanceMatrix?yearGroupCohort=${yearGroupCohort}`; - return getWithoutBody(fullUrl); -} diff --git a/app/api/actions/custom/premises.ts b/app/api/actions/custom/premises.ts deleted file mode 100644 index 99c8055..0000000 --- a/app/api/actions/custom/premises.ts +++ /dev/null @@ -1,21 +0,0 @@ -'use server'; -import { - getWithoutBody, - patchEntityList, - postIntersectionTableRequest, - putEntities, - putRequestWithDifferentReturnType -} from '../template-actions'; -import { ActionResponsePromise } from '../actionResponse'; -import { GraphDto, GraphDtoPutRequestBody } from '../../zod-mods'; -import { AssetDto } from '../../dtos/AssetDtoSchema'; -import { API_BASE_URL } from '../../main'; -import { AssetRoleWorkTaskSuitabilityDto } from '../../dtos/AssetRoleWorkTaskSuitabilityDtoSchema'; -export async function patchAssetRoleWorkTaskSuitabilities( - suitabilityList: AssetRoleWorkTaskSuitabilityDto[] -) { - return patchEntityList( - suitabilityList, - `${API_BASE_URL}/assets/assetRoleSuitabilities` - ); -} diff --git a/app/navbar/navbar.tsx b/app/navbar/navbar.tsx index 225287a..377ecfe 100644 --- a/app/navbar/navbar.tsx +++ b/app/navbar/navbar.tsx @@ -11,12 +11,11 @@ import ProtectedNavigation from './protected-navigation'; import { Text } from '@tremor/react'; import { SvgLogo } from './svg-logo'; import { ChevronDownIcon } from '@heroicons/react/20/solid'; - -import { getOptionBlocks } from '../api/actions/custom/option-blocks'; import { KnowledgeLevelDto } from '../api/dtos/KnowledgeLevelDtoSchema'; import { ServiceCategoryDto } from '../api/dtos/ServiceCategoryDtoSchema'; import ToolTipsToggle from '../generic/components/tooltips/tool-tips-toggle'; import { getGraphByRootId } from '../api/READ-ONLY-generated-actions/OrganizationType'; +import { getAll } from '../api/READ-ONLY-generated-actions/CarouselGroup'; interface DropdownItem { name: string; @@ -67,7 +66,7 @@ export default function Navbar({ useEffect(() => { if (isLoading) { - getOptionBlocks().then((r) => { + getAll().then((r) => { if (r.data) { if (organizationTypes !== undefined) setIsLoading(false); const receivedDropdownData = r.data.map((carouselGroupDto) => ({ diff --git a/app/playground/page.tsx b/app/playground/page.tsx index d163b14..b93be0e 100644 --- a/app/playground/page.tsx +++ b/app/playground/page.tsx @@ -1,23 +1,20 @@ import { Card } from '@nextui-org/card'; import SelectiveContextManagerGlobal from '../selective-context/components/global/selective-context-manager-global'; -import { getCoAppearanceMatrix } from '../api/actions/custom/option-blocks'; import { isNotUndefined } from '../api/main'; import { DataNotFoundCard } from '../timetables/students/[schedule]/data-not-found-card'; -import ArcChart from './arcChart'; import { getPage } from '../api/READ-ONLY-generated-actions/Carousel'; export default async function PlaygroundPage({}: {}) { const actionResponse = await getPage({}); - const { data } = await getCoAppearanceMatrix(12); + const data = undefined; + if (!isNotUndefined(data)) return No matrix.; return ( - - - + ); } diff --git a/app/premises/asset-string-map-context-provider.tsx b/app/premises/asset-string-map-context-provider.tsx index 8d7e7f6..47ea01e 100644 --- a/app/premises/asset-string-map-context-provider.tsx +++ b/app/premises/asset-string-map-context-provider.tsx @@ -9,7 +9,6 @@ import { } from './asset-string-map-context-creator'; import { StringMap } from '../contexts/string-map-context/string-map-reducer'; import { PropsWithChildren, useCallback } from 'react'; -import { patchAssetRoleWorkTaskSuitabilities } from '../api/actions/custom/premises'; import { AssetSuitabilityListSelectiveContext } from '../contexts/selective-context/selective-context-creators'; import { useSelectiveContextListenerReadAll } from '../selective-context/components/base/generic-selective-context-creator'; import { isNotUndefined } from '../api/main'; @@ -30,6 +29,7 @@ export default function AssetStringMapContextProvider({ .map((assetDto) => selectiveContextReadAll(assetDto.id.toString())) .filter(isNotUndefined) .reduce((prev, curr) => [...prev, ...curr], []); + console.log(updatedSuitabilityLists); await putList(updatedSuitabilityLists); return await putAssetList(changedAssetDtoList); },