add in-memory DB for accounts, with tests!

This commit is contained in:
ari melody 2026-07-31 04:20:39 +01:00
parent 49e14b5bc5
commit 5a540184c9
Signed by: ari
GPG key ID: CF99829C92678188
9 changed files with 534 additions and 45 deletions

View file

@ -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)
}