debut ajout compte joint
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user