Skip to content

Commit

Permalink
"Renamed 'EmailId' to 'AppleId' in UserRequestDetails struct and upda…
Browse files Browse the repository at this point in the history
…ted related code"
  • Loading branch information
p-shubh committed Dec 1, 2024
1 parent f90e80b commit 756e75e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/v1/account/auth-google.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func verifyIDToken(ctx context.Context, idToken string) (*idtoken.Payload, error
}

type UserRequestDetails struct {
EmailId string `json:"email"`
AppleId string `json:"appleId"`
}

func getUserDetails(c *gin.Context) {
Expand All @@ -310,14 +310,14 @@ func getUserDetails(c *gin.Context) {
}

// Validate EmailId
if queryReq.EmailId == "" {
if queryReq.AppleId == "" {
httpo.NewErrorResponse(http.StatusBadRequest, "EmailId is required").SendD(c)
return
}

var user models.User
// Query the database to find the user by EmailId
if err := db.Where("email_id = ?", queryReq.EmailId).First(&user).Error; err != nil {
if err := db.Where("apple_id = ?", queryReq.AppleId).First(&user).Error; err != nil {
if err == gorm.ErrRecordNotFound {
httpo.NewErrorResponse(http.StatusNotFound, "User not found").SendD(c)
} else {
Expand Down

0 comments on commit 756e75e

Please sign in to comment.