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(web): RSS feed for events and generic list items #17270

Merged
merged 3 commits into from
Dec 18, 2024

Conversation

RunarVestmann
Copy link
Member

@RunarVestmann RunarVestmann commented Dec 17, 2024

RSS feed for events and generic list items

What

  • So that organizations can use mailchimp (for example) to automatically send an email when a new event or generic list item gets published

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 RSS feed generation to support multiple content types: 'news', 'genericList', and 'event'.
    • Added a new field firstPublishedAt to the GET_EVENTS_QUERY, improving event data returned.
  • Bug Fixes

    • Improved handling and formatting of content types in the RSS feed.
  • Documentation

    • Updated structure of the Event class to include the new firstPublishedAt field.

Copy link
Contributor

coderabbitai bot commented Dec 17, 2024

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

warning eslint@8.57.0: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning eslint > @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
warning eslint > @humanwhocodes/config-array > @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
warning eslint > file-entry-cache > flat-cache > rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob > inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
warning jest > @jest/core > jest-config > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > jest-runtime > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > @jest/reporters > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > @jest/transform > babel-plugin-istanbul > test-exclude > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning storybook > @storybook/cli > puppeteer-core > rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported
warning storybook > @storybook/cli > puppeteer-core > rimraf > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning storybook > @storybook/cli > tempy > del > rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
warning storybook > @storybook/cli > jscodeshift > temp > rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported
warning storybook > @storybook/cli > jscodeshift > temp > rimraf > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning storybook > @storybook/cli > jscodeshift > @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
warning storybook > @storybook/cli > jscodeshift > @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
warning storybook > @storybook/cli > jscodeshift > @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
warning react-native > @react-native/codegen > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning react-native > @react-native/community-cli-plugin > querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning react-native > @react-native/community-cli-plugin > @react-native/dev-middleware > @rnx-kit/chromium-edge-launcher > rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
warning react-native > @react-native/community-cli-plugin > @react-native/metro-babel-transformer > @react-native/babel-preset > @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
warning react-native > @react-native/community-cli-plugin > @react-native/metro-babel-transformer > @react-native/babel-preset > @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
warning react-native > @react-native/community-cli-plugin > @react-native/metro-babel-transformer > @react-native/babel-preset > @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
warning react-native > @react-native/community-cli-plugin > @react-native/metro-babel-transformer > @react-native/babel-preset > @babel/plugin-proposal-numeric-separator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.
warning react-native > @react-native/community-cli-plugin > @react-native/metro-babel-transformer > @react-native/babel-preset > @babel/plugin-proposal-object-rest-spread@7.20.7: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.
warning react-native > @react-native/community-cli-plugin > @react-native/metro-babel-transformer > @react-native/babel-preset > @babel/plugin-proposal-async-generator-functions@7.20.7: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-async-generator-functions instead.
warning react-native > @react-native/community-cli-plugin > @react-native/metro-babel-transformer > @react-native/babel-preset > @babel/plugin-proposal-logical-assignment-operators@7.20.7: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-logical-assignment-operators instead.
warning react-native > @react-native/community-cli-plugin > @react-native/metro-babel-transformer > @react-native/babel-preset > @babel/plugin-proposal-optional-catch-binding@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-catch-binding instead.
warning next-auth > querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning next-auth > jose@1.28.2: this version is no longer supported
warning next-auth > @next-auth/typeorm-legacy-adapter > typeorm > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning @nx/next > @nx/webpack > stylus > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning @nx/next > @nx/webpack > webpack-dev-server > rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
warning @nx/next > @nx/webpack > fork-ts-checker-webpack-plugin > memfs@3.6.0: this will be v4
warning @nx/next > @nx/webpack > webpack-dev-server > webpack-dev-middleware > memfs@3.6.0: this will be v4
warning workspace-aggregator-bef66337-b2ef-4e49-adcb-52096a6006d1 > eslint@8.57.0: This version is no longer supported. Please see https://eslint.org/version-support for other options.

Walkthrough

The pull request introduces enhancements to the RSS feed generation system, expanding its capabilities to support multiple content types (news, generic lists, and events). The changes involve modifying the RSS generation endpoint to dynamically handle different content sources, adding a new firstPublishedAt field to event-related queries and models, and implementing a more flexible approach to constructing RSS feed items. The modifications aim to improve the versatility and maintainability of the RSS feed generation process.

