fix: move owner check to correct function

This commit is contained in:
Radical 2025-07-23 15:03:56 +02:00
parent cbdf6f79e2
commit 475e008105

View file

@ -208,10 +208,6 @@ impl Member {
}
pub async fn delete(self, conn: &mut Conn) -> Result<(), Error> {
if self.is_owner {
return Err(Error::Forbidden("Can not ban owner".to_string()));
}
delete(guild_members::table)
.filter(guild_members::uuid.eq(self.uuid))
.execute(conn)
@ -221,6 +217,10 @@ impl Member {
}
pub async fn ban(self, conn: &mut Conn, reason: &String) -> Result<(), Error> {
if self.is_owner {
return Err(Error::Forbidden("Can not ban owner".to_string()));
}
use guild_bans::dsl;
insert_into(guild_bans::table)
.values((