prefixed route uri for get_voice_channels and get_text_channels with /list to be more specific to their behavior

This commit is contained in:
shockrah 2020-05-25 13:48:16 -07:00
parent d9ac6c08a2
commit db901010b0

View File

@ -6,6 +6,7 @@ use diesel::{self, prelude::*};
use rocket_contrib::json::Json;
use std::vec::Vec;
use crate::models::{InsertableChannel, Channel, VOICE_CHANNEL, TEXT_CHANNEL};
use crate::auth::{AuthResult, AuthErr, AuthKey};
use crate::{DBConn, schema, payload};
use crate::err::{self, DbError};
@ -31,8 +32,8 @@ pub fn insert_new_channel(qname: String, perms: i32, lim: i32, ctype: i32, conn:
}
}
#[get("/voice")]
pub fn get_voice_channels(conn: DBConn) -> DbError<Json<Vec<Channel>>, err::DbResponse> {
#[get("/list/voice")]
pub fn get_voice_channels(conn: DBConn) -> AuthResult<Json<Vec<Channel>>, err::DbResponse> {
use schema::channels::dsl::*;
let result = channels.filter(type_.eq(VOICE_CHANNEL)).load(&conn.0);
@ -45,7 +46,7 @@ pub fn get_voice_channels(conn: DBConn) -> DbError<Json<Vec<Channel>>, err::DbRe
}
#[get("/text")]
#[get("/list/text")]
pub fn get_text_chanels(conn: DBConn) -> DbError<Json<Vec<Channel>>, err::DbResponse> {
use schema::channels::dsl::*;