mirror of
https://github.com/ddworken/hishtory.git
synced 2025-08-18 10:49:54 +02:00
Roll-forward "Add preliminary support for persisting pre-saved history entries remotely"
This rolls-forward commit 66916c27cb
.
This commit is contained in:
@@ -600,7 +600,10 @@ func ProcessDeletionRequests(ctx context.Context) error {
|
||||
db := hctx.GetDb(ctx)
|
||||
for _, request := range deletionRequests {
|
||||
for _, entry := range request.Messages.Ids {
|
||||
res := db.Where("device_id = ? AND end_time = ?", entry.DeviceId, entry.Date).Delete(&data.HistoryEntry{})
|
||||
// Note that entry.StartTime is not always present (for legacy reasons) and entry.EndTime is also
|
||||
// not always present (for pre-saved entries). So we just check that one of them matches.
|
||||
tx := db.Where("device_id = ? AND (start_time = ? OR end_time = ?)", entry.DeviceId, entry.StartTime, entry.EndTime)
|
||||
res := tx.Delete(&data.HistoryEntry{})
|
||||
if res.Error != nil {
|
||||
return fmt.Errorf("DB error: %w", res.Error)
|
||||
}
|
||||
|
Reference in New Issue
Block a user