2018-10-21 18:22:27 +02:00
|
|
|
use canapi::Provider;
|
2018-12-06 18:54:16 +01:00
|
|
|
use rocket_contrib::json::Json;
|
2018-10-21 18:22:27 +02:00
|
|
|
use serde_json;
|
|
|
|
|
|
|
|
use plume_api::apps::AppEndpoint;
|
|
|
|
use plume_models::{
|
|
|
|
Connection,
|
|
|
|
db_conn::DbConn,
|
|
|
|
apps::App,
|
|
|
|
};
|
|
|
|
|
|
|
|
#[post("/apps", data = "<data>")]
|
2018-12-06 18:54:16 +01:00
|
|
|
pub fn create(conn: DbConn, data: Json<AppEndpoint>) -> Json<serde_json::Value> {
|
2018-10-21 18:22:27 +02:00
|
|
|
let post = <App as Provider<Connection>>::create(&*conn, (*data).clone()).ok();
|
|
|
|
Json(json!(post))
|
|
|
|
}
|