Endpoint for APIv4: GET /team/{team_id}/channels (#5681)

Этот коммит содержится в:
Saturnino Abril
2017-03-13 21:26:51 +09:00
коммит произвёл George Goldberg
родитель 3559fb7959
Коммит 8731465957
8 изменённых файлов: 249 добавлений и 0 удалений

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

@@ -550,6 +550,40 @@ func (s SqlChannelStore) GetMoreChannels(teamId string, userId string, offset in
return storeChannel
}
func (s SqlChannelStore) GetPublicChannelsForTeam(teamId string, offset int, limit int) StoreChannel {
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
data := &model.ChannelList{}
_, err := s.GetReplica().Select(data,
`SELECT
*
FROM
Channels
WHERE
TeamId = :TeamId
AND Type = 'O'
AND DeleteAt = 0
ORDER BY DisplayName
LIMIT :Limit
OFFSET :Offset`,
map[string]interface{}{"TeamId": teamId, "Limit": limit, "Offset": offset})
if err != nil {
result.Err = model.NewLocAppError("SqlChannelStore.GetPublicChannelsForTeam", "store.sql_channel.get_public_channels.get.app_error", nil, "teamId="+teamId+", err="+err.Error())
} else {
result.Data = data
}
storeChannel <- result
close(storeChannel)
}()
return storeChannel
}
type channelIdWithCountAndUpdateAt struct {
Id string
TotalMsgCount int64