diff --git a/json-api/db/src/lib.rs b/json-api/db/src/lib.rs index 0de94d3..35f3222 100644 --- a/json-api/db/src/lib.rs +++ b/json-api/db/src/lib.rs @@ -65,7 +65,8 @@ pub struct Channel { pub id: UBigInt, pub name: VarChar, pub description: Option, - pub kind: Integer + pub kind: Integer, + pub badges: Vec } #[derive(Serialize, Debug)] @@ -82,6 +83,7 @@ pub struct Member { pub name: VarChar, pub status: Integer, pub permissions: UBigInt, + pub badges: Vec } #[derive(Serialize)] @@ -90,6 +92,7 @@ pub struct PublicMember { pub name: VarChar, pub status: Integer, pub permissions: UBigInt, + pub badges: Vec } #[derive(Debug, Deserialize, Serialize)] @@ -100,3 +103,11 @@ pub struct Neighbor { pub url: String, pub wsurl: Option, } + +#[derive(Debug, Serialize, Deserialize)] +pub struct Badge { + pub name: String, + pub id: u32, + pub color: u32, + pub perms: Option, // abridged version of permissiosn +} \ No newline at end of file diff --git a/json-api/migrations/2021-05-17-221928_badges/up.sql b/json-api/migrations/2021-05-17-221928_badges/up.sql index 73d044b..571151b 100644 --- a/json-api/migrations/2021-05-17-221928_badges/up.sql +++ b/json-api/migrations/2021-05-17-221928_badges/up.sql @@ -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`) ); \ No newline at end of file