Add deletedAt timestamps to delete operations for better audit tracking
- Updated delete methods across hooks and components to include `deletedAt: System.timeStampInSeconds()`. - Refactored synchronized delete logic to pass `deletedAt` for both offline and online states. - Improved synchronization workflows to include `deletedAt` in server and IPC requests. - Enhanced destructuring patterns for cleaner and more consistent request data.
This commit is contained in:
@@ -88,10 +88,12 @@ export default function Issues({issues, setIssues}: IssuesProps) {
|
||||
|
||||
try {
|
||||
let response: boolean;
|
||||
const deletedAt: number = System.timeStampInSeconds();
|
||||
if (isCurrentlyOffline() || book?.localBook) {
|
||||
response = await window.electron.invoke<boolean>('db:book:issue:remove', {
|
||||
bookId,
|
||||
issueId,
|
||||
deletedAt,
|
||||
});
|
||||
} else {
|
||||
response = await System.authDeleteToServer<boolean>(
|
||||
@@ -99,6 +101,7 @@ export default function Issues({issues, setIssues}: IssuesProps) {
|
||||
{
|
||||
bookId,
|
||||
issueId,
|
||||
deletedAt,
|
||||
},
|
||||
token,
|
||||
lang
|
||||
@@ -108,6 +111,7 @@ export default function Issues({issues, setIssues}: IssuesProps) {
|
||||
addToQueue('db:book:issue:remove', {
|
||||
bookId,
|
||||
issueId,
|
||||
deletedAt,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user