fix(phase2): Fix group deletion - use correct DeletionLogRepository method
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!
This commit is contained in:
parent
c18c258135
commit
2d49f0b826
|
|
@ -611,12 +611,13 @@ router.delete('/:token', async (req, res) => {
|
||||||
await dbManager.run('DELETE FROM groups WHERE group_id = ?', [groupId]);
|
await dbManager.run('DELETE FROM groups WHERE group_id = ?', [groupId]);
|
||||||
|
|
||||||
// Create deletion_log entry
|
// Create deletion_log entry
|
||||||
await deletionLogRepository.logDeletion({
|
await deletionLogRepository.createDeletionEntry({
|
||||||
groupId: groupId,
|
groupId: groupId,
|
||||||
deletedBy: 'user_self_service',
|
year: groupData.year,
|
||||||
reason: 'User-initiated deletion via management token',
|
imageCount: imageCount,
|
||||||
deletionDate: new Date().toISOString(),
|
uploadDate: groupData.uploadDate,
|
||||||
imageCount: imageCount
|
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)`);
|
console.log(`✓ Group ${groupId} deleted via management token (${imageCount} images)`);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user