feat: add batch content report processing
This commit is contained in:
@@ -45,3 +45,19 @@ func (c *contentReports) List(ctx fiber.Ctx, filter *dto.SuperContentReportListF
|
||||
func (c *contentReports) Process(ctx fiber.Ctx, user *models.User, id int64, form *dto.SuperContentReportProcessForm) error {
|
||||
return services.Super.ProcessContentReport(ctx, user.ID, id, form)
|
||||
}
|
||||
|
||||
// Batch process content reports
|
||||
//
|
||||
// @Router /super/v1/content-reports/process/batch [post]
|
||||
// @Summary Batch process content reports
|
||||
// @Description Batch process content report records
|
||||
// @Tags Content
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param form body dto.SuperContentReportBatchProcessForm true "Batch process form"
|
||||
// @Success 200 {string} string "Processed"
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind form body
|
||||
func (c *contentReports) BatchProcess(ctx fiber.Ctx, user *models.User, form *dto.SuperContentReportBatchProcessForm) error {
|
||||
return services.Super.BatchProcessContentReports(ctx, user.ID, form)
|
||||
}
|
||||
|
||||
@@ -98,3 +98,15 @@ type SuperContentReportProcessForm struct {
|
||||
// Reason 处理说明(可选,用于审计记录)。
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
// SuperContentReportBatchProcessForm 超管内容举报批量处理表单。
|
||||
type SuperContentReportBatchProcessForm struct {
|
||||
// ReportIDs 待处理举报ID列表。
|
||||
ReportIDs []int64 `json:"report_ids" validate:"required,min=1,dive,gt=0"`
|
||||
// Action 处理动作(approve/reject)。
|
||||
Action string `json:"action" validate:"required,oneof=approve reject"`
|
||||
// ContentAction 内容处置动作(block/unpublish/ignore),仅在 approve 时生效。
|
||||
ContentAction string `json:"content_action"`
|
||||
// Reason 处理说明(可选,用于审计记录)。
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
@@ -108,6 +108,12 @@ func (r *Routes) Register(router fiber.Router) {
|
||||
PathParam[int64]("id"),
|
||||
Body[dto.SuperContentReportProcessForm]("form"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /super/v1/content-reports/process/batch -> contentReports.BatchProcess")
|
||||
router.Post("/super/v1/content-reports/process/batch"[len(r.Path()):], Func2(
|
||||
r.contentReports.BatchProcess,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
Body[dto.SuperContentReportBatchProcessForm]("form"),
|
||||
))
|
||||
// Register routes for controller: contents
|
||||
r.log.Debugf("Registering route: Get /super/v1/contents -> contents.List")
|
||||
router.Get("/super/v1/contents"[len(r.Path()):], DataFunc1(
|
||||
|
||||
Reference in New Issue
Block a user