feat: show recent transactions and view all transactions
This commit is contained in:
parent
d5fc4be7e8
commit
054f1227f0
8 changed files with 313 additions and 12 deletions
|
|
@ -89,6 +89,28 @@ func (s *TransactionService) PayBill(input PayBillInput) (*model.Transaction, er
|
|||
return txn, nil
|
||||
}
|
||||
|
||||
func (s *TransactionService) ListByAccount(accountID string, limit, offset int) ([]*model.Transaction, error) {
|
||||
if limit <= 0 {
|
||||
limit = 25
|
||||
}
|
||||
if offset < 0 {
|
||||
offset = 0
|
||||
}
|
||||
txns, err := s.transactionRepo.ListByAccount(accountID, limit, offset)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to list transactions: %w", err)
|
||||
}
|
||||
return txns, nil
|
||||
}
|
||||
|
||||
func (s *TransactionService) CountByAccount(accountID string) (int, error) {
|
||||
count, err := s.transactionRepo.CountByAccount(accountID)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("failed to count transactions: %w", err)
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (s *TransactionService) ListCategories() ([]*model.Category, error) {
|
||||
categories, err := s.categoryRepo.All()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue