Skip to content

Commit

Permalink
chore: clean up lints
Browse files Browse the repository at this point in the history
  • Loading branch information
vindard committed Jan 24, 2025
1 parent 6a01d0e commit 03e3aa4
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 31 deletions.
8 changes: 4 additions & 4 deletions lana/admin-server/src/graphql/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ struct BtcAccountAmounts {
impl From<lana_app::trial_balance::BtcStatementBalanceAmount> for BtcAccountAmounts {
fn from(balance: lana_app::trial_balance::BtcStatementBalanceAmount) -> Self {
BtcAccountAmounts {
debit: balance.dr_balance.into(),
credit: balance.cr_balance.into(),
debit: balance.dr_balance,
credit: balance.cr_balance,
net_debit: (balance.dr_balance - balance.cr_balance).into(),
net_credit: (balance.cr_balance - balance.dr_balance).into(),
}
Expand All @@ -49,8 +49,8 @@ struct UsdAccountAmounts {
impl From<lana_app::trial_balance::UsdStatementBalanceAmount> for UsdAccountAmounts {
fn from(balance: lana_app::trial_balance::UsdStatementBalanceAmount) -> Self {
UsdAccountAmounts {
debit: balance.dr_balance.into(),
credit: balance.cr_balance.into(),
debit: balance.dr_balance,
credit: balance.cr_balance,
net_debit: (balance.dr_balance - balance.cr_balance).into(),
net_credit: (balance.cr_balance - balance.dr_balance).into(),
}
Expand Down
9 changes: 4 additions & 5 deletions lana/app/src/accounting_init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ impl JournalInit {
}

#[derive(Clone)]
pub struct StatementsInit {
trial_balance_ids: TrialBalanceIds,
}
pub struct StatementsInit;

impl StatementsInit {
pub async fn statements(trial_balances: &TrialBalances) -> Result<Self, AccountingInitError> {
seed::statements::init(trial_balances).await
pub async fn statements(trial_balances: &TrialBalances) -> Result<(), AccountingInitError> {
seed::statements::init(trial_balances).await?;
Ok(())
}
}

Expand Down
6 changes: 0 additions & 6 deletions lana/app/src/accounting_init/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ pub struct ChartIds {
pub off_balance_sheet: ChartId,
}

#[derive(Clone, Copy)]
pub struct TrialBalanceIds {
pub primary: TrialBalanceId,
pub off_balance_sheet: TrialBalanceId,
}

#[derive(Clone)]
pub struct DepositsAccountPaths {
pub deposits: ControlSubAccountDetails,
Expand Down
17 changes: 6 additions & 11 deletions lana/app/src/accounting_init/seed/statements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ use crate::accounting_init::*;
pub(crate) async fn init(
trial_balances: &TrialBalances,
) -> Result<StatementsInit, AccountingInitError> {
let trial_balance_ids = create_trial_balances(trial_balances).await?;
create_trial_balances(trial_balances).await?;

Ok(StatementsInit { trial_balance_ids })
Ok(StatementsInit)
}

async fn create_trial_balances(
trial_balances: &TrialBalances,
) -> Result<TrialBalanceIds, AccountingInitError> {
let primary_id = match trial_balances
async fn create_trial_balances(trial_balances: &TrialBalances) -> Result<(), AccountingInitError> {
let _primary_id = match trial_balances
.find_by_name(TRIAL_BALANCE_STATEMENT_NAME.to_string())
.await?
{
Expand All @@ -28,7 +26,7 @@ async fn create_trial_balances(
}
};

let off_balance_sheet_id = match trial_balances
let _off_balance_sheet_id = match trial_balances
.find_by_name(OBS_TRIAL_BALANCE_STATEMENT_NAME.to_string())
.await?
{
Expand All @@ -43,8 +41,5 @@ async fn create_trial_balances(
}
};

Ok(TrialBalanceIds {
primary: primary_id.into(),
off_balance_sheet: off_balance_sheet_id.into(),
})
Ok(())
}
4 changes: 1 addition & 3 deletions lana/app/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl LanaApp {
let journal_init = JournalInit::journal(&cala).await?;
let trial_balances =
TrialBalances::init(&pool, &authz, &cala, journal_init.journal_id).await?;
let _statements_init = StatementsInit::statements(&trial_balances).await?;
StatementsInit::statements(&trial_balances).await?;
let chart_of_accounts =
ChartOfAccounts::init(&pool, &authz, &cala, journal_init.journal_id).await?;
let charts_init =
Expand Down Expand Up @@ -118,8 +118,6 @@ impl LanaApp {
journal_init.journal_id,
)
.await?;
let trial_balances =
TrialBalances::init(&pool, &authz, &cala, journal_init.journal_id).await?;
let terms_templates = TermsTemplates::new(&pool, &authz);
jobs.start_poll().await?;

Expand Down
2 changes: 0 additions & 2 deletions lana/app/src/trial_balance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pub use statement::*;
pub struct TrialBalances {
pool: sqlx::PgPool,
authz: Authorization,
cala: CalaLedger,
trial_balance_ledger: TrialBalanceLedger,
}

Expand All @@ -36,7 +35,6 @@ impl TrialBalances {
pool: pool.clone(),
trial_balance_ledger,
authz: authz.clone(),
cala: cala.clone(),
})
}

Expand Down

0 comments on commit 03e3aa4

Please sign in to comment.