MCPcopy Index your code
hub / github.com/apache/answer / QuestionPage

Method QuestionPage

internal/controller/question_controller.go:326–343  ·  view source on GitHub ↗

QuestionPage get questions by page @Summary get questions by page @Description get questions by page @Tags Question @Accept json @Produce json @Param data body schema.QuestionPageReq true "QuestionPageReq" @Success 200 {object} handler.RespBody{data=pager.PageModel{list=[]schema.QuestionPageResp}

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

324// @Success 200 {object} handler.RespBody{data=pager.PageModel{list=[]schema.QuestionPageResp}}
325// @Router /answer/api/v1/question/page [get]
326func (qc *QuestionController) QuestionPage(ctx *gin.Context) {
327 req := &schema.QuestionPageReq{}
328 if handler.BindAndCheck(ctx, req) {
329 return
330 }
331 req.LoginUserID = middleware.GetLoginUserIDFromContext(ctx)
332
333 questions, total, err := qc.questionService.GetQuestionPage(ctx, req)
334 if err != nil {
335 handler.HandleResponse(ctx, err, nil)
336 return
337 }
338 if pager.ValPageOutOfRange(total, req.Page, req.PageSize) {
339 handler.HandleResponse(ctx, errors.NotFound(reason.RequestFormatError), nil)
340 return
341 }
342 handler.HandleResponse(ctx, nil, pager.NewPageModel(total, questions))
343}
344
345// QuestionRecommendPage get recommend questions by page
346// @Summary get recommend questions by page

Callers

nothing calls this directly

Calls 6

BindAndCheckFunction · 0.92
HandleResponseFunction · 0.92
ValPageOutOfRangeFunction · 0.92
NewPageModelFunction · 0.92
GetQuestionPageMethod · 0.65

Tested by

no test coverage detected