feat(http): implement missing findByID methods (#1635)

* feat(http): implement missing methods

* general cleanup
* unify param handling
* handle not found errors
* unify err handlers

* fix(http): fmt type
This commit is contained in:
ze0s 2024-08-29 12:22:03 +02:00 committed by GitHub
parent accc875960
commit acb91e8709
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 379 additions and 422 deletions

View file

@ -67,7 +67,12 @@ func (s *service) Store(ctx context.Context, apiKey *domain.APIKey) error {
}
func (s *service) Delete(ctx context.Context, key string) error {
err := s.repo.Delete(ctx, key)
_, err := s.repo.GetKey(ctx, key)
if err != nil {
return err
}
err = s.repo.Delete(ctx, key)
if err != nil {
return errors.Wrap(err, "could not delete api key: %s", key)
}