Skip to content

Conversation

@eiresendez
Copy link
Contributor

@eiresendez eiresendez commented Jan 12, 2026

Issue & Reproduction Steps

Admins need an API endpoint to delete Cases and their related Requests, as described in the product document. The absence of this endpoint forces manual cleanup and can leave inconsistent data.

Solution

  • Introduce a REST endpoint to delete a Case and all related Requests.
  • Ensure the operation removes dependent records tied to the case (core records first, dependencies later).
  • Enforce token-based access, and return proper HTTP statuses (204 success, 404 missing case, 401 unauthenticated, 409/500 on failures).
  • Keep the controller implementation clean and aligned with ProcessMaker API conventions.

How to Test

  • With a valid API token, call DELETE /api/1.0/cases/{case_number} for an existing case and verify it is no longer retrievable.
  • Call the same endpoint for a non-existent case and verify 404 is returned.
  • Verify that all requests linked to the case are removed and no orphaned records remain.

Related Tickets & Packages

ci:deploy
...

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

Note

Adds a transactional case deletion API and security logging.

  • API: New DELETE /cases/{case_number} in CaseController with OpenAPI docs and route; returns 204/404
  • Core logic: DeleteCase action + DeletesCaseRecords trait to cascade-delete process_requests, process_request_tokens, locks, scheduled tasks, inbox rules/logs, ABE tokens, comments, notifications (selected types), media, case_numbers, cases_started, cases_participated, and optional ellucian_ethos_sync_global_task_list; recount Saved Search counts post-commit when available
  • Security logs: New CaseDeleted event (includes deleted_at, case_number, title); registered in EventServiceProvider; dispatched after deletion
  • Stability/typing: Stronger type hints in API CaseController; CasesController@show aborts 404 when no requests and safely selects parent/first request; InboxRule deletes saved search only if class exists
  • Tests: CaseDeleteTest covers core/dependent record cleanup, notifications filtering, 404; SecurityLogsTest validates CaseDeleted logging
  • Factories: Added/updated for CaseNumber, InboxRuleLog, ProcessRequest (withCaseNumber), ProcessRequestLock, ScheduledTask (forToken)

Written by Cursor Bugbot for commit d6d9947. This will update automatically on new commits. Configure here.

@cursor
Copy link

cursor bot commented Jan 12, 2026

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on January 21.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@vladyrichter
Copy link

QA server K8S was successfully deployed https://ci-5a04878444.engk8s.processmaker.net

@vladyrichter
Copy link

QA server K8S was successfully deployed https://ci-5a04878444.engk8s.processmaker.net

@vladyrichter
Copy link

QA server K8S was successfully deployed https://ci-5a04878444.engk8s.processmaker.net

FOUR-28723 | Store Logs For Deleting Cases via API
@vladyrichter
Copy link

QA server K8S was successfully deployed https://ci-5a04878444.engk8s.processmaker.net

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@processmaker-sonarqube
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@vladyrichter
Copy link

QA server K8S was successfully deployed https://ci-5a04878444.engk8s.processmaker.net

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.

4 participants