From 87900515fd42598951e21a5eb2f1f442eaaf5ac2 Mon Sep 17 00:00:00 2001 From: fchrgrib <16521492@mahasiswa.itb.ac.id> Date: Sat, 10 Jun 2023 12:44:43 +0700 Subject: [PATCH] edit userDescDB name models --- controllers/register/AuthGoogle.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controllers/register/AuthGoogle.go b/controllers/register/AuthGoogle.go index 99df580..aa6555d 100644 --- a/controllers/register/AuthGoogle.go +++ b/controllers/register/AuthGoogle.go @@ -17,6 +17,7 @@ import ( func CreateUserAuthGoogle(c *gin.Context) { var ( userDesc models.UserDescDB + justCheck models.UserDescDB userPhotoProfile models.UserPhotoProfileDB googleToken models.GoogleToken ) @@ -68,7 +69,7 @@ func CreateUserAuthGoogle(c *gin.Context) { PhoneNumber: "", } - if err := db.Table("user").Where("email = ?", user.Email).First(&models.UserDescDB{}).Error; err == nil { + if _ = db.Table("user").Where("email = ?", user.Email).First(&justCheck); justCheck.Email != "" { c.JSON(http.StatusBadRequest, gin.H{ "status": "cannot create new user because email was existed", })