Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cms): Most common page types are now directly fetched from cms #16320

Merged
merged 9 commits into from
Nov 5, 2024

Conversation

RunarVestmann
Copy link
Member

@RunarVestmann RunarVestmann commented Oct 8, 2024

Most common page types are now directly fetched from cms

What

  • So we don't have to rely so much on the indexing process of the search engine we'd rather like to fetch pages directly from the cms

Why

  • Indexing content can take a while (depending on the content) so for people previewing content we'd like it to be quicker
  • This way we'll be able to separate the indexing process from the content previews (meaning that we could instead not have to keep the search as much up to date but rather every 15 minutes do a sync for example)

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Enhanced article data retrieval with additional fields for more detailed responses.
    • Transitioned data retrieval methods to utilize Contentful, improving consistency in content access.
  • Bug Fixes

    • Adjusted parameters for content retrieval methods to optimize data fetching.
  • Documentation

    • Updated method signatures to reflect changes in data retrieval processes.

Copy link
Contributor

coderabbitai bot commented Oct 8, 2024

Walkthrough

This pull request introduces modifications to the CmsContentfulService and CmsResolver classes. The CmsContentfulService now retrieves additional article fields, enhancing the data available. The CmsResolver shifts data retrieval methods from Elasticsearch to Contentful for several methods, improving consistency in data access. Method signatures have also been updated to reflect these changes.

Changes

File Path Change Summary
libs/cms/src/lib/cms.contentful.service.ts Updated ArticleFields constant to include additional fields; modified parameters for various methods, reducing include from 10 to 5 and adding limit set to 1.
libs/cms/src/lib/cms.resolver.ts Transitioned data retrieval methods from cmsElasticsearchService to cmsContentfulService for several methods; updated method signatures to include return types.

Possibly related PRs

Suggested labels

automerge

Suggested reviewers

  • mannipje

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Oct 8, 2024

Codecov Report

Attention: Patch coverage is 16.00000% with 21 lines in your changes missing coverage. Please review.

Project coverage is 36.54%. Comparing base (68d57e5) to head (4828a12).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
libs/cms/src/lib/cms.contentful.service.ts 22.22% 14 Missing ⚠️
libs/cms/src/lib/cms.resolver.ts 0.00% 7 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16320      +/-   ##
==========================================
- Coverage   36.54%   36.54%   -0.01%     
==========================================
  Files        6890     6890              
  Lines      143622   143639      +17     
  Branches    40921    40925       +4     
