diff --git a/server/src/main.rs b/server/src/main.rs index 9ae1bc2..5e1822c 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -24,6 +24,7 @@ mod payload; mod rand_utils; mod users; mod channels; +mod err; use invites::*; use channels::*; use users::*; @@ -38,7 +39,7 @@ pub fn rocket() -> rocket::Rocket { generate_invite, use_invite ]) .mount("/channels", routes![ - get_voice_channels + get_voice_channels, insert_new_channel, get_text_chanels ]) .mount("/users", routes![ remove_user, get_user_list diff --git a/server/src/models.rs b/server/src/models.rs index 93b4610..fdb3f21 100644 --- a/server/src/models.rs +++ b/server/src/models.rs @@ -34,4 +34,13 @@ pub struct Channel { pub permissions: i32, pub limit: i32, // <= 0 means there is no limit pub type_: i32, // 1 for voice 2 for text +} + +#[derive(Insertable)] +#[table_name = "channels"] +pub struct InsertableChannel { + pub name: String, + pub permissions: i32, + pub limit: i32, // <= 0 means there is no limit + pub type_: i32, // 1 for voice 2 for text } \ No newline at end of file diff --git a/server/src/payload.rs b/server/src/payload.rs index ec61ebe..abe2bf5 100644 --- a/server/src/payload.rs +++ b/server/src/payload.rs @@ -22,6 +22,11 @@ pub struct OnlineUser { status: i32, } +#[derive(Serialize, Deserialize)] +pub struct ChannelIndexed { + pub name: String, + pub ctype: i32, +} #[derive(Serialize, Deserialize, Debug)] pub struct VoiceChannel { pub id: i32,