48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
package v1
|
|
|
|
import (
|
|
dto "quyun/v2/app/http/super/v1/dto"
|
|
"quyun/v2/app/requests"
|
|
"quyun/v2/app/services"
|
|
"quyun/v2/database/models"
|
|
|
|
"github.com/gofiber/fiber/v3"
|
|
)
|
|
|
|
// @provider
|
|
type comments struct{}
|
|
|
|
// List comments
|
|
//
|
|
// @Router /super/v1/comments [get]
|
|
// @Summary List comments
|
|
// @Description List comments across tenants
|
|
// @Tags Content
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param page query int false "Page number"
|
|
// @Param limit query int false "Page size"
|
|
// @Success 200 {object} requests.Pager{items=[]dto.SuperCommentItem}
|
|
// @Bind filter query
|
|
func (c *comments) List(ctx fiber.Ctx, filter *dto.SuperCommentListFilter) (*requests.Pager, error) {
|
|
return services.Super.ListComments(ctx, filter)
|
|
}
|
|
|
|
// Delete comment
|
|
//
|
|
// @Router /super/v1/comments/:id<int>/delete [post]
|
|
// @Summary Delete comment
|
|
// @Description Soft delete a comment
|
|
// @Tags Content
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param id path int64 true "Comment ID"
|
|
// @Param form body dto.SuperCommentDeleteForm false "Delete form"
|
|
// @Success 200 {string} string "Deleted"
|
|
// @Bind user local key(__ctx_user)
|
|
// @Bind id path
|
|
// @Bind form body
|
|
func (c *comments) Delete(ctx fiber.Ctx, user *models.User, id int64, form *dto.SuperCommentDeleteForm) error {
|
|
return services.Super.DeleteComment(ctx, user.ID, id, form)
|
|
}
|