Skip to content

[DEV-3840] Refactor homepage API layer#2183

Open
Sebastiano-Bertolin wants to merge 5 commits intoDEV-3839-refactor-guides-api-layerfrom
DEV-3840-refactor-homepage-api-layer
Open

[DEV-3840] Refactor homepage API layer#2183
Sebastiano-Bertolin wants to merge 5 commits intoDEV-3839-refactor-guides-api-layerfrom
DEV-3840-refactor-homepage-api-layer

Conversation

@Sebastiano-Bertolin
Copy link
Copy Markdown
Collaborator

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:

  • Implemented the repository pattern for homepage data access by creating HomepageRepository in apps/nextjs-website/src/lib/homepage/index.ts, which encapsulates fetching and mapping homepage data.
  • Moved the homepage fetcher logic from apps/nextjs-website/src/lib/strapi/fetches/fetchHomepage.ts to apps/nextjs-website/src/lib/homepage/fetcher.ts, simplifying and consolidating the Strapi population query. [1] [2]
  • Refactored the homepage mapper (makeHomepageProps) into mapHomepageProps and relocated it to apps/nextjs-website/src/lib/homepage/mapper.ts, updating its usage throughout the codebase. [1] [2]

Project structure and test updates:

Type improvements:

  • Refactored homepage types to export StrapiHomepage as a RootEntity<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

  • Chore (nothing changes by a user perspective)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

…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-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 20, 2026

🦋 Changeset detected

Latest commit: 3c19bbd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nextjs-website Patch

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

@marcobottaro marcobottaro changed the title [DEV3840] Refactor homepage api layer [DEV3840] Refactor homepage API layer Mar 23, 2026
@MarcoPonchia MarcoPonchia changed the title [DEV3840] Refactor homepage API layer [DEV-3840] Refactor homepage API layer Mar 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

Jira Pull Request Link

This Pull Request refers to the following Jira issue DEV-3840

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant