fix produce flows
This commit is contained in:
parent
860508fa29
commit
e3128d7214
3 changed files with 21 additions and 28 deletions
|
@ -15,7 +15,7 @@ use crate::{
|
|||
transaction::{Price, Transaction},
|
||||
};
|
||||
|
||||
use super::ApiError;
|
||||
use super::{item::SupplyForm, ApiError};
|
||||
|
||||
#[get("/flow/<id>/info")]
|
||||
pub async fn flow_info(
|
||||
|
@ -129,7 +129,7 @@ pub struct CreateFlow {
|
|||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct EndFlow {
|
||||
pub produced: Option<Vec<HashMap<String, u64>>>,
|
||||
pub produced: Option<Vec<SupplyForm>>,
|
||||
}
|
||||
|
||||
#[post("/flow/<id>", data = "<form>")]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use mongod::ToAPI;
|
||||
use rocket::serde::json::Json;
|
||||
use rocket::{get, post, State};
|
||||
use serde::Deserialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::check_auth;
|
||||
|
@ -14,14 +14,14 @@ use crate::{
|
|||
|
||||
use super::{item_does_not_exist_error, variant_does_not_exist_error};
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
#[derive(Deserialize, Debug, Clone, Serialize)]
|
||||
pub struct SupplyForm {
|
||||
item: String,
|
||||
variant: String,
|
||||
price: String,
|
||||
origin: Option<String>,
|
||||
location: Option<String>,
|
||||
note: Option<String>,
|
||||
pub item: String,
|
||||
pub variant: String,
|
||||
pub price: String,
|
||||
pub origin: Option<String>,
|
||||
pub location: Option<String>,
|
||||
pub note: Option<String>,
|
||||
}
|
||||
|
||||
/// Route for supply action. Creates a new Transaction for the specified Item Variant.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue