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)
| 161 | // @Success 200 {object} handler.RespBody{data=schema.GetAnswerInfoResp} |
| 162 | // @Router /answer/api/v1/answer/info [get] |
| 163 | func (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 |
nothing calls this directly
no test coverage detected