feat: user and meta get api

This commit is contained in:
Noah Hsu
2022-07-27 17:41:25 +08:00
parent b399c924b7
commit 53fd09814a
3 changed files with 32 additions and 0 deletions

View File

@ -81,3 +81,18 @@ func DeleteUser(c *gin.Context) {
}
common.SuccessResp(c)
}
func GetUser(c *gin.Context) {
idStr := c.Query("id")
id, err := strconv.Atoi(idStr)
if err != nil {
common.ErrorResp(c, err, 400)
return
}
user, err := db.GetUserById(uint(id))
if err != nil {
common.ErrorResp(c, err, 500, true)
return
}
common.SuccessResp(c, user)
}