fix: simplified gorm query

This commit is contained in:
ericprd
2025-03-01 19:00:12 +08:00
parent c29df8a3d6
commit 613379c8a5
4 changed files with 4 additions and 4 deletions
@@ -15,7 +15,7 @@ func (ur *UserRepository) GetUserByEmail(email string) (*authdomain.User, error)
return nil, errors.New("email is empty")
}
if err := ur.DB.Where("email = ?", email).First(&user).Error; err != nil {
if err := ur.DB.First(&user, "email = ?", email).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, errors.New("user not found")
}