-
Notifications
You must be signed in to change notification settings - Fork 3
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
chore: Remove unused usings #1223
Conversation
📝 WalkthroughWalkthroughThe pull request introduces several changes across multiple files, primarily focusing on the handling and querying of dialog label assignment logs, as well as modifications to dialog creation and update processes. Key updates include the addition of new classes for handling search queries and results, enhancements to error handling in GraphQL mutations, and the removal of unused import statements in various files. Additionally, the test suite for dialog creation has been expanded to include new validation scenarios. Changes
Possibly related PRs
Suggested reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
Quality Gate passedIssues Measures |
There was a problem hiding this 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
🧹 Outside diff range comments (2)
src/Digdir.Domain.Dialogporten.Application/Features/V1/WellKnown/OauthAuthorizationServer/Queries/Get/GetOauthAuthorizationServerQuery.cs (1)
Line range hint
9-30
: LGTM: Handler implementation remains correct.The implementation of
GetOauthAuthorizationServerQueryHandler
is unchanged, which aligns with the PR objective. A few observations:
- The use of
Constants.DialogTokenIssuerVersion
in the URL construction is correct and follows the project's conventions.- The hardcoded string
"/.well-known/jwks.json"
is a standard endpoint for JWKS and doesn't need to be replaced with a constant.Consider adding a comment explaining the use of the hardcoded
"/.well-known/jwks.json"
string to improve code readability and maintainability.tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Dialogs/Commands/CreateDialogTests.cs (1)
Line range hint
35-52
: LGTM: New test for UUIDv7 little-endian format validationThis new test case effectively ensures that a dialog cannot be created with a UUIDv7 in little-endian format. The test logic is sound, and it follows the existing naming conventions and structure of other tests in the file.
Consider using a constant or a more descriptive variable name for the hardcoded GUID to improve readability and maintainability. For example:
private const string UuidV7LittleEndian = "638e9101-6bc7-7975-b392-ba5c5a528c23"; var invalidDialogId = Guid.Parse(UuidV7LittleEndian);This change would make the intent clearer and easier to update if needed.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
📒 Files selected for processing (10)
- src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogLabelAssignmentLog/Queries/Search/SearchDialogLabelAssignmentLogQuery.cs (0 hunks)
- src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/MappingProfile.cs (0 hunks)
- src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/CreateDialogCommand.cs (0 hunks)
- src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogDto.cs (0 hunks)
- src/Digdir.Domain.Dialogporten.Application/Features/V1/WellKnown/OauthAuthorizationServer/Queries/Get/GetOauthAuthorizationServerQuery.cs (1 hunks)
- src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogCreatedDomainEvent.cs (0 hunks)
- src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDeletedDomainEvent.cs (0 hunks)
- src/Digdir.Domain.Dialogporten.GraphQL/EndUser/MutationTypes/Mutations.cs (0 hunks)
- tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/EndUser/Dialogs/Queries/DeletedDialogTests.cs (0 hunks)
- tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Dialogs/Commands/CreateDialogTests.cs (1 hunks)
💤 Files with no reviewable changes (8)
- src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/DialogLabelAssignmentLog/Queries/Search/SearchDialogLabelAssignmentLogQuery.cs
- src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Get/MappingProfile.cs
- src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/CreateDialogCommand.cs
- src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogDto.cs
- src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogCreatedDomainEvent.cs
- src/Digdir.Domain.Dialogporten.Domain/Dialogs/Events/DialogDeletedDomainEvent.cs
- src/Digdir.Domain.Dialogporten.GraphQL/EndUser/MutationTypes/Mutations.cs
- tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/EndUser/Dialogs/Queries/DeletedDialogTests.cs
🧰 Additional context used
📓 Learnings (2)
src/Digdir.Domain.Dialogporten.Application/Features/V1/WellKnown/OauthAuthorizationServer/Queries/Get/GetOauthAuthorizationServerQuery.cs (1)
Learnt from: oskogstad PR: digdir/dialogporten#1124 File: src/Digdir.Domain.Dialogporten.Application/Features/V1/WellKnown/OauthAuthorizationServer/Queries/Get/GetOauthAuthorizationServerQuery.cs:22-22 Timestamp: 2024-09-25T13:49:51.143Z Learning: Hardcoded `"/api/v1"` strings in the codebase correspond to external APIs the project integrates with and should not be replaced with internal constants.
tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Dialogs/Commands/CreateDialogTests.cs (1)
Learnt from: oskogstad PR: digdir/dialogporten#1210 File: tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Dialogs/Commands/CreateDialogTests.cs:282-282 Timestamp: 2024-10-01T17:03:49.291Z Learning: Using square brackets `[]` for collection initialization is acceptable in the codebase's C# code.
🔇 Additional comments (7)
src/Digdir.Domain.Dialogporten.Application/Features/V1/WellKnown/OauthAuthorizationServer/Queries/Get/GetOauthAuthorizationServerQuery.cs (1)
1-3
: LGTM: Unused import removed successfully.The removal of the unused import
Digdir.Domain.Dialogporten.Application.Common.Authorization
aligns with the PR objective of removing unused usings. The remaining imports are kept intact, which is correct as they are likely still in use within the file.tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Dialogs/Commands/CreateDialogTests.cs (6)
1-6
: LGTM: Unused using directives removedThe removal of unused using directives, including
Castle.Core.Logging
, aligns with the PR objective. The remaining using directives are relevant to the tests in this file. This change improves code cleanliness and reduces potential confusion.
Line range hint
17-33
: LGTM: New test for UUIDv4 format validationThis new test case effectively ensures that a dialog cannot be created with a UUIDv4 format. The test logic is sound, and it follows the existing naming conventions and structure of other tests in the file.
Line range hint
54-114
: LGTM: New tests for timestamp validation in dialog creationThese new test cases effectively cover important scenarios for dialog creation with different timestamp conditions:
- Preventing creation with a future timestamp
- Allowing creation with a past timestamp
- Successful creation of a simple dialog
The test logic is sound, and the methods follow the existing naming conventions and structure. The consistent use of
GenerateBigEndianUuidV7
across the tests is good for maintaining uniformity in ID generation.
Line range hint
116-224
: LGTM: Comprehensive tests for UpdatedAt and CreatedAt validationThese new test cases effectively cover various scenarios involving UpdatedAt and CreatedAt timestamps:
- Creating a dialog with UpdatedAt supplied
- Preventing creation when UpdatedAt is supplied without CreatedAt
- Preventing creation when UpdatedAt is earlier than CreatedAt
- Preventing creation with future timestamps
- Allowing creation when UpdatedAt and CreatedAt are equal
The test logic is sound, and the methods follow the existing naming conventions and structure. These tests ensure that the business rules for UpdatedAt and CreatedAt are properly enforced.
Line range hint
226-290
: LGTM: Thorough tests for transmission content validationThese new test cases effectively cover various scenarios involving transmission content:
- Preventing creation of a transmission without content
- Preventing creation of a transmission without content value
- Preventing creation of a transmission with empty content localization values
The test logic is sound, and the methods follow the existing naming conventions and structure. These tests ensure that the business rules for transmission content are properly enforced.
The use of collection initialization with square brackets
[]
is consistent with the learning from oskogstad in PR #1210, which is good for maintaining consistency across the codebase.
Line range hint
1-290
: Great job on expanding test coverage!This PR successfully removes unused using directives and significantly expands the test coverage for the
CreateDialog
command. The new test cases cover a wide range of scenarios, including:
- UUID format validation
- Timestamp validation for dialog creation
- UpdatedAt and CreatedAt validation
- Transmission content validation
All new tests follow the existing naming conventions and code style, maintaining consistency throughout the file. These additions will greatly improve the robustness of the test suite and help catch potential issues in the dialog creation process.
Summary by CodeRabbit
Release Notes
New Features
SetSystemLabel
method, providing detailed feedback for various outcomes.Bug Fixes
Chores