Start development sprint 3.

This commit is contained in:
Paul Makles
2021-01-18 13:41:48 +00:00
parent a9f258de6b
commit af8731ac38
8 changed files with 75 additions and 45 deletions

View File

@@ -0,0 +1,16 @@
use crate::database::*;
use crate::util::result::{Error, Result};
use rocket_contrib::json::JsonValue;
#[get("/<target>")]
pub async fn req(user: User, target: Ref) -> Result<JsonValue> {
let target = target.fetch_channel().await?;
let perm = permissions::channel::calculate(&user, &target).await;
if !perm.get_view() {
Err(Error::LabelMe)?
}
Ok(json!(target))
}

View File

@@ -1,5 +1,9 @@
use rocket::Route;
mod fetch_channel;
pub fn routes() -> Vec<Route> {
routes![]
routes![
fetch_channel::req
]
}