add/rm tokens, register with token
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package repositories
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"gorm.io/gorm"
|
||||
@@ -59,9 +60,13 @@ func (t *GORMRegisterTokenRepository) GetAll() ([]models.RegisterToken, error) {
|
||||
|
||||
func (t *GORMRegisterTokenRepository) Exists(tokenString string) (bool, error) {
|
||||
var token models.RegisterToken
|
||||
result := t.DB.First(&token, tokenString)
|
||||
result := t.DB.First(&token, "token = ?", tokenString)
|
||||
|
||||
if result.Error != nil {
|
||||
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
return false, result.Error
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user