[ledger] Goals and challenges: goal.created/changed/ways_set/saved/closed and challenge.started/abandoned, with their checks; v0.6.0
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
//! The event log. Append only: a correction is a new event, nothing is ever edited or removed.
|
||||
|
||||
use crate::date::{Date, Timestamp};
|
||||
use crate::goal::{ChallengeGoal, ChallengeId, Colour, GoalId, Way, WayKind};
|
||||
use crate::import::StatementLine;
|
||||
use crate::invoice::{Invoice, InvoiceId, Supplier};
|
||||
use crate::money::Haler;
|
||||
@@ -165,4 +166,25 @@ pub enum EventBody {
|
||||
/// A category of your own (an id as [`crate::categories::is_valid`]) and the name the app shows for it.
|
||||
#[serde(rename = "category.created")]
|
||||
CategoryCreated { category: Category, label: String },
|
||||
/// A savings goal (see [`crate::goal`]): a name, a target, an optional date to reach it by, the tank's colour.
|
||||
#[serde(rename = "goal.created")]
|
||||
GoalCreated { goal: GoalId, name: String, target: Haler, by: Option<Date>, colour: Colour },
|
||||
/// A goal's name, target, date or colour changed; the latest counts.
|
||||
#[serde(rename = "goal.changed")]
|
||||
GoalChanged { goal: GoalId, name: String, target: Haler, by: Option<Date>, colour: Colour },
|
||||
/// How a goal is saved for: up to one way of each kind. Replaces the goal's earlier ways.
|
||||
#[serde(rename = "goal.ways_set")]
|
||||
GoalWaysSet { goal: GoalId, ways: Vec<Way> },
|
||||
/// Money put aside for a goal (positive) or taken out (negative), by one of its ways or by hand (`None`).
|
||||
#[serde(rename = "goal.saved")]
|
||||
GoalSaved { goal: GoalId, saving: String, amount: Haler, on: Date, way: Option<WayKind> },
|
||||
/// Reached or given up: no more saving into it. Its history stays.
|
||||
#[serde(rename = "goal.closed")]
|
||||
GoalClosed { goal: GoalId, on: Date },
|
||||
/// A challenge you set yourself, from `starts` to `ends` (both included, at most 92 days).
|
||||
#[serde(rename = "challenge.started")]
|
||||
ChallengeStarted { challenge: ChallengeId, goal: ChallengeGoal, starts: Date, ends: Date },
|
||||
/// Given up; a challenge is given up once.
|
||||
#[serde(rename = "challenge.abandoned")]
|
||||
ChallengeAbandoned { challenge: ChallengeId, on: Date },
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user