debut ajout compte joint

This commit is contained in:
2022-05-13 01:38:03 +02:00
parent cc6aa27d5d
commit 19a642b4d4
14 changed files with 785 additions and 1 deletions

View File

@@ -14,6 +14,26 @@ type Service struct {
db *Database
}
func (s Service) GetExpensesOfAnAccountBetween(accountId, from, to string) ([]*Expense, error) {
expenses, err := s.db.GetExpensesOfAnAccountBetween(accountId, from, to)
utils.GetLogger().Info(err)
if e, ok := err.(*dao.Error); ok {
switch {
case e.Type == dao.ErrTypeNotFound:
return nil, &model.ErrNotFound
default:
return nil, &model.ErrInternalServer
}
} else if err != nil {
return nil, &model.ErrInternalServer
}
if expenses == nil {
return nil, &model.ErrNotFound
}
return expenses, nil
}
func (s Service) GetAllExpensesOfAnAccount(accountId string) ([]*Expense, error) {
expenses, err := s.db.GetAllExpensesOfAnAccount(accountId)
utils.GetLogger().Info(err)