Admin & Mail backend-compatibility fixes: corrected bulk select-all counts and updated delete/notification APIs
Executive summary
This QA release aligns the Admin and Mail apps with recent backend API changes and fixes a bug where the bulk "Select All" preview count could be wrong. It bundles two changes: PR #877 (updated Admin delete and notification-policy calls) and PR #878 (workspace tenant-scoping fix for bulk-operation previews).
Why this was needed
The backend changed several API contracts and the frontend had to match them to keep features working. Most importantly, the bulk-operations preview was sending the tenant and grid-status identifiers in the request body, where the backend silently ignored them. As a result the preview count was not scoped to the selected tenant — a user could see "Select all 500 items" while the actual operation only affected their tenant's records (e.g. 50), an unsafe and confusing mismatch.
Client / user impact
- Mail: the "Select All" preview count now reflects only the records in the active workspace/tenant, so what users see matches what an operation will actually do.
- Admin: deleting folders, document types, and rules continues to work against the updated backend endpoints.
- Admin: notification policies save reliably with valid delivery-override options.
- Mail inbox status counts now update correctly when switching workspace tenants.
- No visible UI changes; this is a behind-the-scenes compatibility and correctness release.
Technical scope
Frontend changes across the Admin and Mail apps (8 files, +58/-26), grounded in the diff:
PR #877 — Admin delete endpoints + notification policy typing
apps/admin/src/services/admin.services.ts: switched 3 DELETE calls from queryparamsto JSONdatabodies — folders{ folder_ids, hard_delete, reassign_to_unassigned }, rules{ rule_ids, permanent }, document-types{ document_type_ids }.apps/admin/src/routes/admin.routes.ts: updated route doc comments to match the JSON-body contract.apps/admin/src/types/notification.types.ts+PolicyFormDialog/index.tsx: added aPolicyDeliveryOverrideunion (web | email | both | conditional) and tightened the zod schema / submit handler to it.
PR #878 — Workspace tenancy contract + bulk preview scoping fix
apps/mail/src/services/bulk-operations.services.ts: addedsplitBulkRequestParams()to movegrid_status_id→status_idandentity_id→tenant_idout of the JSON body and into query params for the preview and get-filtered-ids calls.apps/mail/src/constants/workspace-tenancy.ts: addedGET /api/v1/mails/inbox/status-countsto the workspace-aware operations list and bumped counts (56/54 → 57/55) and the contract snapshot date to 2026-03-17.apps/mail/src/types/bulk-operations.types.ts+BulkOperationPreviewRequest.ts: clarified JSDoc and fixed a stale comment (entity_id→tenant_id).
Risk & mitigation
Low-to-moderate risk. Changes are narrow API-contract alignments rather than new features, but they touch destructive Admin actions (delete folders/rules/document-types) and the bulk-operation flow, so a frontend/backend mismatch could break those operations or, if reverted, reintroduce the unscoped count. Mitigation: this is a QA-only promotion gated for testing before Production; the changes mirror the deployed backend contract, and the bulk fix is additive (body untouched fields pass through). Note the folder delete now hard-codes hard_delete: true and reassign_to_unassigned: true, and rule delete sends permanent: true — QA should confirm these defaults are the intended behavior.
QA validation focus
- Admin: delete folders, rules, and document types (single and bulk) and confirm each succeeds against the backend.
- Admin: confirm folder hard-delete + reassign-to-unassigned and rule permanent-delete behave as expected (records actually removed/reassigned).
- Admin: create and edit a notification policy with each delivery override (web, email, both, conditional, and default/none) and verify it saves correctly.
- Mail: with a specific tenant/workspace selected, click "Select All" on a grid and verify the preview count matches only that tenant's records, then run a bulk update/delete end-to-end.
- Mail: switch between workspace tenants and verify inbox status counts refresh correctly.
- Run
pnpm lint --filter=@dsm/mailandpnpm lint --filter=@dsm/admin.