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

fix(graphql): Add SystemLabel search filter #1767

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

oskogstad
Copy link
Collaborator

Description

Related Issue(s)

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

Documentation

  • Documentation is updated (either in docs-directory, Altinnpedia or a separate linked PR in altinn-studio-docs., if applicable)

@oskogstad oskogstad requested a review from a team as a code owner January 30, 2025 14:35
Copy link
Contributor

coderabbitai bot commented Jan 30, 2025

📝 Walkthrough

Walkthrough

This pull request introduces a new filtering capability for dialogs by adding a systemLabel field to the GraphQL schema and related code. The changes span multiple files, including the GraphQL schema definition, object types, and mapping configurations. A new SystemLabel enum has been created with values like Default, Bin, and Archive, enabling more granular dialog filtering. The modifications enhance the search functionality by allowing users to filter dialogs based on system labels.

Changes

File Change Summary
docs/schema/V1/schema.verified.graphql Added systemLabel: [SystemLabel!] to SearchDialogInput type
src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/ObjectTypes.cs Added new SystemLabel enum with Default, Bin, Archive values
src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/ObjectTypes.cs Added SystemLabel property to SearchDialogInput class
src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/MappingProfile.cs Added mapping configuration for SystemLabel property
src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/ObjectTypes.cs Removed unused import statement
src/Digdir.Domain.Dialogporten.GraphQL/EndUser/MutationTypes/ObjectTypes.cs Removed SystemLabel enum

Possibly related issues

Possibly related PRs

Suggested reviewers

  • arealmaas

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
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: 0

🧹 Nitpick comments (4)
src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/ObjectTypes.cs (1)

121-127: Add GraphQLDescription attributes for consistency.

Other enums in this file have GraphQLDescription attributes that provide valuable context in the GraphQL schema. Consider adding descriptions for the SystemLabel values:

 public enum SystemLabel
 {
+    [GraphQLDescription("Default system label for dialogs")]
     Default = 1,
+    [GraphQLDescription("Indicates that the dialog has been moved to bin")]
     Bin = 2,
+    [GraphQLDescription("Indicates that the dialog has been archived")]
     Archive = 3
 }
src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/ObjectTypes.cs (1)

107-109: Enhance the GraphQLDescription for better clarity.

Consider providing more context in the description about the available system labels and their purpose:

-    [GraphQLDescription("Filter by system label")]
+    [GraphQLDescription("Filter dialogs by system label (Default, Bin, Archive). Multiple labels can be specified to include dialogs with any of the specified labels.")]
     public List<SystemLabel>? SystemLabel { get; init; }
docs/schema/V1/schema.verified.graphql (2)

299-300: Enhance the field documentation comment.

The documentation comment for the systemLabel field could be more descriptive to better explain its purpose and valid values.

Consider updating the comment to:

-  "Filter by system label"
+  "Filter dialogs by system label (DEFAULT, BIN, ARCHIVE). Multiple values can be provided to include dialogs with any of the specified labels."

Line range hint 1-461: Schema integrity is well maintained.

The addition of the systemLabel filter maintains schema integrity with:

  • Consistent type usage across queries and mutations
  • Proper enum definition and error handling
  • Appropriate authorization controls

Consider adding integration tests to verify:

  1. The new filter works with other existing filters
  2. The filter handles empty arrays correctly
  3. Performance impact of filtering by system label
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 15484b5 and 3caf79b.

📒 Files selected for processing (6)
  • docs/schema/V1/schema.verified.graphql (2 hunks)
  • src/Digdir.Domain.Dialogporten.GraphQL/EndUser/Common/ObjectTypes.cs (1 hunks)
  • src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/ObjectTypes.cs (0 hunks)
  • src/Digdir.Domain.Dialogporten.GraphQL/EndUser/MutationTypes/ObjectTypes.cs (1 hunks)
  • src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/MappingProfile.cs (1 hunks)
  • src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/ObjectTypes.cs (1 hunks)
💤 Files with no reviewable changes (1)
  • src/Digdir.Domain.Dialogporten.GraphQL/EndUser/DialogById/ObjectTypes.cs
🔇 Additional comments (3)
src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/MappingProfile.cs (1)

14-14: LGTM! Clean and consistent mapping configuration.

The SystemLabel mapping follows the same pattern as other properties and is correctly configured.

src/Digdir.Domain.Dialogporten.GraphQL/EndUser/MutationTypes/ObjectTypes.cs (1)

1-2: LGTM! Good refactoring of SystemLabel enum.

Moving the SystemLabel enum to Common namespace improves code organization as it's used across multiple features.

docs/schema/V1/schema.verified.graphql (1)

461-461: LGTM!

The formatting change to the UUID scalar specification URL is purely cosmetic and maintains the same functionality.

@oskogstad oskogstad merged commit 431c529 into main Jan 30, 2025
23 checks passed
@oskogstad oskogstad deleted the fix/add-system-label-to-gql-search-dialog-input branch January 30, 2025 14:56
oskogstad pushed a commit that referenced this pull request Jan 31, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.47.6](v1.47.5...v1.47.6)
(2025-01-31)


### Bug Fixes

* **graphql:** Add SystemLabel search filter
([#1767](#1767))
([431c529](431c529))


### Miscellaneous Chores

* **deps:** update dependency vitest to v3.0.4
([#1769](#1769))
([e43b119](e43b119))
* Test 0.5 sampler ratio in yt01
([#1770](#1770))
([cd69edb](cd69edb))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants