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

Implement restoration of dialogs #1543

Open
3 of 4 tasks
Tracked by #1138
oskogstad opened this issue Nov 29, 2024 · 1 comment
Open
3 of 4 tasks
Tracked by #1138

Implement restoration of dialogs #1543

oskogstad opened this issue Nov 29, 2024 · 1 comment
Assignees

Comments

@oskogstad
Copy link
Collaborator

oskogstad commented Nov 29, 2024

Introduction

This introduces restoration of dialogs in Dialogporten

Description

Dialogs are soft-deleted, and there is a separate "purge" action to hard-delete dialogs from the database. Soft-deletion are however as of now irreversible, but there is need to be able to restore them as the Altinn 3 integration might come into a state where a previously soft deleted instance is restored again.

Implementation

  • We generate a "restored" Altinn event
  • We retain system labels
  • We keep updatedAt as it was before deletion (opt-out of aggregate handling)
  • A new revision ID is returned in the header
  • Endpoint: /api/v1/serviceowner/dialogs/{dialogId}/actions/restore
  • Restoring a non-deleted dialog also returns 204 No Content, with the existing revision ID in the header
  • Remove (set to null) deletedAt and set the Deleted flag to false

Tasks

Preview Give feedback

Threat modelling

Preview Give feedback

Acceptance criteria

Scenario 1: Restoring a deleted dialog

GIVEN a soft-deleted dialog exists in the system
WHEN a request is made to /api/v1/serviceowner/dialogs/{dialogId}/actions/restore
THEN the dialog is restored, the deletedAt is set to null, the Deleted flag is set to false, and a "restored" Altinn event is generated.

Scenario 2: Restoring a non-deleted dialog

GIVEN a dialog exists that is not soft-deleted
WHEN a request is made to /api/v1/serviceowner/dialogs/{dialogId}/actions/restore
THEN a 204 No Content response is returned with the existing revision ID in the header.

Scenario 3: Retaining system labels

GIVEN a soft-deleted dialog with system labels exists
WHEN the dialog is restored
THEN the system labels remain unchanged.

Scenario 4: Preserving updatedAt

GIVEN a soft-deleted dialog exists with a specific updatedAt value
WHEN the dialog is restored
THEN the updatedAt value remains as it was before deletion, with no changes.

Scenario 5: Generating a new revision ID

GIVEN a soft-deleted dialog is restored
WHEN the restoration process completes successfully
THEN a new revision ID is returned in the response header.

@elsand
Copy link
Member

elsand commented Jan 8, 2025

From refinement:

  • Vi genererer en "restored" altinn-event
  • Vi beholder system labels
  • Vi beholder updatedAt som den var før sletting (opte-ut av aggregate-håndtering)
  • Ny revision id (gjøres manuelt), returneres i header
  • Endepunkt: /api/v1/serviceowner/dialogs/{dialogId}/actions/restore
  • Restore på ikke-slettet gir også 204 No content, med eksistrende revision-id i header
  • Fjerne (nulle) deletedAt og sette Deleted-flagg til false

Se SoftDeletableExtensions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Code Review og PR
Development

No branches or pull requests

3 participants