feat: add empty handler
This commit is contained in:
@@ -16,7 +16,7 @@ import (
|
||||
|
||||
var httpClient = &http.Client{}
|
||||
|
||||
func (hc *handlersContext) GetAllUsers(c *gin.Context) {
|
||||
func (hc *handlersContext) getAllUsers(c *gin.Context) {
|
||||
users, err := hc.db.GetAllUsers()
|
||||
if err != nil {
|
||||
utils.GetLoggerFromCtx(c).WithError(err).Error("error while getting users")
|
||||
@@ -26,7 +26,7 @@ func (hc *handlersContext) GetAllUsers(c *gin.Context) {
|
||||
utils.JSON(c.Writer, http.StatusOK, users)
|
||||
}
|
||||
|
||||
func (hc *handlersContext) ConnectUser(c *gin.Context) {
|
||||
func (hc *handlersContext) connectUser(c *gin.Context) {
|
||||
authorizationHeader := c.GetHeader("Authorization")
|
||||
authorizationHeaderSplitted := strings.Split(authorizationHeader, " ")
|
||||
if len(authorizationHeaderSplitted) != 2 {
|
||||
@@ -66,7 +66,7 @@ func (hc *handlersContext) ConnectUser(c *gin.Context) {
|
||||
|
||||
utils.JSON(c.Writer, 200, user)
|
||||
}
|
||||
func (hc *handlersContext) CreateUser(c *gin.Context) {
|
||||
func (hc *handlersContext) createUser(c *gin.Context) {
|
||||
b, err := c.GetRawData()
|
||||
if err != nil {
|
||||
utils.GetLoggerFromCtx(c).WithError(err).Error("error while creating user, read data fail")
|
||||
@@ -111,7 +111,7 @@ func (hc *handlersContext) CreateUser(c *gin.Context) {
|
||||
utils.JSON(c.Writer, http.StatusCreated, user)
|
||||
}
|
||||
|
||||
func (hc *handlersContext) GetUser(c *gin.Context) {
|
||||
func (hc *handlersContext) getUser(c *gin.Context) {
|
||||
userID := c.Param("id")
|
||||
|
||||
err := hc.validator.VarCtx(c, userID, "uuid4")
|
||||
@@ -145,7 +145,7 @@ func (hc *handlersContext) GetUser(c *gin.Context) {
|
||||
utils.JSON(c.Writer, http.StatusOK, user)
|
||||
}
|
||||
|
||||
func (hc *handlersContext) DeleteUser(c *gin.Context) {
|
||||
func (hc *handlersContext) deleteUser(c *gin.Context) {
|
||||
userID := c.Param("id")
|
||||
|
||||
err := hc.validator.VarCtx(c, userID, "uuid4")
|
||||
@@ -192,7 +192,7 @@ func (hc *handlersContext) DeleteUser(c *gin.Context) {
|
||||
utils.JSON(c.Writer, http.StatusNoContent, nil)
|
||||
}
|
||||
|
||||
func (hc *handlersContext) UpdateUser(c *gin.Context) {
|
||||
func (hc *handlersContext) updateUser(c *gin.Context) {
|
||||
userID := c.Param("id")
|
||||
|
||||
err := hc.validator.VarCtx(c, userID, "uuid4")
|
||||
|
||||
Reference in New Issue
Block a user