forked from jmug/stoatchat
Start moving to Rocket 0.5.0
This commit is contained in:
@@ -8,12 +8,12 @@ use mongodb::{
|
||||
bson::{doc, from_document},
|
||||
options::FindOptions,
|
||||
};
|
||||
use rocket::request::Form;
|
||||
use rocket_contrib::json::JsonValue;
|
||||
use rocket::form::Form;
|
||||
use rocket::serde::json::Value;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use validator::Validate;
|
||||
|
||||
#[derive(Serialize, Deserialize, FromFormValue)]
|
||||
#[derive(Serialize, Deserialize, FromFormField)]
|
||||
pub enum Sort {
|
||||
Latest,
|
||||
Oldest,
|
||||
@@ -37,7 +37,7 @@ pub struct Options {
|
||||
}
|
||||
|
||||
#[get("/<target>/messages?<options..>")]
|
||||
pub async fn req(user: User, target: Ref, options: Form<Options>) -> Result<JsonValue> {
|
||||
pub async fn req(user: User, target: Ref, options: Form<Options>) -> Result<Value> {
|
||||
options
|
||||
.validate()
|
||||
.map_err(|error| Error::FailedValidation { error })?;
|
||||
|
||||
Reference in New Issue
Block a user