Skip to content

Commit

Permalink
refactor: rename to ChartOfAccountsProjection
Browse files Browse the repository at this point in the history
  • Loading branch information
vindard committed Jan 16, 2025
1 parent e485092 commit 403a92e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions core/chart-of-accounts/src/chart_of_accounts/chart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,18 @@ pub struct ControlAccountAdded {
path: ControlAccountPath,
}

#[derive(Debug)]
pub struct ControlAccountProjection {
name: String,
encoded_path: String,
children: Vec<ControlSubAccountProjection>,
}

#[derive(Debug)]
pub struct ControlSubAccountProjection {
name: String,
encoded_path: String,
}

#[derive(Debug)]
pub struct ChartOfAccounts {
pub struct ChartOfAccountsProjection {
id: ChartId,
name: String,
assets: Vec<ControlAccountProjection>,
Expand All @@ -35,7 +32,7 @@ pub struct ChartOfAccounts {

pub(super) fn project<'a>(
events: impl DoubleEndedIterator<Item = &'a ChartEvent>,
) -> ChartOfAccounts {
) -> ChartOfAccountsProjection {
let mut id: Option<ChartId> = None;
let mut name: Option<String> = None;
let mut control_accounts_added: Vec<ControlAccountAdded> = vec![];
Expand Down Expand Up @@ -83,7 +80,7 @@ pub(super) fn project<'a>(
});
}

ChartOfAccounts {
ChartOfAccountsProjection {
id: id.expect("Chart must be initialized"),
name: name.expect("Chart must be initialized"),
assets: control_accounts_by_category
Expand Down
2 changes: 1 addition & 1 deletion core/chart-of-accounts/src/chart_of_accounts/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Chart {
.unwrap_or_else(|| Ok(category.first_control_account()))?)
}

pub fn chart(&self) -> chart::ChartOfAccounts {
pub fn chart(&self) -> chart::ChartOfAccountsProjection {
chart::project(self.events.iter_all())
}

Expand Down

0 comments on commit 403a92e

Please sign in to comment.