exclude password
This commit is contained in:
@@ -48,7 +48,7 @@ func (h *Handler) GetUserBatch(c echo.Context) error {
|
|||||||
return c.NoContent(http.StatusBadRequest)
|
return c.NoContent(http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
h.DB.Find(&users, ids)
|
h.DB.Omit("Password").Find(&users, ids)
|
||||||
|
|
||||||
return c.JSON(http.StatusOK, users)
|
return c.JSON(http.StatusOK, users)
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ func (h *Handler) GetUser(c echo.Context) error {
|
|||||||
return c.NoContent(http.StatusBadRequest)
|
return c.NoContent(http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
tx := h.DB.Preload("Position").Where("id = ?", id).Find(&user)
|
tx := h.DB.Preload("Position").Omit("Password").Where("id = ?", id).Find(&user)
|
||||||
|
|
||||||
if tx.RowsAffected == 0 {
|
if tx.RowsAffected == 0 {
|
||||||
return c.NoContent(http.StatusNotFound)
|
return c.NoContent(http.StatusNotFound)
|
||||||
|
|||||||
Reference in New Issue
Block a user