feat: move ownership to member column instead of table column
This commit is contained in:
parent
419f37b108
commit
0588541876
5 changed files with 34 additions and 7 deletions
|
@ -26,7 +26,6 @@ pub struct GuildBuilder {
|
|||
name: String,
|
||||
description: Option<String>,
|
||||
icon: Option<String>,
|
||||
owner_uuid: Uuid,
|
||||
}
|
||||
|
||||
impl GuildBuilder {
|
||||
|
@ -40,7 +39,6 @@ impl GuildBuilder {
|
|||
name: self.name,
|
||||
description: self.description,
|
||||
icon: self.icon.and_then(|i| i.parse().ok()),
|
||||
owner_uuid: self.owner_uuid,
|
||||
roles,
|
||||
member_count,
|
||||
})
|
||||
|
@ -53,7 +51,6 @@ pub struct Guild {
|
|||
name: String,
|
||||
description: Option<String>,
|
||||
icon: Option<Url>,
|
||||
owner_uuid: Uuid,
|
||||
pub roles: Vec<Role>,
|
||||
member_count: i64,
|
||||
}
|
||||
|
@ -110,7 +107,6 @@ impl Guild {
|
|||
name: name.clone(),
|
||||
description: None,
|
||||
icon: None,
|
||||
owner_uuid,
|
||||
};
|
||||
|
||||
insert_into(guilds::table)
|
||||
|
@ -125,6 +121,7 @@ impl Guild {
|
|||
nickname: None,
|
||||
user_uuid: owner_uuid,
|
||||
guild_uuid,
|
||||
is_owner: true,
|
||||
};
|
||||
|
||||
insert_into(guild_members::table)
|
||||
|
@ -137,7 +134,6 @@ impl Guild {
|
|||
name,
|
||||
description: None,
|
||||
icon: None,
|
||||
owner_uuid,
|
||||
roles: vec![],
|
||||
member_count: 1,
|
||||
})
|
||||
|
|
|
@ -17,6 +17,7 @@ pub struct MemberBuilder {
|
|||
pub nickname: Option<String>,
|
||||
pub user_uuid: Uuid,
|
||||
pub guild_uuid: Uuid,
|
||||
pub is_owner: bool,
|
||||
}
|
||||
|
||||
impl MemberBuilder {
|
||||
|
@ -28,6 +29,7 @@ impl MemberBuilder {
|
|||
nickname: self.nickname.clone(),
|
||||
user_uuid: self.user_uuid,
|
||||
guild_uuid: self.guild_uuid,
|
||||
is_owner: self.is_owner,
|
||||
user,
|
||||
})
|
||||
}
|
||||
|
@ -39,6 +41,7 @@ pub struct Member {
|
|||
pub nickname: Option<String>,
|
||||
pub user_uuid: Uuid,
|
||||
pub guild_uuid: Uuid,
|
||||
pub is_owner: bool,
|
||||
user: User,
|
||||
}
|
||||
|
||||
|
@ -113,6 +116,7 @@ impl Member {
|
|||
guild_uuid,
|
||||
user_uuid,
|
||||
nickname: None,
|
||||
is_owner: false,
|
||||
};
|
||||
|
||||
insert_into(guild_members::table)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue