Rename ReportingProductKind::Generic to ReportingProductKind::DynamicReport

This commit is contained in:
RunasSudo 2025-05-30 20:49:14 +10:00
parent e8e88e8629
commit 49dc6bc078
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
4 changed files with 27 additions and 19 deletions

View File

@ -65,7 +65,7 @@ async fn main() {
// },
ReportingProductId {
name: "BalanceSheet",
kind: ReportingProductKind::Generic,
kind: ReportingProductKind::DynamicReport,
args: Box::new(MultipleDateArgs {
dates: vec![DateArgs {
date: NaiveDate::from_ymd_opt(YEAR, 6, 30).unwrap(),
@ -74,7 +74,7 @@ async fn main() {
},
ReportingProductId {
name: "IncomeStatement",
kind: ReportingProductKind::Generic,
kind: ReportingProductKind::DynamicReport,
args: Box::new(MultipleDateStartDateEndArgs {
dates: vec![DateStartDateEndArgs {
date_start: NaiveDate::from_ymd_opt(YEAR - 1, 7, 1).unwrap(),
@ -133,7 +133,7 @@ async fn main() {
},
ReportingProductId {
name: "BalanceSheet",
kind: ReportingProductKind::Generic,
kind: ReportingProductKind::DynamicReport,
args: Box::new(MultipleDateArgs {
dates: vec![DateArgs {
date: NaiveDate::from_ymd_opt(YEAR, 6, 30).unwrap(),
@ -148,7 +148,7 @@ async fn main() {
let result = products
.get_or_err(&ReportingProductId {
name: "BalanceSheet",
kind: ReportingProductKind::Generic,
kind: ReportingProductKind::DynamicReport,
args: Box::new(MultipleDateArgs {
dates: vec![DateArgs {
date: NaiveDate::from_ymd_opt(YEAR, 6, 30).unwrap(),
@ -173,7 +173,7 @@ async fn main() {
},
ReportingProductId {
name: "TrialBalance",
kind: ReportingProductKind::Generic,
kind: ReportingProductKind::DynamicReport,
args: Box::new(DateArgs {
date: NaiveDate::from_ymd_opt(YEAR, 6, 30).unwrap(),
}),
@ -186,7 +186,7 @@ async fn main() {
let result = products
.get_or_err(&ReportingProductId {
name: "TrialBalance",
kind: ReportingProductKind::Generic,
kind: ReportingProductKind::DynamicReport,
args: Box::new(DateArgs {
date: NaiveDate::from_ymd_opt(YEAR, 6, 30).unwrap(),
}),

View File

@ -384,7 +384,7 @@ impl BalanceSheet {
fn register_lookup_fn(context: &mut ReportingContext) {
context.register_lookup_fn(
"BalanceSheet",
&[ReportingProductKind::Generic],
&[ReportingProductKind::DynamicReport],
Self::takes_args,
Self::from_args,
);
@ -412,7 +412,7 @@ impl ReportingStep for BalanceSheet {
fn id(&self) -> ReportingStepId {
ReportingStepId {
name: "BalanceSheet",
product_kinds: &[ReportingProductKind::Generic],
product_kinds: &[ReportingProductKind::DynamicReport],
args: Box::new(self.args.clone()),
}
}
@ -550,7 +550,7 @@ impl ReportingStep for BalanceSheet {
result.insert(
ReportingProductId {
name: "BalanceSheet",
kind: ReportingProductKind::Generic,
kind: ReportingProductKind::DynamicReport,
args: Box::new(self.args.clone()),
},
Box::new(report),
@ -1120,7 +1120,7 @@ impl IncomeStatement {
fn register_lookup_fn(context: &mut ReportingContext) {
context.register_lookup_fn(
"IncomeStatement",
&[ReportingProductKind::Generic],
&[ReportingProductKind::DynamicReport],
Self::takes_args,
Self::from_args,
);
@ -1148,7 +1148,7 @@ impl ReportingStep for IncomeStatement {
fn id(&self) -> ReportingStepId {
ReportingStepId {
name: "IncomeStatement",
product_kinds: &[ReportingProductKind::Generic],
product_kinds: &[ReportingProductKind::DynamicReport],
args: Box::new(self.args.clone()),
}
}
@ -1282,7 +1282,7 @@ impl ReportingStep for IncomeStatement {
result.insert(
ReportingProductId {
name: "IncomeStatement",
kind: ReportingProductKind::Generic,
kind: ReportingProductKind::DynamicReport,
args: Box::new(self.args.clone()),
},
Box::new(report),
@ -1546,7 +1546,7 @@ impl TrialBalance {
fn register_lookup_fn(context: &mut ReportingContext) {
context.register_lookup_fn(
"TrialBalance",
&[ReportingProductKind::Generic],
&[ReportingProductKind::DynamicReport],
Self::takes_args,
Self::from_args,
);
@ -1574,7 +1574,7 @@ impl ReportingStep for TrialBalance {
fn id(&self) -> ReportingStepId {
ReportingStepId {
name: "TrialBalance",
product_kinds: &[ReportingProductKind::Generic],
product_kinds: &[ReportingProductKind::DynamicReport],
args: Box::new(self.args.clone()),
}
}
@ -1677,7 +1677,7 @@ impl ReportingStep for TrialBalance {
result.insert(
ReportingProductId {
name: "TrialBalance",
kind: ReportingProductKind::Generic,
kind: ReportingProductKind::DynamicReport,
args: Box::new(self.args.clone()),
},
Box::new(report),

View File

@ -152,12 +152,20 @@ impl Display for ReportingProductId {
}
}
/// Identifies a type of [ReportingProduct]
/// Identifies a type of [Box]ed [ReportingProduct]
///
/// See [Box::downcast].
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum ReportingProductKind {
/// The [Box]ed [ReportingProduct] is a [Transactions]
Transactions,
/// The [Box]ed [ReportingProduct] is a [BalancesAt]
BalancesAt,
/// The [Box]ed [ReportingProduct] is a [BalancesBetween]
BalancesBetween,
/// The [Box]ed [ReportingProduct] is a [DynamicReport]
DynamicReport,
/// Unused in libdrcr - available for plugin use
Generic,
}

View File

@ -136,7 +136,7 @@ pub(crate) async fn get_balance_sheet(
state,
&ReportingProductId {
name: "BalanceSheet",
kind: ReportingProductKind::Generic,
kind: ReportingProductKind::DynamicReport,
args: Box::new(MultipleDateArgs {
dates: date_args.clone(),
}),
@ -165,7 +165,7 @@ pub(crate) async fn get_income_statement(
state,
&ReportingProductId {
name: "IncomeStatement",
kind: ReportingProductKind::Generic,
kind: ReportingProductKind::DynamicReport,
args: Box::new(MultipleDateStartDateEndArgs {
dates: date_args.clone(),
}),
@ -188,7 +188,7 @@ pub(crate) async fn get_trial_balance(
state,
&ReportingProductId {
name: "TrialBalance",
kind: ReportingProductKind::Generic,
kind: ReportingProductKind::DynamicReport,
args: Box::new(DateArgs { date }),
},
)