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: Add additional types to DialogActivity #1629

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

Conversation

oskogstad
Copy link
Collaborator

@oskogstad oskogstad commented Dec 22, 2024

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 Dec 22, 2024

📝 Walkthrough

Walkthrough

This pull request introduces new dialog activity types to the Dialogporten system. The changes span multiple files across different layers of the application, including schema definitions, domain entities, cloud event mappings, database migrations, and test coverage. Six new activity types have been added: DialogDeleted, DialogRestored, SentToSigning, SentToFormFill, SentToSendIn, and SentToPayment. These additions enhance the system's ability to track and represent various dialog-related actions and states.

Changes

File Change Summary
docs/schema/V1/swagger.verified.json Added new enum values to DialogsEntitiesActivities_DialogActivityType schema
src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/CloudEventTypes.cs Added mappings for new dialog activity types in Get method
src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Activities/DialogActivityType.cs Added new enum values: DialogDeleted, DialogRestored, SentToSigning, SentToFormFill, SentToSendIn, SentToPayment
src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20241222195253_AddAdditionalActivityTypes.cs Created migration to insert new dialog activity types into database
tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/Common/Events/DomainEventsTests.cs Added test to ensure all dialog activity types have cloud event mappings

Possibly Related PRs

Suggested Reviewers

  • Fargekritt

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.

@oskogstad oskogstad marked this pull request as ready for review December 23, 2024 18:18
@oskogstad oskogstad requested a review from a team as a code owner December 23, 2024 18:18
Copy link

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 (1)
docs/schema/V1/swagger.verified.json (1)

86-92: Add descriptions for new activity types.

Consider adding descriptions for the new activity types to maintain consistency with the documentation standards in the schema. This will help API consumers understand when each activity type is used.

Example structure to add:

  "DialogsEntitiesActivities_DialogActivityType": {
    "description": "",
    "enum": [
      "DialogCreated",
      "DialogClosed",
      "Information",
      "TransmissionOpened",
      "PaymentMade",
      "SignatureProvided",
      "DialogOpened",
      "DialogDeleted",
      "DialogRestored",
      "SentToSigning",
      "SentToFormFill",
      "SentToSendIn",
      "SentToPayment"
    ],
+   "descriptions": {
+     "DialogOpened": "Indicates that the dialog was opened by the user",
+     "DialogDeleted": "Indicates that the dialog was deleted",
+     "DialogRestored": "Indicates that a previously deleted dialog was restored",
+     "SentToSigning": "Indicates that the dialog was sent for digital signing",
+     "SentToFormFill": "Indicates that the dialog was sent for form filling",
+     "SentToSendIn": "Indicates that the dialog was sent for submission",
+     "SentToPayment": "Indicates that the dialog was sent for payment processing"
+   },
    "type": "string",
    "x-enumNames": [
      ...
    ]
  }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 80261d1 and ccf3aee.

⛔ Files ignored due to path filters (2)
  • src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20241222195253_AddAdditionalActivityTypes.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 (5)
  • docs/schema/V1/swagger.verified.json (3 hunks)
  • src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/CloudEventTypes.cs (1 hunks)
  • src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Activities/DialogActivityType.cs (3 hunks)
  • src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20241222195253_AddAdditionalActivityTypes.cs (1 hunks)
  • tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/Common/Events/DomainEventsTests.cs (1 hunks)
🧰 Additional context used
📓 Learnings (1)
src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20241222195253_AddAdditionalActivityTypes.cs (2)
Learnt from: elsand
PR: digdir/dialogporten#1110
File: src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20240910063003_AddDialogActivityDialogOpened.cs:13-16
Timestamp: 2024-11-12T05:32:45.312Z
Learning: Do not consider style or maintainability issues in migration files generated by Entity Framework during code reviews.
Learnt from: elsand
PR: digdir/dialogporten#1110
File: src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20240910063003_AddDialogActivityDialogOpened.cs:13-16
Timestamp: 2024-11-12T05:32:45.312Z
Learning: Ensure that changes to domain entities are accompanied by corresponding migrations.
🔇 Additional comments (8)
src/Digdir.Domain.Dialogporten.Infrastructure/Persistence/Migrations/20241222195253_AddAdditionalActivityTypes.cs (2)

13-26: Migration inserts for new activity types look consistent.

All newly inserted activity types match the ID values in the domain enum. Migrations are in sync with domain changes and follow best practices.


30-61: Down migration ensures proper cleanup on rollback.

The down method correctly removes the same activity type records, preserving database integrity in case the migration is reverted.

src/Digdir.Domain.Dialogporten.Application/Features/V1/Common/Events/CloudEventTypes.cs (1)

24-29: Consistent naming of event type strings.

Each new case follows the naming pattern used elsewhere (e.g., “dialogporten.dialog.activity.xyz”). This consistency helps maintain traceability in logging and event consumers.

src/Digdir.Domain.Dialogporten.Domain/Dialogs/Entities/Activities/DialogActivityType.cs (2)

13-13: Documentation changes are clear and user-friendly.

Switching phrasing from “Refers to” to “Indicates that” is a minor but helpful improvement to clarity. No issues found.

Also applies to: 18-18, 28-28, 43-43


50-50: Newly added enum values match the existing pattern.

The additional dialog activity types align with the domain definitions and help represent a broader range of events. This change is well-structured and consistent with the existing enumerations.

Also applies to: 55-55, 60-60, 65-65, 70-70, 75-75

tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Features/V1/Common/Events/DomainEventsTests.cs (1)

35-47: Excellent coverage for newly added activity types.

This test ensures every DialogActivityType enum value has a corresponding mapping in CloudEventTypes. It efficiently prevents missing cases and fosters confidence in event consistency.

docs/schema/V1/swagger.verified.json (2)

86-92: LGTM! New dialog activity types added.

The new activity types follow a consistent naming pattern and cover important dialog lifecycle events and actions. The values are properly defined in both the enum and x-enumNames sections.

Also applies to: 102-108


86-92: Verify schema references to DialogActivityType.

Ensure that all components referencing DialogsEntitiesActivities_DialogActivityType properly handle the new activity types.

✅ Verification successful

Schema references to DialogActivityType are properly updated

The verification shows that:

  1. All references to DialogsEntitiesActivities_DialogActivityType are through $ref schema references, ensuring consistent type usage
  2. The enum definition includes all new activity types (DialogOpened, DialogDeleted, DialogRestored, SentToSigning, SentToFormFill, SentToPayment)
  3. Special handling for "Information" type activities is consistent across all components
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find all references to DialogActivityType in the schema
# and verify they properly handle the new values

# Search for references to DialogActivityType
rg -A 5 "DialogsEntitiesActivities_DialogActivityType" docs/schema/V1/swagger.verified.json

# Search for any potential hardcoded lists of activity types
# that might need updating
rg -A 5 "DialogCreated|DialogClosed|Information|TransmissionOpened|PaymentMade|SignatureProvided" docs/schema/V1/swagger.verified.json

Length of output: 5715

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.

1 participant