Skip to main content

forms/
account.rs

1//! The account form descriptors.
2
3use crate::descriptor::{ACCOUNT, Action, Form, Kind, TEXT, field};
4use crate::tags::ACCOUNT_TAGS;
5
6/// Fold `from` into `into`: its splits, lots, budgets, children and tags move
7/// and `from` is deleted.
8pub const ACCOUNT_MERGE: Form = Form {
9    name: "account-merge",
10    title: "Merge accounts",
11    fields: &[
12        field("into", "Into", ACCOUNT, true),
13        field("from", "From", ACCOUNT, true),
14    ],
15    action: Action::Mutation,
16};
17
18/// Create an account under an optional parent.
19pub const ACCOUNT_CREATE: Form = Form {
20    name: "account-create",
21    title: "Create account",
22    fields: &[
23        field("name", "Name", TEXT, true),
24        field("parent", "Parent", ACCOUNT, false),
25    ],
26    action: Action::Mutation,
27};
28
29/// Rename, re-parent and replace the tags of an account; `tags` excludes the
30/// `name` tag and is edited, not carried.
31pub const ACCOUNT_EDIT: Form = Form {
32    name: "account-edit",
33    title: "Edit account",
34    fields: &[
35        field("id", "Id", Kind::Hidden, true),
36        field("revision", "Revision", Kind::Hidden, true),
37        field("name", "Name", TEXT, true),
38        field("parent", "Parent", ACCOUNT, false),
39        ACCOUNT_TAGS,
40    ],
41    action: Action::LoadMutation,
42};