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;
|
2019-03-20 17:56:17 +01:00
|
|
|
use plume_models::{apps::App, db_conn::DbConn, Connection};
|
2018-10-21 18:22:27 +02:00
|
|
|
|
|
|
|
#[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))
|
|
|
|
}
|