8000 feat(app): Add ExternalReference to Transmission by oskogstad · Pull Request #2348 · Altinn/dialogporten · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(app): Add ExternalReference to Transmission #2348

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

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)

Copy link
Contributor
coderabbitai bot commented May 24, 2025
📝 Walkthrough

Walkthrough

A new nullable string property, ExternalReference, has been introduced across multiple DTOs, domain entities, API schemas, and client interfaces related to dialog transmissions and dialogs. The property is validated for maximum length, included in API documentation, and database schema, and is covered by new and updated tests.

Changes

File(s) Change Summary
docs/schema/V1/swagger.verified.json Added externalReference property (nullable string) to multiple schema objects for transmissions and dialogs.
src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/.../TransmissionDto.cs Added ExternalReference property to TransmissionDto.
src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/CreateDialogDto.cs
src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogDto.cs
Added ExternalReference property to TransmissionDto in create and update DTOs.
src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/Validators/CreateDialogDialogTransmissionDtoValidator.cs
src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/Validators/UpdateDialogDialogTransmissionDtoValidator.cs
Added validation for ExternalReference maximum length.
src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/DialogDto.cs Added ExternalReference to DialogTransmissionDto and DialogDto.
src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Transmissions/DialogTransmission.cs Added ExternalReference property to the DialogTransmission entity.
src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20250526153145_AddTransmissionExternalReference.cs Added migration to introduce ExternalReference column to DialogTransmission table.
src/Digdir.Library.Dialogporten.WebApiClient/Features/V1/RefitterInterface.cs Added ExternalReference property to several DTOs with JSON serialization attributes and documentation.
tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Transmissions/Commands/CreateTransmissionTests.cs Added tests for creating transmissions with ExternalReference and validation for maximum length.
tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests/ObjectTypes/TransmissionTests.cs Updated ignore list in property comparison to include ExternalReference.

Suggested reviewers

  • MagnusSandgren
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

@@ -11,5 +11,7 @@ public void Configure(EntityTypeBuilder<DialogTransmission> builder)
builder.HasOne(x => x.RelatedTransmission)
.WithMany(x => x.RelatedTransmissions)
.OnDelete(DeleteBehavior.SetNull);

builder.HasIndex(x => x.ExternalReference);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@MagnusSandgren
Ble vi enige om å droppe index her? 🤔
Hvis det ikke skal inn som søkeparameter

@oskogstad oskogstad marked this pull request as ready for review May 26, 2025 16:12
@oskogstad oskogstad requested a review from a team as a code owner May 26, 2025 16:12
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: 5

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 229945f and 20209b1.

⛔ Files ignored due to path filters (2)
  • src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20250526153145_AddTransmissionExternalReference.Designer.cs is excluded by !**/Migrations/**/*Designer.cs
  • src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/DialogDbContextModelSnapshot.cs is excluded by !**/Migrations/DialogDbContextModelSnapshot.cs
