Skip to content

[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
DEV-3858-refactor-useCases-and-useCaseListPage-api-layer
Open

[DEV-3858] Refactor useCases and useCaseListPage API Layer#2194
Sebastiano-Bertolin wants to merge 3 commits intoDEV-3857-refactor-tutorials-and-tutorialListPage-api-layerfrom
DEV-3858-refactor-useCases-and-useCaseListPage-api-layer

Conversation

@Sebastiano-Bertolin
Copy link
Copy Markdown
Collaborator

List of Changes

Repository Pattern Refactor:

  • Implemented UseCasesRepository and UseCaseListPageRepository to 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 strapi directory 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 mapUseCaseListPageProps function 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:

  • Removed the old "makeUseCaseListPagesProps" test and related code, as well as the now-unused prop mappers and fetchers from the codebase. (apps/nextjs-website/src/lib/strapi/__tests__/makeUseCaseListPages.test.ts, apps/nextjs-website/src/lib/cmsApi.ts, [1] [2] [3]

Type and Import Updates:

  • Updated all type and import references to point to the new repository and types locations, ensuring consistency across the codebase. (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

  • 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.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 25, 2026

🦋 Changeset detected

Latest commit: 6483d4b

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 26, 2026

Jira Pull Request Link

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

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