[MM-42739] Insights - Top Channels API Endpoint (#19953)

* [MM-42739] Initial setup for top channels for team

* [MM-42739] Add initial tests

* [MM-42739] Update tests

* [MM-42739] Add top channels for user

* [MM-42739] Fix query

* [MM-42739] Update query

* [MM-42739] Improve query performance

* [MM-42739] Remove rank

* [MM-42739] Fix tests to use new time range today

* [MM-42739] Add tests for top channels for user

* [MM-42739] Add test for pagination

* Remove top channels by time struct

* [MM-42739] Update test names

* [MM-42739] Remove rank from top reactions

* [MM-42739] Return empty array instead of nil when result is empty

* [MM-42739] Add additional tests and update permissions check for teams

* [MM-42739] Add excluded channel tests for top reactions

* [MM-42739] Move insights to api4/insights and keep time range as string until required

* [MM-42739] Update queries only check DeleteAt after union

* [MM-42739] Improve query performance by using publicchannels table

* [MM-42739] Fix broken query after merge
Этот коммит содержится в:
Mylon Suren
2022-04-26 14:42:24 -04:00
коммит произвёл GitHub
родитель 9d37a6cc3d
Коммит 52ac449012
22 изменённых файлов: 1453 добавлений и 510 удалений

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

@@ -374,17 +374,6 @@ func (c *Context) RequireTimestamp() *Context {
return c
}
func (c *Context) RequireTimeRange() *Context {
if c.Err != nil {
return c
}
if c.Params.TimeRange == 0 {
c.SetInvalidURLParam("time_range")
}
return c
}
func (c *Context) RequireChannelId() *Context {
if c.Err != nil {
return c

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

@@ -31,7 +31,7 @@ type Params struct {
TokenId string
ThreadId string
Timestamp int64
TimeRange int64
TimeRange string
ChannelId string
PostId string
PolicyId string
@@ -255,11 +255,7 @@ func ParamsFromRequest(r *http.Request) *Params {
params.Timestamp = val
}
if val, err := model.GetStartUnixMilliForTimeRange(query.Get("time_range")); err != nil {
params.TimeRange = 0
} else {
params.TimeRange = val
}
params.TimeRange = query.Get("time_range")
if val, err := strconv.ParseBool(query.Get("permanent")); err == nil {
params.Permanent = val