feat: add mongodb support (#82)

* feat: add mongodb enum

* fix: isMongodb var condition

* feat: add init mongodb connection

* feat: add mongodb operations for various db methods

* fix: error message
This commit is contained in:
Lakhan Samani
2021-12-20 23:21:27 +05:30
committed by GitHub
parent 2342f7c5c6
commit 65478296cb
10 changed files with 335 additions and 77 deletions

View File

@@ -26,7 +26,7 @@ func Signup(ctx context.Context, params model.SignUpInput) (*model.AuthResponse,
return res, fmt.Errorf(`basic authentication is disabled for this instance`)
}
if params.ConfirmPassword != params.Password {
return res, fmt.Errorf(`passowrd and confirm password does not match`)
return res, fmt.Errorf(`password and confirm password does not match`)
}
params.Email = strings.ToLower(params.Email)
@@ -56,8 +56,11 @@ func Signup(ctx context.Context, params model.SignUpInput) (*model.AuthResponse,
if existingUser.EmailVerifiedAt > 0 {
// email is verified
return res, fmt.Errorf(`you have already signed up. Please login`)
return res, fmt.Errorf(`%s has already signed up`, params.Email)
} else if existingUser.ID != "" && existingUser.EmailVerifiedAt <= 0 {
return res, fmt.Errorf("%s has already signed up. please complete the email verification process or reset the password", params.Email)
}
user := db.User{
Email: params.Email,
}