feat: channel model implementation (#250)

Co-authored-by: ToastXC <100072983+toastxc@users.noreply.github.com>
This commit is contained in:
Paul Makles
2023-06-04 18:52:49 +01:00
committed by GitHub
parent 3c834d06d4
commit bf3e027067
27 changed files with 1391 additions and 99 deletions

View File

@@ -1,4 +1,4 @@
use revolt_database::Database;
use revolt_database::{util::reference::Reference, Database};
use revolt_quark::{models::User, perms, Db, Error, Permission, Result};
use rocket::State;
use rocket_empty::EmptyResponse;
@@ -12,13 +12,9 @@ pub async fn webhook_delete(
db: &State<Database>,
legacy_db: &Db,
user: User,
webhook_id: String,
webhook_id: Reference,
) -> Result<EmptyResponse> {
let webhook = db
.fetch_webhook(&webhook_id)
.await
.map_err(Error::from_core)?;
let webhook = webhook_id.as_webhook(db).await.map_err(Error::from_core)?;
let channel = legacy_db.fetch_channel(&webhook.channel_id).await?;
perms(&user)