32 lines
512 B
Go
32 lines
512 B
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"git.tek.govt.hu/dowerx/chat/server/controller"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
const USERNAME_PARAM string = "username"
|
|
|
|
func userInfo(c *gin.Context) {
|
|
username := c.Param(USERNAME_PARAM)
|
|
|
|
userController, err := controller.MakeUserController()
|
|
if err != nil {
|
|
sendError(c, err)
|
|
return
|
|
}
|
|
|
|
user, err := userController.GetUser(username)
|
|
if err != nil {
|
|
sendError(c, err)
|
|
return
|
|
}
|
|
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"message": "user found",
|
|
"user": user,
|
|
})
|
|
}
|