Added method to get information about a user
the build failed Details

This commit is contained in:
konrad 2018-01-23 15:20:02 +01:00 committed by kolaente
parent 323f4c7ff4
commit 0027b1f001
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 6 additions and 0 deletions

View File

@ -67,6 +67,11 @@ func UserAddOrUpdate(c echo.Context) error {
return c.JSON(http.StatusBadRequest, models.Message{"Please specify a username."})
}
// Check for user does not exist
if models.IsErrUserDoesNotExist(err) {
return c.JSON(http.StatusBadRequest, models.Message{"The user does not exist."})
}
return c.JSON(http.StatusInternalServerError, models.Message{"Error"})
}

View File

@ -111,6 +111,7 @@ func RegisterRoutes(e *echo.Echo) {
a.GET("/users", apiv1.UsersList)
a.PUT("/users", apiv1.UserAddOrUpdate)
a.POST("/users/:id", apiv1.UserAddOrUpdate)
a.GET("/users/:id", apiv1.UserShow)
// Manage Users