* Badges now have an optional permissions field

* New struct changes integrating badge system
This commit is contained in:
shockrah 2021-05-17 16:04:26 -07:00
parent 36dbc8dd1e
commit fc24ad3430
2 changed files with 13 additions and 1 deletions

View File

@ -65,7 +65,8 @@ pub struct Channel {
pub id: UBigInt,
pub name: VarChar,
pub description: Option<VarChar>,
pub kind: Integer
pub kind: Integer,
pub badges: Vec<Badge>
}
#[derive(Serialize, Debug)]
@ -82,6 +83,7 @@ pub struct Member {
pub name: VarChar,
pub status: Integer,
pub permissions: UBigInt,
pub badges: Vec<Badge>
}
#[derive(Serialize)]
@ -90,6 +92,7 @@ pub struct PublicMember {
pub name: VarChar,
pub status: Integer,
pub permissions: UBigInt,
pub badges: Vec<Badge>
}
#[derive(Debug, Deserialize, Serialize)]
@ -100,3 +103,11 @@ pub struct Neighbor {
pub url: String,
pub wsurl: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Badge {
pub name: String,
pub id: u32,
pub color: u32,
pub perms: Option<u32>, // abridged version of permissiosn
}

View File

@ -2,5 +2,6 @@ CREATE TABLE IF NOT EXISTS `badges`(
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(256) NOT NULL,
`color` INTEGER UNSIGNED NOT NULL DEFAULT 0xFFFFFFFF,
`permissions` INTEGER UNSIGNED, -- nullable because this isn't logically applicable to every badge
PRIMARY KEY(`id`)
);