Skip to content

Commit edd81c2

Browse files
committed
model(notify): make use of updated_at column on users
1 parent fba9a3f commit edd81c2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Diff for: src/models/NotifyModel.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public static function update_fcm_device_token_for(string $sub, string $token):
1414
$query = <<<SQL
1515
UPDATE users SET
1616
fcm_device_token = :token
17+
updated_at = CURRENT_TIMESTAMP
1718
WHERE
1819
sub = :sub
1920
SQL;
@@ -33,7 +34,9 @@ public static function get_fcm_device_token_for(string $id): string|bool
3334
$pdo = Database::getConnection();
3435

3536
$query = <<<SQL
36-
SELECT fcm_device_token, wants_notifications
37+
SELECT
38+
fcm_device_token,
39+
wants_notifications
3740
FROM users
3841
WHERE id = :id
3942
SQL;
@@ -67,9 +70,11 @@ public static function update_notifications_for(string $sub, bool $wants_notific
6770
$pdo = Database::getConnection();
6871

6972
$query = <<<SQL
70-
UPDATE users
71-
SET wants_notifications = :wants_notifications
72-
WHERE sub = :sub
73+
UPDATE users SET
74+
wants_notifications = :wants_notifications
75+
updated_at = CURRENT_TIMESTAMP
76+
WHERE
77+
sub = :sub
7378
SQL;
7479

7580
$stmt = $pdo->prepare($query);

0 commit comments

Comments
 (0)