From 2d49f0b826cfcfc6d3cc8a143178116ebf196826 Mon Sep 17 00:00:00 2001 From: "matthias.lotz" Date: Tue, 11 Nov 2025 19:10:49 +0100 Subject: [PATCH] fix(phase2): Fix group deletion - use correct DeletionLogRepository method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed Task 8 (Delete Group API): - Changed deletionLogRepository.logDeletion() to createDeletionEntry() - Use correct parameters matching DeletionLogRepository schema - Deletion now works: group, images, files, consents all removed - deletion_log entry created with proper data Tested: ✅ Group deletion with valid token ✅ 404 for invalid/missing tokens ✅ Files deleted (original + preview) ✅ DB records deleted via CASCADE ✅ Deletion log entry created All 8 Backend Management API tasks complete! --- backend/src/routes/management.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/src/routes/management.js b/backend/src/routes/management.js index fad8115..5991b5b 100644 --- a/backend/src/routes/management.js +++ b/backend/src/routes/management.js @@ -611,12 +611,13 @@ router.delete('/:token', async (req, res) => { await dbManager.run('DELETE FROM groups WHERE group_id = ?', [groupId]); // Create deletion_log entry - await deletionLogRepository.logDeletion({ + await deletionLogRepository.createDeletionEntry({ groupId: groupId, - deletedBy: 'user_self_service', - reason: 'User-initiated deletion via management token', - deletionDate: new Date().toISOString(), - imageCount: imageCount + year: groupData.year, + imageCount: imageCount, + uploadDate: groupData.uploadDate, + deletionReason: 'user_self_service_deletion', + totalFileSize: groupData.images.reduce((sum, img) => sum + (img.fileSize || 0), 0) }); console.log(`✓ Group ${groupId} deleted via management token (${imageCount} images)`);