add: chat notifications
use sql_chanes/notifications_tag.sql; ignore first statement if you never used a preview commit
This commit is contained in:
parent
a009ef9e34
commit
59cfec4819
22 changed files with 267 additions and 136 deletions
|
@ -45,6 +45,27 @@ pub async fn delete_all_request(
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn delete_all_by_tag_request(
|
||||
jar: CookieJar,
|
||||
Extension(data): Extension<State>,
|
||||
Path(tag): Path<String>,
|
||||
) -> impl IntoResponse {
|
||||
let data = &(data.read().await).0;
|
||||
let user = match get_user_from_token!(jar, data) {
|
||||
Some(ua) => ua,
|
||||
None => return Json(Error::NotAllowed.into()),
|
||||
};
|
||||
|
||||
match data.delete_all_notifications_by_tag(&user, &tag).await {
|
||||
Ok(_) => Json(ApiReturn {
|
||||
ok: true,
|
||||
message: "Notifications cleared".to_string(),
|
||||
payload: (),
|
||||
}),
|
||||
Err(e) => Json(e.into()),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn update_read_status_request(
|
||||
jar: CookieJar,
|
||||
Extension(data): Extension<State>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue