fix: prevent deleting registry entries that would create sequence gaps

Only the last entry in a company+year sequence can be deleted. Trying
to delete an earlier number (e.g. #2 when #3 exists) returns a 409
error with a Romanian message explaining the restriction.

Also routes UI deletes through the API (like create/update) so they
get proper audit logging and sequence recalculation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-11 22:38:51 +02:00
parent 5cb438ef67
commit 34024404a5
3 changed files with 70 additions and 5 deletions
@@ -216,7 +216,12 @@ export function RegistraturaModule() {
};
const handleDelete = async (id: string) => {
await removeEntry(id);
try {
await removeEntry(id);
} catch (err) {
const msg = err instanceof Error ? err.message : "Eroare la ștergere";
alert(msg);
}
};
/** All closes go through the close dialog */