add in-memory DB for accounts, with tests!
This commit is contained in:
parent
49e14b5bc5
commit
5a540184c9
9 changed files with 534 additions and 45 deletions
|
|
@ -19,7 +19,7 @@ func NewAccountService(repo repository.AccountRepository, logger *log.Logger) (*
|
|||
}
|
||||
}
|
||||
|
||||
func (s *AccountService) GetAll() ([]model.Account, error) {
|
||||
func (s *AccountService) GetAll() ([]*model.Account, error) {
|
||||
return s.repo.GetAll()
|
||||
}
|
||||
|
||||
|
|
@ -39,12 +39,6 @@ func (s *AccountService) GetByEmail(email string) (*model.Account, error) {
|
|||
return s.repo.GetByEmail(email)
|
||||
}
|
||||
|
||||
func (s *AccountService) GetBySession(sessionToken string) (*model.Account, error) {
|
||||
if sessionToken == "" { return nil, nil }
|
||||
|
||||
return s.repo.GetBySession(sessionToken)
|
||||
}
|
||||
|
||||
func (s *AccountService) Create(
|
||||
username string,
|
||||
password string,
|
||||
|
|
@ -131,6 +125,10 @@ func (s *AccountService) IncrementFails(accountID string) (int, error) {
|
|||
return s.repo.IncrementFails(accountID)
|
||||
}
|
||||
|
||||
func (s *AccountService) ResetFails(accountID string) (error) {
|
||||
return s.repo.ResetFails(accountID)
|
||||
}
|
||||
|
||||
func (s *AccountService) Lock(accountID string) error {
|
||||
return s.repo.Lock(accountID)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue