forked from jmug/stoatchat
12
src/database/entities/bots.rs
Normal file
12
src/database/entities/bots.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct Bot {
|
||||
#[serde(rename = "_id")]
|
||||
pub id: String,
|
||||
pub owner: String,
|
||||
pub token: String,
|
||||
pub public: bool,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub interactions_url: Option<String>,
|
||||
}
|
||||
@@ -5,6 +5,7 @@ mod microservice;
|
||||
mod server;
|
||||
mod sync;
|
||||
mod user;
|
||||
mod bots;
|
||||
|
||||
use microservice::*;
|
||||
|
||||
@@ -16,3 +17,4 @@ pub use message::*;
|
||||
pub use server::*;
|
||||
pub use sync::*;
|
||||
pub use user::*;
|
||||
pub use bots::*;
|
||||
|
||||
@@ -37,13 +37,20 @@ pub type PermissionTuple = (
|
||||
i32 // channel permission
|
||||
);
|
||||
|
||||
fn if_false(t: &bool) -> bool {
|
||||
*t == false
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct Role {
|
||||
pub name: String,
|
||||
pub permissions: PermissionTuple,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub colour: Option<String>
|
||||
// Bri'ish API conventions
|
||||
pub colour: Option<String>,
|
||||
#[serde(skip_serializing_if = "if_false", default)]
|
||||
pub hoist: bool,
|
||||
#[serde(default)]
|
||||
pub rank: i64,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
|
||||
@@ -73,7 +73,12 @@ pub enum Badges {
|
||||
|
||||
impl_op_ex_commutative!(+ |a: &i32, b: &Badges| -> i32 { *a | *b as i32 });
|
||||
|
||||
// When changing this struct, update notifications/payload.rs#80
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct BotInformation {
|
||||
owner: String
|
||||
}
|
||||
|
||||
// When changing this struct, update notifications/payload.rs#113
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct User {
|
||||
#[serde(rename = "_id")]
|
||||
@@ -91,6 +96,11 @@ pub struct User {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub profile: Option<UserProfile>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub flags: Option<i32>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub bot: Option<BotInformation>,
|
||||
|
||||
// ? This should never be pushed to the collection.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub relationship: Option<RelationshipStatus>,
|
||||
|
||||
Reference in New Issue
Block a user