[DEV-3858] Refactor useCases and useCaseListPage API Layer#2194
Open
Sebastiano-Bertolin wants to merge 3 commits intoDEV-3857-refactor-tutorials-and-tutorialListPage-api-layerfrom
Conversation
🦋 Changeset detectedLatest commit: 6483d4b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Jira Pull Request LinkThis Pull Request refers to the following Jira issue DEV-3858 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
List of Changes
Repository Pattern Refactor:
Implemented
UseCasesRepositoryandUseCaseListPageRepositoryto encapsulate data fetching and mapping logic for use cases and use case list pages, replacing direct calls to Strapi fetchers and prop mappers. (apps/nextjs-website/src/lib/api.ts,apps/nextjs-website/src/lib/useCases/index.ts,apps/nextjs-website/src/lib/useCaseListPage/index.ts, [1] [2] [3] [4]Replaced the legacy "makeProps" and "fetches" approach for use case list pages with a new mapper (
mapUseCaseListPageProps) and fetcher within the repository. (apps/nextjs-website/src/lib/useCaseListPage/mapper.ts,apps/nextjs-website/src/lib/useCaseListPage/fetcher.ts, [1] [2]Test and Fixture Reorganisation:
Moved and updated test and fixture files for use cases and use case list pages out of the
strapidirectory to new locations, and updated their imports for the new structure. (apps/nextjs-website/src/lib/__tests__/factories/useCaseListPage.ts,apps/nextjs-website/src/lib/__tests__/factories/useCases.ts,apps/nextjs-website/src/lib/__tests__/fixtures/useCaseListPage.ts,apps/nextjs-website/src/lib/__tests__/fixtures/useCases.ts, [1] [2] [3] [4]Rewrote the test for use case list page mapping to use the new
mapUseCaseListPagePropsfunction and placed it in the appropriate directory. (apps/nextjs-website/src/lib/useCaseListPage/__tests__/mapper.test.ts, apps/nextjs-website/src/lib/useCaseListPage/tests/mapper.test.tsR1-R72)Cleanup and Removal of Deprecated Code:
apps/nextjs-website/src/lib/strapi/__tests__/makeUseCaseListPages.test.ts,apps/nextjs-website/src/lib/cmsApi.ts, [1] [2] [3]Type and Import Updates:
apps/nextjs-website/src/lib/overviews/types.ts,apps/nextjs-website/src/lib/__tests__/factories/useCaseListPage.ts,apps/nextjs-website/src/lib/__tests__/factories/useCases.ts,apps/nextjs-website/src/lib/__tests__/fixtures/useCaseListPage.ts,apps/nextjs-website/src/lib/__tests__/fixtures/useCases.ts, [1] [2] [3] [4] [5]Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: