fix: handle duplicate input

This commit is contained in:
ericprd
2025-02-24 19:47:40 +08:00
parent bd305f0edf
commit 3b2321d5db
7 changed files with 19 additions and 10 deletions
+6
View File
@@ -9,6 +9,12 @@ import (
)
func (a *AuthSvc) RegisterUser(spec authdomain.RegisterUserReq) (string, error) {
_, err := a.userRepo.GetUserByEmail(spec.Email)
if err == nil {
return "", errors.New("this email address is already in use")
}
subsId, err := a.subsRepo.Create(spec.SubscribePlanID)
if err != nil {
return "", nil