[MM-56206] Allow for proper paging and sorting (#25726)

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Devin Binnie
2023-12-17 19:26:06 -05:00
коммит произвёл GitHub
родитель 485ae6ae4e
Коммит 5c061a6f75
7 изменённых файлов: 114 добавлений и 35 удалений

Просмотреть файл

@@ -1924,6 +1924,9 @@ func (c *Client4) EnableUserAccessToken(ctx context.Context, tokenId string) (*R
func (c *Client4) GetUsersForReporting(ctx context.Context, options *UserReportOptions) ([]*UserReport, *Response, error) {
values := url.Values{}
if options.Direction != "" {
values.Set("direction", options.Direction)
}
if options.SortColumn != "" {
values.Set("sort_column", options.SortColumn)
}
@@ -1942,11 +1945,11 @@ func (c *Client4) GetUsersForReporting(ctx context.Context, options *UserReportO
if options.SortDesc {
values.Set("sort_direction", "desc")
}
if options.LastSortColumnValue != "" {
values.Set("last_column_value", options.LastSortColumnValue)
if options.FromColumnValue != "" {
values.Set("from_column_value", options.FromColumnValue)
}
if options.LastUserId != "" {
values.Set("last_id", options.LastUserId)
if options.FromId != "" {
values.Set("from_id", options.FromId)
}
if options.Role != "" {
values.Set("role_filter", options.Role)

Просмотреть файл

@@ -23,13 +23,15 @@ var (
)
type ReportingBaseOptions struct {
SortDesc bool
PageSize int
SortColumn string
LastSortColumnValue string
DateRange string
StartAt int64
EndAt int64
SortDesc bool
Direction string // Accepts only "up" or "down"
PageSize int
SortColumn string
FromColumnValue string
FromId string
DateRange string
StartAt int64
EndAt int64
}
func (options *ReportingBaseOptions) PopulateDateRange(now time.Time) {
@@ -75,7 +77,6 @@ type UserReport struct {
type UserReportOptions struct {
ReportingBaseOptions
LastUserId string
Role string
Team string
HasNoTeam bool