[MM-23264] Get channel member counts by group (#14068)
* MM-23264 Add api endpoint for get groups with members in channel Add store tests Add tests for api func Gofmt Apply changes from code review * MM-23264 Make store layers * MM-23264 Check read permission on channel member counts * Trigger CI
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e39569b358
Коммит
036f9384b4
@@ -128,6 +128,12 @@ type ChannelSearchOpts struct {
|
||||
PerPage *int
|
||||
}
|
||||
|
||||
type ChannelMemberCountByGroup struct {
|
||||
GroupId string `db:"-" json:"group_id"`
|
||||
ChannelMemberCount int64 `db:"-" json:"channel_member_count"`
|
||||
ChannelMemberTimezonesCount int64 `db:"-" json:"channel_member_timezones_count"`
|
||||
}
|
||||
|
||||
func (o *Channel) DeepCopy() *Channel {
|
||||
copy := *o
|
||||
if copy.SchemeId != nil {
|
||||
@@ -181,6 +187,12 @@ func ChannelModerationsPatchFromJson(data io.Reader) []*ChannelModerationPatch {
|
||||
return o
|
||||
}
|
||||
|
||||
func ChannelMemberCountsByGroupFromJson(data io.Reader) []*ChannelMemberCountByGroup {
|
||||
var o []*ChannelMemberCountByGroup
|
||||
json.NewDecoder(data).Decode(&o)
|
||||
return o
|
||||
}
|
||||
|
||||
func (o *Channel) Etag() string {
|
||||
return Etag(o.Id, o.UpdateAt)
|
||||
}
|
||||
|
||||
@@ -5004,3 +5004,12 @@ func (c *Client4) PatchChannelModerations(channelID string, patch []*ChannelMode
|
||||
defer closeBody(r)
|
||||
return ChannelModerationsFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
|
||||
func (c *Client4) GetChannelMemberCountsByGroup(channelID string, includeTimezones bool, etag string) ([]*ChannelMemberCountByGroup, *Response) {
|
||||
r, err := c.DoApiGet(c.GetChannelRoute(channelID)+"/member_counts_by_group?include_timezones="+strconv.FormatBool(includeTimezones), etag)
|
||||
if err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
}
|
||||
defer closeBody(r)
|
||||
return ChannelMemberCountsByGroupFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user