Can get the list of movements of an account
This commit is contained in:
@ -45,9 +45,9 @@ impl UpdateMovementQuery {
|
||||
}
|
||||
|
||||
// Check for conflict with other movements
|
||||
if let Ok(_) =
|
||||
get_by_account_label_amount_time(self.account_id, &self.label, self.amount, self.time)
|
||||
.await
|
||||
if get_by_account_label_amount_time(self.account_id, &self.label, self.amount, self.time)
|
||||
.await
|
||||
.is_ok()
|
||||
{
|
||||
return Ok(Some(
|
||||
"A movement taken at the same time with the same label and the same amount already exists!",
|
||||
@ -120,3 +120,10 @@ pub async fn get_by_account_label_amount_time(
|
||||
)
|
||||
.get_result(&mut db()?)?)
|
||||
}
|
||||
|
||||
/// Get the list of movements of an account
|
||||
pub async fn get_list_account(account_id: AccountID) -> anyhow::Result<Vec<Movement>> {
|
||||
Ok(movements::table
|
||||
.filter(movements::dsl::account_id.eq(account_id.0))
|
||||
.get_results(&mut db()?)?)
|
||||
}
|
||||
|
Reference in New Issue
Block a user