-
Notifications
You must be signed in to change notification settings - Fork 214
Description
🐛 Problem
The chat deletion functionality is using hard delete (prismaClient.execution.delete()) which permanently removes chat records from the database. This creates compliance and audit issues, and prevents implementing an "undo delete" feature.
🔍 Current Behavior
javascriptawait prismaClient.execution.delete({
where: {
id: chatId
}
})
Chat records are permanently removed from database
No audit trail of deleted chats
Cannot recover accidentally deleted chats
Potential compliance violations
✅ Expected Behavior
Chat should be marked as deleted (soft delete) using a deletedAt timestamp or isDeleted boolean flag
Original chat data should remain in database for audit purposes
Should enable "undo delete" functionality
Maintain compliance with data retention policies
🔧 Suggested Solution
Replace hard delete with soft delete:
await prismaClient.execution.update({
where: {
id: chatId
},
data: {
deletedAt: new Date(),
// or isDeleted: true
}
})
📋 Acceptance Criteria
Chat deletion marks record as deleted instead of removing it
Deleted chats are filtered out of normal queries
Audit trail is maintained for compliance
"Undo delete" functionality can be implemented
Database migration handles existing data appropriately
🎯 Impact
Compliance Risk: High - Could cause audit failures
User Experience: Medium - No recovery option for accidental deletions
Technical Debt: Medium - Blocks undo functionality implementation