==========================================
+ Hits        52485    52486       +1     
- Misses      91137    91153      +16     
Flag Coverage Δ
api 3.37% <ø> (ø)
api-domains-auth-admin 48.48% <ø> (ø)
api-domains-communications 39.76% <16.00%> (-0.05%) ⬇️
application-system-api 41.11% <16.00%> (-0.01%) ⬇️
application-template-api-modules 27.69% <16.00%> (+0.01%) ⬆️
cms 0.42% <0.00%> (-0.01%) ⬇️
cms-translations 38.89% <16.00%> (-0.05%) ⬇️
judicial-system-api 19.57% <ø> (ø)
judicial-system-backend 55.17% <16.00%> (-0.04%) ⬇️
services-auth-admin-api 52.47% <ø> (ø)
services-auth-delegation-api 58.20% <ø> (ø)
services-auth-ids-api 52.07% <ø> (-0.02%) ⬇️
services-auth-personal-representative 45.57% <ø> (-0.01%) ⬇️
services-auth-personal-representative-public 41.78% <ø> (+0.04%) ⬆️
services-auth-public-api 49.58% <ø> (ø)
services-user-notification 46.84% <16.00%> (-0.05%) ⬇️
services-user-profile 61.83% <ø> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
libs/cms/src/lib/cms.resolver.ts 66.79% <0.00%> (ø)
libs/cms/src/lib/cms.contentful.service.ts 11.94% <22.22%> (+0.28%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68d57e5...4828a12. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Oct 8, 2024

Datadog Report

All test runs d4947c1 🔗

10 Total Test Services: 0 Failed, 9 Passed
🔻 Test Sessions change in coverage: 4 decreased, 23 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
api 0 0 0 4 0 2.34s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 12.16s 1 no change Link
api-domains-communications 0 0 0 5 0 27.82s 1 decreased (-0.04%) Link
api-domains-license-service 0 0 0 0 0 483.04ms 1 no change Link
application-system-api 0 0 0 131 2 3m 18.06s 1 no change Link
application-template-api-modules 0 0 0 123 0 2m 16.95s 1 no change Link
cms-translations 0 0 0 3 0 26.48s 1 decreased (-0.04%) Link
judicial-system-api 0 0 0 59 0 5.11s 1 no change Link
judicial-system-backend 0 0 0 20959 0 16m 1.98s 1 decreased (-0.03%) Link
services-user-notification 0 0 0 51 0 1m 21.68s 1 decreased (-0.03%) Link

🔻 Code Coverage Decreases vs Default Branch (4)

  • api-domains-communications - jest 48.93% (-0.04%) - Details
  • cms-translations - jest 48.35% (-0.04%) - Details
  • judicial-system-backend - jest 58.69% (-0.03%) - Details
  • services-user-notification - jest 69.52% (-0.03%) - Details

@RunarVestmann RunarVestmann added the deploy-feature Deploys features to dev label Oct 31, 2024
@RunarVestmann RunarVestmann marked this pull request as ready for review October 31, 2024 16:01
@RunarVestmann RunarVestmann requested review from a team as code owners October 31, 2024 16:01
Copy link
Contributor

github-actions bot commented Oct 31, 2024

Affected services are: air-discount-scheme-api,api,application-system-api,judicial-system-api,judicial-system-backend,services-search-indexer,services-user-notification,
Feature deployment of your services will begin shortly. Your feature will be accessible here:
https://cms-stop-fetching-pages-from-elasticsearch-api-catalogue.dev01.devland.is/api
https://cms-stop-fetching-pages-from-elasticsearch-application-callback-xrd.internal.dev01.devland.is/application-payment
https://cms-stop-fetching-pages-from-elasticsearch-application-callback-xrd.internal.dev01.devland.is/applications
https://cms-stop-fetching-pages-from-elasticsearch-application-payment-callback-xrd.internal.dev01.devland.is/application-payment
https://cms-stop-fetching-pages-from-elasticsearch-application-payment-callback-xrd.internal.dev01.devland.is/applications
https://cms-stop-fetching-pages-from-elasticsearch-beta.dev01.devland.is/
https://cms-stop-fetching-pages-from-elasticsearch-beta.dev01.devland.is/api
https://cms-stop-fetching-pages-from-elasticsearch-beta.dev01.devland.is/samradsgatt
https://cms-stop-fetching-pages-from-elasticsearch-beta.dev01.devland.is/stjornbord/bff
https://cms-stop-fetching-pages-from-elasticsearch-loftbru-cf.dev01.devland.is/
https://cms-stop-fetching-pages-from-elasticsearch-loftbru-cf.dev01.devland.is/api/graphql
https://cms-stop-fetching-pages-from-elasticsearch-loftbru.dev01.devland.is/
https://cms-stop-fetching-pages-from-elasticsearch-loftbru.dev01.devland.is/api/graphql

Deployed services: application-system-api,api,air-discount-scheme-api,application-system-api-worker,consultation-portal,web,services-bff-portals-admin,air-discount-scheme-web.
Excluded services: search-indexer-service,user-notification,user-notification-worker,user-notification-cleanup-worker

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 960dc1d and e19dc58.

📒 Files selected for processing (1)
  • libs/cms/src/lib/cms.resolver.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
libs/cms/src/lib/cms.resolver.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🔇 Additional comments (3)
libs/cms/src/lib/cms.resolver.ts (3)

249-249: LGTM!

The update correctly retrieves the organization page from Contentful using the provided slug and language.


257-260: LGTM!

The method now retrieves the organization subpage from Contentful with the appropriate parameters.


423-426: LGTM!

The change aligns with the new data retrieval strategy, fetching the article from Contentful.

libs/cms/src/lib/cms.resolver.ts Show resolved Hide resolved
@RunarVestmann RunarVestmann force-pushed the feature/cms-stop-fetching-pages-from-elasticsearch branch from e19dc58 to 2ce0be3 Compare November 1, 2024 10:46
@RunarVestmann RunarVestmann added the automerge Merge this PR as soon as all checks pass label Nov 1, 2024
@RunarVestmann RunarVestmann removed the deploy-feature Deploys features to dev label Nov 5, 2024
@kodiakhq kodiakhq bot merged commit f9931f3 into main Nov 5, 2024
68 checks passed
@kodiakhq kodiakhq bot deleted the feature/cms-stop-fetching-pages-from-elasticsearch branch November 5, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants