Start moving to Rocket 0.5.0
This commit is contained in:
@@ -2,7 +2,7 @@ use crate::database::*;
|
||||
use crate::util::result::{Error, Result};
|
||||
|
||||
use mongodb::bson::doc;
|
||||
use rocket_contrib::json::Json;
|
||||
use rocket::serde::json::Json;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use validator::Validate;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::util::result::{Error, Result};
|
||||
use futures::StreamExt;
|
||||
use mongodb::options::FindOptions;
|
||||
use serde::{Serialize, Deserialize};
|
||||
use rocket_contrib::json::JsonValue;
|
||||
use rocket::serde::json::Value;
|
||||
use mongodb::bson::{doc, from_document};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
@@ -15,7 +15,7 @@ struct BannedUser {
|
||||
}
|
||||
|
||||
#[get("/<target>/bans")]
|
||||
pub async fn req(user: User, target: Ref) -> Result<JsonValue> {
|
||||
pub async fn req(user: User, target: Ref) -> Result<Value> {
|
||||
let target = target.fetch_server().await?;
|
||||
|
||||
let perm = permissions::PermissionCalculator::new(&user)
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::database::*;
|
||||
use crate::util::result::{Error, Result};
|
||||
|
||||
use mongodb::bson::doc;
|
||||
use rocket_contrib::json::{Json, JsonValue};
|
||||
use rocket::serde::json::{Json, Value};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ulid::Ulid;
|
||||
use validator::Validate;
|
||||
@@ -35,7 +35,7 @@ pub struct Data {
|
||||
}
|
||||
|
||||
#[post("/<target>/channels", data = "<info>")]
|
||||
pub async fn req(user: User, target: Ref, info: Json<Data>) -> Result<JsonValue> {
|
||||
pub async fn req(user: User, target: Ref, info: Json<Data>) -> Result<Value> {
|
||||
let info = info.into_inner();
|
||||
info.validate()
|
||||
.map_err(|error| Error::FailedValidation { error })?;
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::util::result::{Error, Result};
|
||||
|
||||
use futures::StreamExt;
|
||||
use mongodb::bson::{doc, from_document};
|
||||
use rocket_contrib::json::JsonValue;
|
||||
use rocket::serde::json::Value;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
@@ -15,7 +15,7 @@ pub struct ServerInvite {
|
||||
}
|
||||
|
||||
#[get("/<target>/invites")]
|
||||
pub async fn req(user: User, target: Ref) -> Result<JsonValue> {
|
||||
pub async fn req(user: User, target: Ref) -> Result<Value> {
|
||||
let target = target.fetch_server().await?;
|
||||
|
||||
let perm = permissions::PermissionCalculator::new(&user)
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::util::result::{Error, Result};
|
||||
use crate::{database::*, notifications::events::RemoveMemberField};
|
||||
|
||||
use mongodb::bson::{doc, to_document};
|
||||
use rocket_contrib::json::Json;
|
||||
use rocket::serde::json::Json;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use validator::Validate;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ use crate::database::*;
|
||||
use crate::util::result::{Error, Result};
|
||||
|
||||
use mongodb::bson::doc;
|
||||
use rocket_contrib::json::JsonValue;
|
||||
use rocket::serde::json::Value;
|
||||
|
||||
#[get("/<target>/members/<member>")]
|
||||
pub async fn req(user: User, target: Ref, member: String) -> Result<JsonValue> {
|
||||
pub async fn req(user: User, target: Ref, member: String) -> Result<Value> {
|
||||
let target = target.fetch_server().await?;
|
||||
|
||||
let perm = permissions::PermissionCalculator::new(&user)
|
||||
|
||||
@@ -3,12 +3,12 @@ use crate::util::result::{Error, Result};
|
||||
|
||||
use futures::StreamExt;
|
||||
use mongodb::bson::{doc, from_document, Document};
|
||||
use rocket_contrib::json::JsonValue;
|
||||
use rocket::serde::json::Value;
|
||||
|
||||
// ! FIXME: this is a temporary route while permissions are being worked on.
|
||||
|
||||
#[get("/<target>/members")]
|
||||
pub async fn req(user: User, target: Ref) -> Result<JsonValue> {
|
||||
pub async fn req(user: User, target: Ref) -> Result<Value> {
|
||||
let target = target.fetch_server().await?;
|
||||
|
||||
let perm = permissions::PermissionCalculator::new(&user)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use mongodb::bson::doc;
|
||||
use rocket_contrib::json::Json;
|
||||
use rocket::serde::json::Json;
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
use crate::database::*;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use mongodb::bson::doc;
|
||||
use rocket_contrib::json::Json;
|
||||
use rocket::serde::json::Json;
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
use crate::database::*;
|
||||
|
||||
@@ -6,7 +6,7 @@ use ulid::Ulid;
|
||||
use mongodb::bson::doc;
|
||||
use validator::Validate;
|
||||
use serde::{Serialize, Deserialize};
|
||||
use rocket_contrib::json::{Json, JsonValue};
|
||||
use rocket::serde::json::{Json, Value};
|
||||
|
||||
#[derive(Validate, Serialize, Deserialize)]
|
||||
pub struct Data {
|
||||
@@ -15,7 +15,7 @@ pub struct Data {
|
||||
}
|
||||
|
||||
#[post("/<target>/roles", data = "<data>")]
|
||||
pub async fn req(user: User, target: Ref, data: Json<Data>) -> Result<JsonValue> {
|
||||
pub async fn req(user: User, target: Ref, data: Json<Data>) -> Result<Value> {
|
||||
let data = data.into_inner();
|
||||
data.validate()
|
||||
.map_err(|error| Error::FailedValidation { error })?;
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::util::result::{Error, Result};
|
||||
use crate::{database::*, notifications::events::RemoveRoleField};
|
||||
|
||||
use mongodb::bson::doc;
|
||||
use rocket_contrib::json::Json;
|
||||
use rocket::serde::json::Json;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use validator::Validate;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::database::*;
|
||||
use crate::util::result::{Error, Result};
|
||||
|
||||
use mongodb::bson::doc;
|
||||
use rocket_contrib::json::{Json, JsonValue};
|
||||
use rocket::serde::json::{Json, Value};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ulid::Ulid;
|
||||
use validator::Validate;
|
||||
@@ -21,7 +21,7 @@ pub struct Data {
|
||||
}
|
||||
|
||||
#[post("/create", data = "<info>")]
|
||||
pub async fn req(user: User, info: Json<Data>) -> Result<JsonValue> {
|
||||
pub async fn req(user: User, info: Json<Data>) -> Result<Value> {
|
||||
let info = info.into_inner();
|
||||
info.validate()
|
||||
.map_err(|error| Error::FailedValidation { error })?;
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::util::result::{Error, Result};
|
||||
use crate::{database::*, notifications::events::RemoveServerField};
|
||||
|
||||
use mongodb::bson::{doc, to_bson, to_document};
|
||||
use rocket_contrib::json::Json;
|
||||
use rocket::serde::json::Json;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use validator::Validate;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use crate::database::*;
|
||||
use crate::util::result::{Error, Result};
|
||||
|
||||
use rocket_contrib::json::JsonValue;
|
||||
use rocket::serde::json::Value;
|
||||
|
||||
#[get("/<target>")]
|
||||
pub async fn req(user: User, target: Ref) -> Result<JsonValue> {
|
||||
pub async fn req(user: User, target: Ref) -> Result<Value> {
|
||||
let target = target.fetch_server().await?;
|
||||
|
||||
let perm = permissions::PermissionCalculator::new(&user)
|
||||
|
||||
Reference in New Issue
Block a user