1
0

Refactor GetUser & GetUserByID

This commit is contained in:
konrad
2018-08-30 19:14:02 +02:00
committed by kolaente
parent aeb1521cc4
commit 478c98fb8d
26 changed files with 69 additions and 75 deletions

View File

@ -58,9 +58,14 @@ func userAddOrUpdate(c echo.Context) error {
}
// Check if the user exists
_, exists, err := models.GetUserByID(datUser.ID)
var exists bool
_, err := models.GetUserByID(datUser.ID)
if err != nil {
return c.JSON(http.StatusInternalServerError, models.Message{"Could not check if the user exists."})
if models.IsErrUserDoesNotExist(err) {
exists = true
} else {
return c.JSON(http.StatusInternalServerError, models.Message{"Could not check if the user exists."})
}
}
// Insert or update the user