forked from jmug/stoatchat
Migrate the rest of the code.
This commit is contained in:
@@ -5,20 +5,20 @@ use crate::util::result::{Error, Result};
|
||||
use chrono::prelude::*;
|
||||
use mongodb::bson::{doc, to_bson};
|
||||
use mongodb::options::UpdateOptions;
|
||||
use rocket::form::Form;
|
||||
use rocket::serde::json::Json;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::json;
|
||||
use std::collections::HashMap;
|
||||
|
||||
type Data = HashMap<String, String>;
|
||||
|
||||
#[derive(Serialize, Deserialize, FromForm)]
|
||||
#[derive(FromForm, Serialize, Deserialize)]
|
||||
pub struct Options {
|
||||
timestamp: Option<i64>,
|
||||
}
|
||||
|
||||
#[post("/settings/set?<options..>", data = "<data>")]
|
||||
pub async fn req(user: User, data: Json<Data>, options: Form<Options>) -> Result<()> {
|
||||
pub async fn req(user: User, data: Json<Data>, options: Options) -> Result<()> {
|
||||
let data = data.into_inner();
|
||||
let current_time = Utc::now().timestamp_millis();
|
||||
let timestamp = if let Some(timestamp) = options.timestamp {
|
||||
|
||||
Reference in New Issue
Block a user