mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-12-04 17:26:36 +00:00
17 lines
395 B
Rust
17 lines
395 B
Rust
|
use canapi::Provider;
|
||
|
use rocket_contrib::Json;
|
||
|
use serde_json;
|
||
|
|
||
|
use plume_api::apps::AppEndpoint;
|
||
|
use plume_models::{
|
||
|
Connection,
|
||
|
db_conn::DbConn,
|
||
|
apps::App,
|
||
|
};
|
||
|
|
||
|
#[post("/apps", data = "<data>")]
|
||
|
fn create(conn: DbConn, data: Json<AppEndpoint>) -> Json<serde_json::Value> {
|
||
|
let post = <App as Provider<Connection>>::create(&*conn, (*data).clone()).ok();
|
||
|
Json(json!(post))
|
||
|
}
|