Skip to content

Allow restoring archived applications via PATCH API, MCP tool and web UI #69

Description

@vitorhugo-dotnet

Context

Application status and archive visibility are independent concerns. Currently, an application can have status Rejected and remain archived, but the API/MCP only exposes an archive action and there is no supported way to restore it to the normal list.

Observed examples include rejected applications from DB1 Group and Compass UOL that should be visible in the normal application list. The DQR Tech record should remain archived because its note states that no application was actually submitted.

Proposed solution

Implement a partial update operation for applications and expose it consistently through REST, MCP and the web UI.

Backend REST API

  • Add PATCH /api/v1/applications/{id}.
  • Accept a partial DTO; omitted fields must remain unchanged.
  • Initially support all fields already editable by the application form, including archived.
  • When archived changes to true, set archivedAt only if the record was not already archived.
  • When archived changes to false, clear archivedAt.
  • Keep the operation idempotent.
  • Reuse the existing authenticated-user ownership checks.
  • Keep the existing full update endpoint for backward compatibility.

Example:

PATCH /api/v1/applications/{id}
Content-Type: application/json

{
  "archived": false
}

MCP

  • Add a Patch-Application tool mapped to the new endpoint/service operation.
  • id is required; all patchable fields are optional.
  • Include archived in the MCP schema and tool description.
  • Return the updated application.
  • Do not require callers to resend boolean fields or unrelated application data.

Website

  • Add a Restore action to application cards/rows in the Archived tab.
  • Call the PATCH endpoint with { "archived": false }.
  • On success, remove the item from the archived list and invalidate/refetch the active applications query.
  • Preserve the current application status while restoring.
  • Changing an application status to Rejected must not automatically archive it; status and visibility must remain separate actions.

Acceptance criteria

  • An archived application can be restored through REST using a partial PATCH request.
  • Restoring clears archivedAt and returns archived: false.
  • Archiving through PATCH sets archivedAt and is idempotent.
  • MCP exposes Patch-Application and can restore an application without resending all fields.
  • The Archived tab exposes a Restore action with loading, success and error feedback.
  • Restored applications disappear from Archived and appear in the normal list.
  • The status remains unchanged after restore.
  • Setting status to Rejected does not archive automatically.
  • Ownership/authentication rules are covered by tests.
  • Add backend controller/service tests, MCP schema/tool tests and frontend interaction/query-invalidation tests.

Out of scope

  • Automatically restoring every existing rejected application.
  • Coupling any status value to automatic archive/unarchive behavior.
  • Removing the existing archive endpoint or full update operation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions