Files
stoatchat/crates/delta/src/routes/sync/get_unreads.rs
2022-06-02 00:04:22 +01:00

16 lines
354 B
Rust

use revolt_quark::{
models::{ChannelUnread, User},
Db, Result,
};
use rocket::serde::json::Json;
/// # Fetch Unreads
///
/// Fetch information about unread state on channels.
#[openapi(tag = "Sync")]
#[get("/unreads")]
pub async fn req(db: &Db, user: User) -> Result<Json<Vec<ChannelUnread>>> {
db.fetch_unreads(&user.id).await.map(Json)
}