GetComment godoc @Summary get comment by id @Description get comment by id @Tags Comment @Produce json @Param id query string true "id" @Success 200 {object} handler.RespBody{data=pager.PageModel{list=[]schema.GetCommentResp}} @Router /answer/api/v1/comment [get]
(ctx *gin.Context)
| 295 | // @Success 200 {object} handler.RespBody{data=pager.PageModel{list=[]schema.GetCommentResp}} |
| 296 | // @Router /answer/api/v1/comment [get] |
| 297 | func (cc *CommentController) GetComment(ctx *gin.Context) { |
| 298 | req := &schema.GetCommentReq{} |
| 299 | if handler.BindAndCheck(ctx, req) { |
| 300 | return |
| 301 | } |
| 302 | |
| 303 | req.UserID = middleware.GetLoginUserIDFromContext(ctx) |
| 304 | req.IsAdminModerator = middleware.GetUserIsAdminModerator(ctx) |
| 305 | canList, err := cc.rankService.CheckOperationPermissions(ctx, req.UserID, []string{ |
| 306 | permission.CommentEdit, |
| 307 | permission.CommentDelete, |
| 308 | }) |
| 309 | if err != nil { |
| 310 | handler.HandleResponse(ctx, err, nil) |
| 311 | return |
| 312 | } |
| 313 | req.CanEdit = canList[0] |
| 314 | req.CanDelete = canList[1] |
| 315 | |
| 316 | resp, err := cc.commentService.GetComment(ctx, req) |
| 317 | handler.HandleResponse(ctx, err, resp) |
| 318 | } |
nothing calls this directly
no test coverage detected