refactor: drop is_read and read_at from notifications table #59

Merged
rafaga21 merged 1 commits from feat/dashboard-aggregated-chart into master 2026-06-13 12:05:24 -04:00
2 changed files with 3 additions and 14 deletions

View File

@@ -0,0 +1,3 @@
ALTER TABLE `notifications`
DROP COLUMN `is_read`,
DROP COLUMN `read_at`;

View File

@@ -86,13 +86,6 @@ class Notification
} catch (\Throwable $e) {
// Already read, ignore
}
$this->db->update(
'notifications',
['is_read' => 1, 'read_at' => date('Y-m-d H:i:s')],
'id = ? AND (user_id IS NULL OR user_id = ?)',
[$id, $userId]
);
}
public function markAllAsRead(int $userId): void
@@ -119,13 +112,6 @@ class Notification
// Duplicate entry — already read, skip
}
}
$this->db->update(
'notifications',
['is_read' => 1, 'read_at' => $now],
'(user_id IS NULL OR user_id = ?) AND is_read = 0',
[$userId]
);
}
public function getAll(int $page = 1, int $perPage = 20): array