package v1 import ( dto "quyun/v2/app/http/super/v1/dto" "quyun/v2/app/requests" "quyun/v2/app/services" "github.com/gofiber/fiber/v3" ) // @provider type users struct{} // List users // // @Router /super/v1/users [get] // @Summary List users // @Description List users // @Tags User // @Accept json // @Produce json // @Param page query int false "Page number" // @Param limit query int false "Page size" // @Param username query string false "Username" // @Success 200 {object} requests.Pager{items=[]dto.UserItem} // @Bind filter query func (c *users) List(ctx fiber.Ctx, filter *dto.UserListFilter) (*requests.Pager, error) { return services.Super.ListUsers(ctx, filter) } // Get user // // @Router /super/v1/users/:id [get] // @Summary Get user // @Description Get user // @Tags User // @Accept json // @Produce json // @Param id path int64 true "User ID" // @Success 200 {object} dto.UserItem // @Bind id path func (c *users) Get(ctx fiber.Ctx, id int64) (*dto.UserItem, error) { return services.Super.GetUser(ctx, id) } // Get user wallet // // @Router /super/v1/users/:id/wallet [get] // @Summary Get user wallet // @Description Get user wallet balance and transactions // @Tags User // @Accept json // @Produce json // @Param id path int64 true "User ID" // @Success 200 {object} dto.SuperWalletResponse // @Bind id path func (c *users) Wallet(ctx fiber.Ctx, id int64) (*dto.SuperWalletResponse, error) { return services.Super.GetUserWallet(ctx, id) } // List user notifications // // @Router /super/v1/users/:id/notifications [get] // @Summary List user notifications // @Description List notifications of a 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.SuperUserNotificationItem} // @Bind id path // @Bind filter query func (c *users) ListNotifications(ctx fiber.Ctx, id int64, filter *dto.SuperUserNotificationListFilter) (*requests.Pager, error) { return services.Super.ListUserNotifications(ctx, id, filter) } // List user coupons // // @Router /super/v1/users/:id/coupons [get] // @Summary List user coupons // @Description List coupons of a 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.SuperUserCouponItem} // @Bind id path // @Bind filter query func (c *users) ListCoupons(ctx fiber.Ctx, id int64, filter *dto.SuperUserCouponListFilter) (*requests.Pager, error) { return services.Super.ListUserCoupons(ctx, id, filter) } // Get user real-name verification detail // // @Router /super/v1/users/:id/realname [get] // @Summary Get user real-name verification detail // @Description Get real-name verification detail of a user // @Tags User // @Accept json // @Produce json // @Param id path int64 true "User ID" // @Success 200 {object} dto.SuperUserRealNameResponse // @Bind id path func (c *users) RealName(ctx fiber.Ctx, id int64) (*dto.SuperUserRealNameResponse, error) { return services.Super.GetUserRealName(ctx, id) } // List user tenants // // @Router /super/v1/users/:id/tenants [get] // @Summary List user tenants // @Description List tenants joined 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) ListTenants(ctx fiber.Ctx, id int64, filter *dto.SuperUserTenantListFilter) (*requests.Pager, error) { return services.Super.ListUserTenants(ctx, id, filter) } // List user favorites // // @Router /super/v1/users/:id/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/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/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/status [patch] // @Summary Update user status // @Description Update user status // @Tags User // @Accept json // @Produce json // @Param id path int64 true "User ID" // @Param form body dto.UserStatusUpdateForm true "Update form" // @Success 200 {string} string "Updated" // @Bind id path // @Bind form body func (c *users) UpdateStatus(ctx fiber.Ctx, id int64, form *dto.UserStatusUpdateForm) error { return services.Super.UpdateUserStatus(ctx, id, form) } // Update user roles // // @Router /super/v1/users/:id/roles [patch] // @Summary Update user roles // @Description Update user roles // @Tags User // @Accept json // @Produce json // @Param id path int64 true "User ID" // @Param form body dto.UserRolesUpdateForm true "Update form" // @Success 200 {string} string "Updated" // @Bind id path // @Bind form body func (c *users) UpdateRoles(ctx fiber.Ctx, id int64, form *dto.UserRolesUpdateForm) error { return services.Super.UpdateUserRoles(ctx, id, form) } // User statistics // // @Router /super/v1/users/statistics [get] // @Summary User statistics // @Description User statistics // @Tags User // @Accept json // @Produce json // @Success 200 {array} dto.UserStatistics func (c *users) Statistics(ctx fiber.Ctx) ([]dto.UserStatistics, error) { return services.Super.UserStatistics(ctx) } // User statuses // // @Router /super/v1/users/statuses [get] // @Summary User statuses // @Description User statuses // @Tags User // @Accept json // @Produce json // @Success 200 {array} requests.KV func (c *users) Statuses(ctx fiber.Ctx) ([]requests.KV, error) { return services.Super.UserStatuses(ctx) }