[DEV-3839] Refactor guides API layer#2182
Open
Sebastiano-Bertolin wants to merge 4 commits intoDEV-3834-refactor-api-layer-for-case-historiesfrom
Open
[DEV-3839] Refactor guides API layer#2182Sebastiano-Bertolin wants to merge 4 commits intoDEV-3834-refactor-api-layer-for-case-historiesfrom
Sebastiano-Bertolin wants to merge 4 commits intoDEV-3834-refactor-api-layer-for-case-historiesfrom
Conversation
- Add fetcher to retrieve guide list pages from Strapi. - Create mapper to transform Strapi data into application-specific format. - Implement repository pattern for accessing guide list pages. - Add tests for mapping guide list pages with various scenarios. - Introduce factories for generating test data for guide list pages. - Create shared fixtures for guide list pages and guides. - Remove obsolete Strapi types related to guide lists.
🦋 Changeset detectedLatest commit: 4afc926 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 |
…V-3839-refactor-guides-api-layer
Contributor
Jira Pull Request LinkThis Pull Request refers to the following Jira issue DEV-3839 |
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.
This pull request refactors the guide and guide list page data fetching logic across the codebase, replacing legacy helper functions with new repository patterns. It introduces two repositories,
GuidesRepositoryandGuideListPagesRepository, to centralise and simplify access to guide-related data. The changes also update tests and imports to use these new abstractions, and remove obsolete code.List of Changes
Repository pattern migration:
GuidesRepositoryandGuideListPagesRepositoryto encapsulate all guide and guide list page fetching and mapping logic, replacing previous scattered helper functions. This centralizes guide data access and improves maintainability. (apps/nextjs-website/src/lib/guides/index.ts,apps/nextjs-website/src/lib/guideListPages/index.ts, [1] [2]apps/nextjs-website/src/lib/api.ts,apps/nextjs-website/src/app/sitemap.ts, andapps/nextjs-website/src/lib/cmsApi.tsto use the new repository methods instead of legacy helpers. (apps/nextjs-website/src/lib/api.ts,apps/nextjs-website/src/app/sitemap.ts,apps/nextjs-website/src/lib/cmsApi.ts, [1] [2] [3] [4] [5] [6] [7] [8] [9]Code cleanup and removal:
getGuideListPagesProps,getGuidePageProps,getGuidesProps,makeGuideListPagesProps,makeGuidesProps, and related imports), and replaced them with repository calls. (apps/nextjs-website/src/lib/cmsApi.ts, apps/nextjs-website/src/lib/cmsApi.tsL140-R150)apps/nextjs-website/src/lib/guideListPages/fetcher.ts, [1] [2];apps/nextjs-website/src/lib/guides/fetcher.ts, [3]Test and fixture updates:
mapGuidesandmapGuideListPagesfunctions, updating fixtures and test descriptions accordingly. (apps/nextjs-website/src/lib/guides/__tests__/mapper.test.ts,apps/nextjs-website/src/lib/guideListPages/__tests__/mapper.test.ts, [1] [2] [3] [4] [5] [6] [7] [8] [9]Type and mapping improvements:
mapGuides,mapGuideListPages) to new locations. (apps/nextjs-website/src/lib/guideListPages/types.ts, [1];apps/nextjs-website/src/lib/guideListPages/mapper.ts, [2]Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: