From d6a60214a2fc3213db55010d88f5dcbfe7a2d566 Mon Sep 17 00:00:00 2001 From: David Dworken Date: Sun, 28 Apr 2024 13:41:30 -0700 Subject: [PATCH] Update backend to avoid persisting entries to be read by devices that have been uninstalled --- backend/server/internal/database/device.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/server/internal/database/device.go b/backend/server/internal/database/device.go index f817deb..8953201 100644 --- a/backend/server/internal/database/device.go +++ b/backend/server/internal/database/device.go @@ -52,7 +52,7 @@ func (db *DB) CreateDevice(ctx context.Context, device *Device) error { func (db *DB) DevicesForUser(ctx context.Context, userID string) ([]*Device, error) { var devices []*Device - tx := db.WithContext(ctx).Where("user_id = ?", userID).Find(&devices) + tx := db.WithContext(ctx).Where("user_id = ? AND uninstall_date IS NULL", userID).Find(&devices) if tx.Error != nil { return nil, fmt.Errorf("tx.Error: %w", tx.Error) }