add flow api route
This commit is contained in:
parent
65bfb5f8e2
commit
9135c2f913
2 changed files with 10 additions and 1 deletions
|
@ -93,7 +93,8 @@ async fn rocket() -> _ {
|
|||
routes::item::move_transaction_route,
|
||||
routes::item::variant_price_latest_by_origin,
|
||||
routes::item::item_stat_route,
|
||||
routes::flow::active_flows_route
|
||||
routes::flow::active_flows_route,
|
||||
routes::flow::flow_api_route
|
||||
],
|
||||
)
|
||||
.manage(itemdb)
|
||||
|
|
|
@ -142,6 +142,14 @@ pub async fn create_flow_route(
|
|||
Ok(json!({"uuid": flow._id }))
|
||||
}
|
||||
|
||||
#[get("/flow/<id>")]
|
||||
pub async fn flow_api_route(id: &str, flows: &State<JSONStore<FlowInfo>>) -> FallibleApiResponse {
|
||||
let flow = Flow::get(id)
|
||||
.await
|
||||
.ok_or_else(|| api_error("No such flow"))?;
|
||||
Ok(flow.api().await)
|
||||
}
|
||||
|
||||
#[post("/flow/<id>/end", data = "<form>")]
|
||||
pub async fn end_flow_route(id: &str, form: Json<EndFlow>) -> FallibleApiResponse {
|
||||
let flow = Flow::get(id)
|
||||
|
|
Loading…
Reference in a new issue