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

Method GetAnswerInfo

internal/controller/answer_controller.go:163–182  ·  view source on GitHub ↗

GetAnswerInfo get answer info @Summary Get Answer Detail @Description Get Answer Detail @Tags Answer @Accept json @Produce json @Param id query string true "id" @Success 200 {object} handler.RespBody{data=schema.GetAnswerInfoResp} @Router /answer/api/v1/answer/info [get]

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

161// @Success 200 {object} handler.RespBody{data=schema.GetAnswerInfoResp}
162// @Router /answer/api/v1/answer/info [get]
163func (ac *AnswerController) GetAnswerInfo(ctx *gin.Context) {
164 id := ctx.Query("id")
165 id = uid.DeShortID(id)
166 userID := middleware.GetLoginUserIDFromContext(ctx)
167 isAdminModerator := middleware.GetUserIsAdminModerator(ctx)
168
169 info, questionInfo, has, err := ac.answerService.Get(ctx, id, userID, isAdminModerator)
170 if err != nil {
171 handler.HandleResponse(ctx, err, gin.H{})
172 return
173 }
174 if !has {
175 handler.HandleResponse(ctx, fmt.Errorf(""), gin.H{})
176 return
177 }
178 handler.HandleResponse(ctx, err, &schema.GetAnswerInfoResp{
179 Info: info,
180 Question: questionInfo,
181 })
182}
183
184// AddAnswer add answer
185// @Summary Add Answer

Callers

nothing calls this directly

Calls 5

DeShortIDFunction · 0.92
GetUserIsAdminModeratorFunction · 0.92
HandleResponseFunction · 0.92
GetMethod · 0.45

Tested by

no test coverage detected