Refactor: Use category_route.rs naming convention for channels.

This commit is contained in:
Paul
2021-06-27 09:58:08 +01:00
parent a017872c99
commit 51dc25c94c
7 changed files with 11 additions and 11 deletions

View File

@@ -0,0 +1,20 @@
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::PermissionCalculator::new(&user)
.with_channel(&target)
.for_channel()
.await?;
if !perm.get_view() {
Err(Error::MissingPermission)?
}
Ok(json!(target))
}