add permanent purge functionality for wagons and routes

- Implemented a  method in  to permanently delete wagons without history.
- Added corresponding permissions for hard delete actions in .
- Updated the UI components to include purge actions, ensuring they are only available to users with the appropriate permissions.
- Created modals for confirming permanent deletions in  and .
- Enhanced API services to handle purge requests for locomotives, wagons, and routes.
- Added tests for the purge functionality in both  and  services to ensure proper behavior and error handling.
This commit is contained in:
Marshal
2026-08-04 14:07:16 +00:00
parent 8cf49aa1cc
commit 5d68a3f7b7
22 changed files with 806 additions and 20 deletions

View File

@@ -1605,6 +1605,15 @@ export const api = {
undefined,
() => [["routes"]],
),
/** Irreversible purge — refused while any train schedule uses the route. */
purge: endpoint<string, void>(
"routes",
"purge",
(id) => routesService.purge(id).then(() => undefined),
undefined,
() => [["routes"]],
),
},
stations: {
@@ -2194,6 +2203,15 @@ export const api = {
undefined,
({ slug }) => [QUERY_KEYS.FLEET.list(slug)],
),
/** Irreversible purge — locomotives and wagons only. */
purge: endpoint<{ slug: FleetResourceSlug; id: string }, unknown>(
"fleet",
"purge",
({ slug, id }) => fleetService.purge(slug, id),
undefined,
({ slug }) => [QUERY_KEYS.FLEET.list(slug)],
),
},
truckTypes: {