MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / GetSelf

Function GetSelf

controller/user.go:400–416  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

398}
399
400func GetSelf(c *gin.Context) {
401 id := c.GetInt("id")
402 user, err := model.GetUserById(id, false)
403 if err != nil {
404 common.ApiError(c, err)
405 return
406 }
407 // Hide admin remarks: set to empty to trigger omitempty tag, ensuring the remark field is not included in JSON returned to regular users
408 user.Remark = ""
409
410 c.JSON(http.StatusOK, gin.H{
411 "success": true,
412 "message": "",
413 "data": user,
414 })
415 return
416}
417
418func GetUserModels(c *gin.Context) {
419 id, err := strconv.Atoi(c.Param("id"))

Callers

nothing calls this directly

Calls 2

GetUserByIdFunction · 0.92
ApiErrorFunction · 0.92

Tested by

no test coverage detected