fix: hard-delete konten instead of soft-deactivate, convert kontonummer to INTEGER with arithmetic sub-account derivation
This commit is contained in:
@@ -415,8 +415,7 @@ async function updateKonto(
|
|||||||
|
|
||||||
async function deleteKonto(id: number) {
|
async function deleteKonto(id: number) {
|
||||||
try {
|
try {
|
||||||
// Soft delete
|
await pool.query(`DELETE FROM buchhaltung_konten WHERE id = $1`, [id]);
|
||||||
await pool.query(`UPDATE buchhaltung_konten SET aktiv = FALSE WHERE id = $1`, [id]);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('BuchhaltungService.deleteKonto failed', { error, id });
|
logger.error('BuchhaltungService.deleteKonto failed', { error, id });
|
||||||
throw new Error('Konto konnte nicht gelöscht werden');
|
throw new Error('Konto konnte nicht gelöscht werden');
|
||||||
|
|||||||
@@ -1002,7 +1002,7 @@ function KontenTab({ haushaltsjahre, selectedJahrId, onJahrChange }: {
|
|||||||
});
|
});
|
||||||
const deleteKontoMut = useMutation({
|
const deleteKontoMut = useMutation({
|
||||||
mutationFn: buchhaltungApi.deleteKonto,
|
mutationFn: buchhaltungApi.deleteKonto,
|
||||||
onSuccess: () => { qc.invalidateQueries({ queryKey: ['buchhaltung-konten'] }); qc.invalidateQueries({ queryKey: ['kontenTree'] }); showSuccess('Konto deaktiviert'); },
|
onSuccess: () => { qc.invalidateQueries({ queryKey: ['buchhaltung-konten'] }); qc.invalidateQueries({ queryKey: ['kontenTree'] }); showSuccess('Konto gelöscht'); },
|
||||||
onError: () => showError('Löschen fehlgeschlagen'),
|
onError: () => showError('Löschen fehlgeschlagen'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user