feat: add content review flow
This commit is contained in:
@@ -86,3 +86,19 @@ func (c *contents) UpdateStatus(ctx fiber.Ctx, tenantID, contentID int64, form *
|
||||
func (c *contents) Review(ctx fiber.Ctx, user *models.User, id int64, form *dto.SuperContentReviewForm) error {
|
||||
return services.Super.ReviewContent(ctx, user.ID, id, form)
|
||||
}
|
||||
|
||||
// Batch review contents
|
||||
//
|
||||
// @Router /super/v1/contents/review/batch [post]
|
||||
// @Summary Batch review contents
|
||||
// @Description Batch review contents
|
||||
// @Tags Content
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param form body dto.SuperContentBatchReviewForm true "Batch review form"
|
||||
// @Success 200 {string} string "Reviewed"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind form body
|
||||
func (c *contents) BatchReview(ctx fiber.Ctx, user *models.User, form *dto.SuperContentBatchReviewForm) error {
|
||||
return services.Super.BatchReviewContents(ctx, user.ID, form)
|
||||
}
|
||||
|
||||
@@ -391,6 +391,15 @@ type SuperContentReviewForm struct {
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
type SuperContentBatchReviewForm struct {
|
||||
// ContentIDs 待审核内容ID列表。
|
||||
ContentIDs []int64 `json:"content_ids" validate:"required,min=1,dive,gt=0"`
|
||||
// Action 审核动作(approve/reject)。
|
||||
Action string `json:"action" validate:"required,oneof=approve reject"`
|
||||
// Reason 审核说明(驳回时填写,便于作者修正)。
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
type SuperTenantUserItem struct {
|
||||
// User 用户信息。
|
||||
User *SuperUserLite `json:"user"`
|
||||
|
||||
@@ -75,6 +75,12 @@ func (r *Routes) Register(router fiber.Router) {
|
||||
PathParam[int64]("id"),
|
||||
Body[dto.SuperContentReviewForm]("form"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /super/v1/contents/review/batch -> contents.BatchReview")
|
||||
router.Post("/super/v1/contents/review/batch"[len(r.Path()):], Func2(
|
||||
r.contents.BatchReview,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
Body[dto.SuperContentBatchReviewForm]("form"),
|
||||
))
|
||||
// Register routes for controller: coupons
|
||||
r.log.Debugf("Registering route: Get /super/v1/coupons -> coupons.List")
|
||||
router.Get("/super/v1/coupons"[len(r.Path()):], DataFunc1(
|
||||
|
||||
Reference in New Issue
Block a user