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

@ -95,3 +95,18 @@ func DeleteMeta(c *gin.Context) {
}
common.SuccessResp(c)
}
func GetMeta(c *gin.Context) {
idStr := c.Query("id")
id, err := strconv.Atoi(idStr)
if err != nil {
common.ErrorResp(c, err, 400)
return
}
meta, err := db.GetMetaById(uint(id))
if err != nil {
common.ErrorResp(c, err, 500, true)
return
}
common.SuccessResp(c, meta)
}