[DEV-3840] Refactor homepage API layer#2183
Open
Sebastiano-Bertolin wants to merge 5 commits intoDEV-3839-refactor-guides-api-layerfrom
Open
[DEV-3840] Refactor homepage API layer#2183Sebastiano-Bertolin wants to merge 5 commits intoDEV-3839-refactor-guides-api-layerfrom
Sebastiano-Bertolin wants to merge 5 commits intoDEV-3839-refactor-guides-api-layerfrom
Conversation
…a fetching - Add fetcher to retrieve homepage from Strapi. - Rafactor makeHomepageProps to mapper - Implement repository pattern for accessing homepage data. - Move factories and fixture to shared folder
🦋 Changeset detectedLatest commit: 3c19bbd 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 |
…tor-homepage-api-layer
…tor-homepage-api-layer
Contributor
Jira Pull Request LinkThis Pull Request refers to the following Jira issue DEV-3840 |
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 homepage API layer by introducing a repository pattern, reorganising related code, and updating types and tests for improved maintainability and clarity. The main changes include moving the homepage fetcher and mapper into a dedicated folder, implementing a repository abstraction for homepage data access, and updating types to better reflect the homepage structure.
List of Changes
Homepage API layer refactor:
HomepageRepositoryinapps/nextjs-website/src/lib/homepage/index.ts, which encapsulates fetching and mapping homepage data.apps/nextjs-website/src/lib/strapi/fetches/fetchHomepage.tstoapps/nextjs-website/src/lib/homepage/fetcher.ts, simplifying and consolidating the Strapi population query. [1] [2]makeHomepageProps) intomapHomepagePropsand relocated it toapps/nextjs-website/src/lib/homepage/mapper.ts, updating its usage throughout the codebase. [1] [2]Project structure and test updates:
homepageandsharedfolders for better organization and maintainability. [1] [2] [3]apps/nextjs-website/src/app/[locale]/page.tsxandapps/nextjs-website/src/app/sitemap.tsto use the new repository and mapper. (apps/nextjs-website/src/app/[locale]/page.tsxR26, apps/nextjs-website/src/app/[locale]/page.tsxL70-R70, [1] [2]Type improvements:
StrapiHomepageas aRootEntity<Homepage>, and simplified related type definitions for clarity and consistency.(Changeset reference: .changeset/olive-eels-open.mdR1-R12)
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: