WIP: Audit Logs #45

Draft
baaboe wants to merge 13 commits from wip/auditlog into main
3 changed files with 5 additions and 6 deletions
Showing only changes of commit 9d6ec5286b - Show all commits

View file

@ -6,11 +6,7 @@ pub mod socket;
use std::sync::Arc;
use crate::{
AppState,
api::v1::auth::CurrentUser,
error::Error,
objects::{Channel, Member, Permissions},
utils::global_checks,
api::v1::auth::CurrentUser, error::Error, objects::{AuditLog, AuditLogId, Channel, Member, Permissions}, utils::global_checks, AppState
};
use axum::{
Extension, Json,
@ -55,7 +51,9 @@ pub async fn delete(
.check_permission(&mut conn, &app_state.cache_pool, Permissions::ManageChannel)
.await?;
let log_entrie = AuditLog::new(channel.guild_uuid, AuditLogId::ChannelDelete as i16, member.uuid, None, None, None, None, Some(channel.name.clone()), None, None).await;
channel.delete(&mut conn, &app_state.cache_pool).await?;
log_entrie.push(&mut conn).await?;
Ok(StatusCode::OK)
}

View file

@ -52,7 +52,7 @@ impl ChannelBuilder {
pub struct Channel {
pub uuid: Uuid,
pub guild_uuid: Uuid,
name: String,
pub name: String,
description: Option<String>,
pub is_above: Option<Uuid>,
pub permissions: Vec<ChannelPermission>,

View file

@ -22,6 +22,7 @@ mod role;
mod user;
pub use auditlog::AuditLog;
pub use auditlog::AuditLogId;
pub use bans::GuildBan;
pub use channel::Channel;
pub use email_token::EmailToken;