Changes

File Change Summary
apps/web/pages/api/rss/index.ts - Added new imports from date-fns for locale handling
- Introduced Item interface
- Created CONTENT_TYPES constant
- Implemented more flexible RSS feed generation supporting multiple content types
apps/web/screens/queries/Events.ts - Added firstPublishedAt field to GET_EVENTS_QUERY
libs/cms/src/lib/models/event.model.ts - Added optional firstPublishedAt field to Event class

Sequence Diagram

sequenceDiagram
    participant Client
    participant RSSEndpoint
    participant ContentService
    participant GraphQLAPI

    Client->>RSSEndpoint: Request RSS Feed
    RSSEndpoint->>RSSEndpoint: Determine Content Type
    RSSEndpoint->>GraphQLAPI: Fetch Content Items
    GraphQLAPI-->>RSSEndpoint: Return Items
    RSSEndpoint->>RSSEndpoint: Generate XML Items
    RSSEndpoint-->>Client: Return RSS Feed XML
Loading

Possibly related PRs

Suggested labels

automerge

Suggested reviewers

  • mannipje

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 Dec 17, 2024

Codecov Report

Attention: Patch coverage is 2.50000% with 39 lines in your changes missing coverage. Please review.

Project coverage is 35.71%. Comparing base (478aa01) to head (f2ca20e).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
apps/web/pages/api/rss/index.ts 0.00% 38 Missing ⚠️
libs/cms/src/lib/models/event.model.ts 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #17270      +/-   ##
==========================================
- Coverage   35.71%   35.71%   -0.01%     
==========================================
  Files        6944     6944              
  Lines      148502   148513      +11     
  Branches    42383    42397      +14     
==========================================
  Hits        53043    53043              
- Misses      95459    95470      +11     
Flag Coverage Δ
api 3.33% <ø> (ø)
api-domains-auth-admin 48.49% <ø> (ø)
api-domains-communications 39.42% <50.00%> (+<0.01%) ⬆️
application-system-api 38.75% <50.00%> (+0.01%) ⬆️
application-template-api-modules 27.83% <50.00%> (+<0.01%) ⬆️
cms 0.39% <0.00%> (-0.01%) ⬇️
cms-translations 38.75% <50.00%> (+<0.01%) ⬆️
judicial-system-api 20.21% <ø> (ø)
judicial-system-backend 55.91% <50.00%> (-0.01%) ⬇️
services-user-notification 46.54% <50.00%> (+<0.01%) ⬆️
web 2.40% <0.00%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
apps/web/screens/queries/Events.ts 0.00% <ø> (ø)
libs/cms/src/lib/models/event.model.ts 41.55% <50.00%> (+0.22%) ⬆️
apps/web/pages/api/rss/index.ts 0.00% <0.00%> (ø)

... and 2 files 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 478aa01...f2ca20e. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Dec 17, 2024

Datadog Report

All test runs 952e802 🔗

35 Total Test Services: 0 Failed, 33 Passed
🔻 Test Sessions change in coverage: 1 decreased (-0.58%), 156 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
air-discount-scheme-web 0 0 0 2 0 7.61s 1 no change Link
api 0 0 0 4 0 3.12s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 13.6s 1 no change Link
api-domains-communications 0 0 0 5 0 36.07s 1 no change Link
api-domains-license-service 0 0 0 0 0 521.06ms 1 no change Link
application-api-files 0 0 0 2 0 4.39s 1 no change Link
application-core 0 0 0 97 0 15.15s 1 no change Link
application-system-api 0 0 0 46 0 2m 7.12s 1 no change Link
application-template-api-modules 0 0 0 118 0 2m 4.71s 1 no change Link
application-templates-accident-notification 0 0 0 148 0 20.79s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (1)

  • shared-components - jest 37.03% (-0.58%) - Details

@RunarVestmann RunarVestmann marked this pull request as ready for review December 17, 2024 15:58
@RunarVestmann RunarVestmann requested review from a team as code owners December 17, 2024 15:58
@RunarVestmann RunarVestmann added the automerge Merge this PR as soon as all checks pass label Dec 17, 2024
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: 3

🧹 Nitpick comments (3)
apps/web/pages/api/rss/index.ts (2)

