feat: add superadmin user interaction views
This commit is contained in:
@@ -116,3 +116,38 @@ type SuperUserRealNameResponse struct {
|
||||
// IDCardMasked 身份证号脱敏展示。
|
||||
IDCardMasked string `json:"id_card_masked"`
|
||||
}
|
||||
|
||||
// SuperUserContentActionListFilter 超管用户互动内容列表过滤条件。
|
||||
type SuperUserContentActionListFilter struct {
|
||||
requests.Pagination
|
||||
// TenantID 内容所属租户ID,精确匹配。
|
||||
TenantID *int64 `query:"tenant_id"`
|
||||
// TenantCode 租户编码,模糊匹配。
|
||||
TenantCode *string `query:"tenant_code"`
|
||||
// TenantName 租户名称,模糊匹配。
|
||||
TenantName *string `query:"tenant_name"`
|
||||
// ContentID 内容ID,精确匹配。
|
||||
ContentID *int64 `query:"content_id"`
|
||||
// Keyword 内容标题/摘要/描述关键字,模糊匹配。
|
||||
Keyword *string `query:"keyword"`
|
||||
// CreatedAtFrom 互动时间起始(RFC3339)。
|
||||
CreatedAtFrom *string `query:"created_at_from"`
|
||||
// CreatedAtTo 互动时间结束(RFC3339)。
|
||||
CreatedAtTo *string `query:"created_at_to"`
|
||||
// Asc 升序字段(id/created_at)。
|
||||
Asc *string `query:"asc"`
|
||||
// Desc 降序字段(id/created_at)。
|
||||
Desc *string `query:"desc"`
|
||||
}
|
||||
|
||||
// SuperUserContentActionItem 超管用户互动内容条目。
|
||||
type SuperUserContentActionItem struct {
|
||||
// ActionID 互动记录ID。
|
||||
ActionID int64 `json:"action_id"`
|
||||
// ActionType 互动类型(like/favorite)。
|
||||
ActionType consts.UserContentActionType `json:"action_type"`
|
||||
// ActionAt 互动发生时间(RFC3339)。
|
||||
ActionAt string `json:"action_at"`
|
||||
// Content 互动对应内容详情(含租户与作者信息)。
|
||||
Content *AdminContentItem `json:"content"`
|
||||
}
|
||||
|
||||
@@ -316,6 +316,24 @@ func (r *Routes) Register(router fiber.Router) {
|
||||
PathParam[int64]("id"),
|
||||
Query[dto.SuperUserCouponListFilter]("filter"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /super/v1/users/:id<int>/favorites -> users.ListFavorites")
|
||||
router.Get("/super/v1/users/:id<int>/favorites"[len(r.Path()):], DataFunc2(
|
||||
r.users.ListFavorites,
|
||||
PathParam[int64]("id"),
|
||||
Query[dto.SuperUserContentActionListFilter]("filter"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /super/v1/users/:id<int>/following -> users.ListFollowing")
|
||||
router.Get("/super/v1/users/:id<int>/following"[len(r.Path()):], DataFunc2(
|
||||
r.users.ListFollowing,
|
||||
PathParam[int64]("id"),
|
||||
Query[dto.SuperUserTenantListFilter]("filter"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /super/v1/users/:id<int>/likes -> users.ListLikes")
|
||||
router.Get("/super/v1/users/:id<int>/likes"[len(r.Path()):], DataFunc2(
|
||||
r.users.ListLikes,
|
||||
PathParam[int64]("id"),
|
||||
Query[dto.SuperUserContentActionListFilter]("filter"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /super/v1/users/:id<int>/notifications -> users.ListNotifications")
|
||||
router.Get("/super/v1/users/:id<int>/notifications"[len(r.Path()):], DataFunc2(
|
||||
r.users.ListNotifications,
|
||||
|
||||
@@ -127,6 +127,60 @@ func (c *users) ListTenants(ctx fiber.Ctx, id int64, filter *dto.SuperUserTenant
|
||||
return services.Super.ListUserTenants(ctx, id, filter)
|
||||
}
|
||||
|
||||
// List user favorites
|
||||
//
|
||||
// @Router /super/v1/users/:id<int>/favorites [get]
|
||||
// @Summary List user favorites
|
||||
// @Description List user's favorited contents
|
||||
// @Tags User
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int64 true "User ID"
|
||||
// @Param page query int false "Page number"
|
||||
// @Param limit query int false "Page size"
|
||||
// @Success 200 {object} requests.Pager{items=[]dto.SuperUserContentActionItem}
|
||||
// @Bind id path
|
||||
// @Bind filter query
|
||||
func (c *users) ListFavorites(ctx fiber.Ctx, id int64, filter *dto.SuperUserContentActionListFilter) (*requests.Pager, error) {
|
||||
return services.Super.ListUserFavorites(ctx, id, filter)
|
||||
}
|
||||
|
||||
// List user likes
|
||||
//
|
||||
// @Router /super/v1/users/:id<int>/likes [get]
|
||||
// @Summary List user likes
|
||||
// @Description List user's liked contents
|
||||
// @Tags User
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int64 true "User ID"
|
||||
// @Param page query int false "Page number"
|
||||
// @Param limit query int false "Page size"
|
||||
// @Success 200 {object} requests.Pager{items=[]dto.SuperUserContentActionItem}
|
||||
// @Bind id path
|
||||
// @Bind filter query
|
||||
func (c *users) ListLikes(ctx fiber.Ctx, id int64, filter *dto.SuperUserContentActionListFilter) (*requests.Pager, error) {
|
||||
return services.Super.ListUserLikes(ctx, id, filter)
|
||||
}
|
||||
|
||||
// List user following tenants
|
||||
//
|
||||
// @Router /super/v1/users/:id<int>/following [get]
|
||||
// @Summary List user following tenants
|
||||
// @Description List tenants followed by user
|
||||
// @Tags User
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int64 true "User ID"
|
||||
// @Param page query int false "Page number"
|
||||
// @Param limit query int false "Page size"
|
||||
// @Success 200 {object} requests.Pager{items=[]dto.UserTenantItem}
|
||||
// @Bind id path
|
||||
// @Bind filter query
|
||||
func (c *users) ListFollowing(ctx fiber.Ctx, id int64, filter *dto.SuperUserTenantListFilter) (*requests.Pager, error) {
|
||||
return services.Super.ListUserFollowing(ctx, id, filter)
|
||||
}
|
||||
|
||||
// Update user status
|
||||
//
|
||||
// @Router /super/v1/users/:id<int>/status [patch]
|
||||
|
||||
Reference in New Issue
Block a user