📒 Files selected for processing (12)
  • docs/schema/V1/swagger.verified.json (6 hunks)
  • src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Search/TransmissionDto.cs (1 hunks)
  • src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/CreateDialogDto.cs (1 hunks)
  • src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/Validators/CreateDialogDialogTransmissionDtoValidator.cs (1 hunks)
  • src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogDto.cs (1 hunks)
  • src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/Validators/UpdateDialogDialogTransmissionDtoValidator.cs (1 hunks)
  • src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/DialogDto.cs (1 hunks)
  • src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Transmissions/DialogTransmission.cs (1 hunks)
  • src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20250526153145_AddTransmissionExternalReference.cs (1 hunks)
  • src/Digdir.Library.Dialogporten.WebApiClient/Features/V1/RefitterInterface.cs (5 hunks)
  • tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Transmissions/Commands/CreateTransmissionTests.cs (2 hunks)
  • tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests/ObjectTypes/TransmissionTests.cs (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests/ObjectTypes/TransmissionTests.cs (1)
src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Transmissions/DialogTransmission.cs (1)
  • DialogTransmission (14-67)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Dry run deploy apps / Deploy graphql to test
  • GitHub Check: Dry run deploy apps / Deploy service to test
  • GitHub Check: Dry run deploy apps / Deploy web-api-eu to test
  • GitHub Check: Dry run deploy apps / Deploy web-api-so to test
  • GitHub Check: build / build-and-test
🔇 Additional comments (20)
src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/Validators/CreateDialogDialogTransmissionDtoValidator.cs (1)

27-28: LGTM! Validation follows established patterns.

The validation rule for ExternalReference correctly applies a maximum length constraint and follows the same pattern as other string property validations in this validator.

src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/Validators/UpdateDialogDialogTransmissionDtoValidator.cs (1)

27-28: Excellent consistency between validators.

The validation rule for ExternalReference matches the create validator implementation, ensuring consistent validation behavior across create and update operations.

tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests/ObjectTypes/TransmissionTests.cs (1)

19-20: Verify that excluding ExternalReference from GraphQL is intentional.

The test correctly excludes ExternalReference from GraphQL property matching. Please confirm this design decision aligns with requirements - is ExternalReference intended to be an internal/administrative field not exposed to GraphQL consumers?

src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Transmissions/DialogTransmission.cs (1)

25-25: Clean domain entity property addition.

The ExternalReference property is well-placed and appropriately typed as a nullable string for an optional external reference field.

src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Create/CreateDialogDto.cs (4)

57-59: LGTM: Consistent implementation of ExternalReference property

The addition of the ExternalReference property to the CreateDialogDto class is well-implemented with clear documentation and appropriate nullable string type for an optional service-specific reference.


196-199: LGTM: Consistent property addition to TransmissionDto

The ExternalReference property is consistently implemented in the TransmissionDto class with matching documentation and type definition. The positioning near other optional properties is logical.


57-60: Well-implemented feature addition.

The ExternalReference property is properly implemented with clear documentation and appropriate nullable string type. The placement alongside ExtendedStatus makes logical sense for service-specific metadata.


196-200: Consistent implementation in TransmissionDto.

The ExternalReference property follows the same pattern as the main dialog DTO with consistent documentation and type. The implementation maintains consistency across the nested DTO structure.

src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Commands/Update/UpdateDialogDto.cs (4)

28-30: LGTM: Consistent ExternalReference implementation across DTOs

The ExternalReference property addition to UpdateDialogDto maintains consistency with the create DTO, using the same type, documentation, and logical positioning.


147-150: LGTM: Aligned implementation in TransmissionDto

The ExternalReference property implementation in the update TransmissionDto is consistent with the create version, ensuring API coherence across different operations.


28-31: Consistent implementation across create and update DTOs.

The ExternalReference property implementation mirrors the create DTO with identical documentation and type. This maintains consistency across the command operations.


147-151: Proper transmission DTO consistency.

The nested TransmissionDto implementation maintains the same pattern as the create command, ensuring consistent API behavior across all dialog operations.

src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/DialogTransmissions/Queries/Search/TransmissionDto.cs (2)

31-34: LGTM: Consistent ExternalReference in query DTO

The ExternalReference property implementation in the search query TransmissionDto maintains consistency with command DTOs, ensuring the property is available across all transmission-related operations.


31-35: Query DTO maintains consistency with command operations.

The ExternalReference property implementation in the query DTO is consistent with the command DTOs, ensuring uniform API behavior across all transmission-related operations.

src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20250526153145_AddTransmissionExternalReference.cs (1)

1-29: LGTM! Well-implemented EF Core migration.

The migration correctly adds the ExternalReference column to the DialogTransmission table with appropriate constraints:

  • Nullable string allowing optional external references
  • 255 character limit provides reasonable length for external system identifiers
  • Proper rollback capability in the Down method
  • Follows EF Core migration best practices
tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Transmissions/Commands/CreateTransmissionTests.cs (2)

174-198: Excellent test coverage for ExternalReference functionality.

This test effectively validates the core functionality by:

  • Creating transmissions with distinct external reference values
  • Verifying persistence through the full create-retrieve cycle
  • Using appropriate assertions to confirm both transmissions are stored correctly
  • Following the established AAA pattern and testing conventions

200-219:

✅ Verification successful

Good validation test for max length constraint.

The test properly validates the ExternalReference length constraint by creating an oversized string and verifying the validation error response. The test follows established patterns and uses appropriate assertions.

Verify that Constants.DefaultMaxStringLength aligns with the migration's 255 character limit:


🏁 Script executed:

#!/bin/bash
# Description: Verify that the constant used in tests matches the migration constraint
# Expected: Constants.DefaultMaxStringLength should be 255 to match the migration

# Search for the constant definition
rg -A 2 "DefaultMaxStringLength.*=" --type cs

# Search for any other references to this constant in relation to ExternalReference
rg "DefaultMaxStringLength.*ExternalReference|ExternalReference.*DefaultMaxStringLength" --type cs

Length of output: 664


Constant Alignment Verified: DefaultMaxStringLength = 255

The test’s use of Constants.DefaultMaxStringLength + 1 correctly exceeds the 255-character limit defined in the database migration. No changes needed.

• Constant defined in src/Digdir.Domain.Dialogporten.Domain/Common/Constants.cs
• Referenced in tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/ServiceOwner/Transmissions/Commands/CreateTransmissionTests.cs

src/Digdir.Library.Dialogporten.WebApiClient/Features/V1/RefitterInterface.cs (1)

926-931: LGTM! Consistent auto-generated ExternalReference property additions.

The auto-generated code correctly adds the ExternalReference property across all transmission-related DTOs with consistent:

  • Type definition (nullable string)
  • JSON serialization ([JsonPropertyName("externalReference")])
  • Documentation describing it as a service-specific external reference
  • Additive changes that maintain backwards compatibility

The pattern is consistently applied across search, create, update, and get operations for transmissions.

Also applies to: 1430-1435, 1913-1918, 3133-3138, 3922-3927

src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Get/DialogDto.cs (2)

85-91: Enhanced documentation provides good user guidance.

The ExternalReference property implementation includes helpful additional documentation directing users to service-specific documentation. This enhances the API usability while maintaining consistency with other DTOs.


227-231: Complete feature implementation across all DTO levels.

The DialogTransmissionDto implementation completes the consistent addition of ExternalReference across all dialog and transmission DTOs, ensuring comprehensive feature coverage.

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
0