force an action on important notifications
This commit is contained in:
@@ -26,6 +26,22 @@ impl Notification {
|
||||
.await
|
||||
.ok()
|
||||
}
|
||||
|
||||
pub async fn oldest_unread_with_action(db: &SqlitePool, user_id: i64) -> Option<Self> {
|
||||
sqlx::query_as!(
|
||||
Self,
|
||||
"SELECT id, user_id, message, read_at, created_at, category, link, action_after_reading
|
||||
FROM notification
|
||||
WHERE user_id = ? AND read_at IS NULL AND action_after_reading IS NOT NULL
|
||||
ORDER BY created_at ASC
|
||||
LIMIT 1",
|
||||
user_id
|
||||
)
|
||||
.fetch_optional(db)
|
||||
.await
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub async fn create_with_tx(
|
||||
db: &mut Transaction<'_, Sqlite>,
|
||||
user: &User,
|
||||
|
||||
Reference in New Issue
Block a user