1use crate::descriptor::{Action, COMMODITY, Form, Kind, TEXT, field};
4use crate::tags::COMMODITY_TAGS;
5
6pub const COMMODITY_CREATE: Form = Form {
8 name: "commodity-create",
9 title: "Create commodity",
10 fields: &[
11 field("symbol", "Symbol", TEXT, true),
12 field("name", "Name", TEXT, true),
13 ],
14 action: Action::Mutation,
15};
16
17pub const COMMODITY_EDIT: Form = Form {
20 name: "commodity-edit",
21 title: "Edit commodity",
22 fields: &[
23 field("id", "Id", Kind::Hidden, true),
24 field("revision", "Revision", Kind::Hidden, true),
25 field("symbol", "Symbol", TEXT, true),
26 field("name", "Name", TEXT, true),
27 COMMODITY_TAGS,
28 ],
29 action: Action::LoadMutation,
30};
31
32pub const CONVERT: Form = Form {
34 name: "convert",
35 title: "Convert amount",
36 fields: &[
37 field("amount", "Amount", Kind::Amount, true),
38 field("from", "From", COMMODITY, true),
39 field("to", "To", COMMODITY, true),
40 ],
41 action: Action::Query,
42};