feat: show account transfer history
All checks were successful
Deploy / build-and-deploy (push) Successful in 2m50s

This commit is contained in:
juancwu 2026-02-20 16:43:25 +00:00
commit e10186fd7a
7 changed files with 223 additions and 2 deletions

View file

@ -171,3 +171,31 @@ func (s *MoneyAccountService) GetAccountBalance(accountID string) (int, error) {
func (s *MoneyAccountService) GetTotalAllocatedForSpace(spaceID string) (int, error) {
return s.accountRepo.GetTotalAllocatedForSpace(spaceID)
}
const TransfersPerPage = 25
func (s *MoneyAccountService) GetTransfersForSpacePaginated(spaceID string, page int) ([]*model.AccountTransferWithAccount, int, error) {
total, err := s.accountRepo.CountTransfersBySpaceID(spaceID)
if err != nil {
return nil, 0, err
}
totalPages := (total + TransfersPerPage - 1) / TransfersPerPage
if totalPages < 1 {
totalPages = 1
}
if page < 1 {
page = 1
}
if page > totalPages {
page = totalPages
}
offset := (page - 1) * TransfersPerPage
transfers, err := s.accountRepo.GetTransfersBySpaceIDPaginated(spaceID, TransfersPerPage, offset)
if err != nil {
return nil, 0, err
}
return transfers, totalPages, nil
}