26-31: Simplify TypeScript Optional Properties in 'Item' Interface

The properties date and description in the Item interface can be simplified by using optional properties. Instead of explicitly including undefined and null in the type, you can define them as optional properties with string | null.

Apply this diff to simplify the interface:

 interface Item {
-  date: string | null | undefined
+  date?: string | null
   fullUrl: string
   title: string
-  description: string | null | undefined
+  description?: string | null
 }

181-193: Handle Possible Undefined Values in Event Time

In the event content type handling, the code assumes that item.time.startTime and item.time.endTime are present. If these values are undefined, it could lead to 'undefined' strings in the RSS feed.

Add null checks or default values to ensure that the time strings are correctly formatted.

 const formattedStartDate = format(
   new Date(item.startDate),
   'dd. MMMM yyyy',
   {
     locale: localeMap[locale],
   },
 )

 return generateItemString({
   title: item.title,
   description: `${formattedStartDate} ${
-    item.time.startTime as string
+    item.time.startTime || ''
   } ${item.time.endTime ? '-' : ''} ${
-    item.time.endTime as string
+    item.time.endTime || ''
   }`,
   fullUrl: organization
libs/cms/src/lib/models/event.model.ts (1)

81-82: Add Documentation for 'firstPublishedAt' Field

For consistency and clarity, consider adding a comment or JSDoc annotation to the new firstPublishedAt field explaining its purpose.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c07421f and 375a3bd.

📒 Files selected for processing (3)
  • apps/web/pages/api/rss/index.ts (3 hunks)
  • apps/web/screens/queries/Events.ts (1 hunks)
  • libs/cms/src/lib/models/event.model.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
apps/web/screens/queries/Events.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
libs/cms/src/lib/models/event.model.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."
apps/web/pages/api/rss/index.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
🔇 Additional comments (2)
apps/web/pages/api/rss/index.ts (1)

195-202: ⚠️ Potential issue

Provide Default URL When Organization is Undefined

In the event content type, when organization is not provided, the fullUrl defaults to an empty string. This could result in RSS items with missing links.

Ensure that a valid URL is provided even when organization is undefined.

Check if item.slug can be used to construct the URL when organization is not specified. You might adjust the fullUrl assignment:

 fullUrl: organization
   ? `${baseUrl}${
       linkResolver(
         'organizationevent',
         [organization, item.slug],
         locale,
       ).href
     }`
-  : '',
+  : `${baseUrl}${linkResolver('event', [item.slug], locale).href}`,
apps/web/screens/queries/Events.ts (1)

62-62: Ensure 'firstPublishedAt' Field Exists and Is Accessible

The addition of the firstPublishedAt field to the GET_EVENTS_QUERY requires that this field is available and correctly resolved in the GraphQL schema.

Run the following script to confirm that firstPublishedAt is available in the Event type:

✅ Verification successful

firstPublishedAt field is available and properly defined

The field firstPublishedAt is correctly defined in the GraphQL schema as part of the Sys type, which is accessible through the sys field that every entry implements via the Entry interface. The field is being properly used in the GET_EVENTS_QUERY query.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if 'firstPublishedAt' field exists in the GraphQL schema for Event.

# Fetch the schema and search for 'firstPublishedAt' in the Event type
curl -s 'https://your-graphql-endpoint/graphql' \
  -H 'Content-Type: application/json' \
  -d '{"query":"{ __type(name: \"Event\") { fields { name } } }"}' \
  | jq '.data.__type.fields[] | select(.name == "firstPublishedAt")'

Length of output: 215


Script:

#!/bin/bash
# Search for GraphQL schema definitions or type definitions containing 'firstPublishedAt'
rg -l "firstPublishedAt" --type graphql

# Search for GraphQL query definitions containing 'firstPublishedAt'
rg "type\s+Event\b" -A 10 -B 10 --type graphql

# Look for TypeScript interfaces or types related to Event
ast-grep --pattern 'interface Event {
  $$$
}'

# Search for any usage of firstPublishedAt in the codebase
rg "firstPublishedAt" -A 2 -B 2

Length of output: 72512


Script:

#!/bin/bash
# Search for GraphQL schema type definitions for Event
rg "type\s+Event\s*{" -A 20 libs/clients/cms/schema.graphql

# Search for GraphQL queries using firstPublishedAt field
rg "query.*\{" -A 10 -B 2 apps/web/screens/queries/Events.ts

Length of output: 734


Script:

#!/bin/bash
# Search for Event type definition with fixed regex
rg "type Event \{" -A 20 libs/clients/cms/schema.graphql

# Search for sys field definitions that might contain firstPublishedAt
rg "type Sys \{" -A 10 libs/clients/cms/schema.graphql

# Look for any interface definitions that might include firstPublishedAt
rg "interface \w+ \{" -A 10 libs/clients/cms/schema.graphql

Length of output: 1057

apps/web/pages/api/rss/index.ts Show resolved Hide resolved
apps/web/pages/api/rss/index.ts Show resolved Hide resolved
libs/cms/src/lib/models/event.model.ts Show resolved Hide resolved
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: 4

🧹 Nitpick comments (1)
apps/web/pages/api/rss/index.ts (1)

103-121: Refactor to eliminate code duplication in item processing

The logic for fetching data and generating itemString for 'news', 'genericList', and 'event' content types is similar. Consider refactoring the code to reduce duplication by creating a common function or utilizing a more generic approach.

For example, you could create a function that handles data fetching and item string generation based on the content type.

Also applies to: 143-162, 179-208

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c07421f and 375a3bd.

📒 Files selected for processing (3)
  • apps/web/pages/api/rss/index.ts (3 hunks)
  • apps/web/screens/queries/Events.ts (1 hunks)
  • libs/cms/src/lib/models/event.model.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
apps/web/screens/queries/Events.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/web/pages/api/rss/index.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
libs/cms/src/lib/models/event.model.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 (1)
apps/web/screens/queries/Events.ts (1)

62-62: Verify that firstPublishedAt is available in the GraphQL schema

Ensure that the firstPublishedAt field exists in the GraphQL schema for the Event type and that it is being correctly resolved. Missing or misconfigured fields can lead to runtime errors.

Run the following script to check if firstPublishedAt is available in the Event type:

If the output is empty, the field is not present and needs to be added to the schema.

✅ Verification successful

firstPublishedAt field is correctly defined and used in the codebase

The field is properly defined in the CMS schema and is actively used across the codebase:

  • Defined in libs/cms/src/lib/models/event.model.ts as part of the Event model
  • Present in the Contentful CMS schema at libs/clients/cms/schema.graphql
  • Actively used in multiple places including the Events query and RSS feed generation
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the `firstPublishedAt` field in the GraphQL schema for `Event`

# Fetch the schema and search for `firstPublishedAt` in `Event` type
gh api graphql -f query='
{
  __type(name: "Event") {
    fields {
      name
    }
  }
}' | jq '.data.__type.fields[] | select(.name=="firstPublishedAt")'

Length of output: 215


Script:

#!/bin/bash
# Let's check the schema definition files in the repository
fd "schema.*" --type f --exec rg -l "firstPublishedAt"

# Also search for GraphQL type definitions containing Event
fd ".*\.(graphql|gql)" --type f --exec rg -A 5 -B 5 "type Event"

# Search for any GraphQL queries using firstPublishedAt
rg "firstPublishedAt" --type ts

Length of output: 4903

apps/web/pages/api/rss/index.ts Show resolved Hide resolved
apps/web/pages/api/rss/index.ts Show resolved Hide resolved
apps/web/pages/api/rss/index.ts Show resolved Hide resolved
libs/cms/src/lib/models/event.model.ts Show resolved Hide resolved
@RunarVestmann RunarVestmann added the deploy-feature Deploys features to dev label Dec 18, 2024
Copy link
Contributor

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

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

@kodiakhq kodiakhq bot merged commit 5c7ec7a into main Dec 18, 2024
85 checks passed
@kodiakhq kodiakhq bot deleted the feature/web-rss-feeds branch December 18, 2024 10:07
RunarVestmann added a commit that referenced this pull request Jan 6, 2025
* WIP

* Add support for generic list items and events

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
kodiakhq bot added a commit that referenced this pull request Jan 6, 2025
* feat(web): RSS feed for events and generic list items (#17270)

* WIP

* Add support for generic list items and events

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix(web): RSS feed - Lowercase t in "contentType" query param (#17282)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix(web): RSS feed - Event dates should show single digit for date if it can (#17297)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
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 deploy-feature Deploys features to dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants