MCPcopy
hub / github.com/apache/answer / UpdateReview

Method UpdateReview

internal/controller/review_controller.go:96–111  ·  view source on GitHub ↗

UpdateReview update review @Summary update review @Description update review @Tags Review @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.UpdateReviewReq true "review" @Success 200 {object} handler.RespBody @Router /answer/api/v1/review/pending/post [put]

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

94// @Success 200 {object} handler.RespBody
95// @Router /answer/api/v1/review/pending/post [put]
96func (rc *ReviewController) UpdateReview(ctx *gin.Context) {
97 req := &schema.UpdateReviewReq{}
98 if handler.BindAndCheck(ctx, req) {
99 return
100 }
101
102 req.UserID = middleware.GetLoginUserIDFromContext(ctx)
103 req.IsAdmin = middleware.GetUserIsAdminModerator(ctx)
104 if !req.IsAdmin {
105 handler.HandleResponse(ctx, errors.Forbidden(reason.ForbiddenError), nil)
106 return
107 }
108
109 err := rc.reviewService.UpdateReview(ctx, req)
110 handler.HandleResponse(ctx, err, nil)
111}

Callers

nothing calls this directly

Calls 4

BindAndCheckFunction · 0.92
GetUserIsAdminModeratorFunction · 0.92
HandleResponseFunction · 0.92

Tested by

no test coverage detected