MM-18512 Use options struct for GetProfilesWithoutTeam and add filtering to API (#12200)

* Use options struct for GetProfilesWithoutTeam and add filtering

* Fix test
Этот коммит содержится в:
Joram Wilander
2019-09-17 15:13:17 -04:00
коммит произвёл Miguel de la Cruz
родитель 4ce7b92283
Коммит 3d4c941ba8
11 изменённых файлов: 137 добавлений и 833 удалений

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

@@ -1195,6 +1195,40 @@ func (s *TimerLayerChannelStore) GetMoreChannels(teamId string, userId string, o
return resultVar0, resultVar1
}
func (s *TimerLayerChannelStore) GetPinnedPostCount(channelId string, allowFromCache bool) (int64, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.ChannelStore.GetPinnedPostCount(channelId, allowFromCache)
t := timemodule.Now()
elapsed := t.Sub(start)
if s.Root.Metrics != nil {
success := "false"
if resultVar1 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetPinnedPostCount", success, float64(elapsed))
}
return resultVar0, resultVar1
}
func (s *TimerLayerChannelStore) GetPinnedPostCountFromCache(channelId string) int64 {
start := timemodule.Now()
resultVar0 := s.ChannelStore.GetPinnedPostCountFromCache(channelId)
t := timemodule.Now()
elapsed := t.Sub(start)
if s.Root.Metrics != nil {
success := "false"
if true {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetPinnedPostCountFromCache", success, float64(elapsed))
}
return resultVar0
}
func (s *TimerLayerChannelStore) GetPinnedPosts(channelId string) (*model.PostList, *model.AppError) {
start := timemodule.Now()
@@ -5360,6 +5394,40 @@ func (s *TimerLayerTeamStore) AnalyticsGetTeamCountForScheme(schemeId string) (i
return resultVar0, resultVar1
}
func (s *TimerLayerTeamStore) AnalyticsPrivateTeamCount() (int64, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.TeamStore.AnalyticsPrivateTeamCount()
t := timemodule.Now()
elapsed := t.Sub(start)
if s.Root.Metrics != nil {
success := "false"
if resultVar1 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.AnalyticsPrivateTeamCount", success, float64(elapsed))
}
return resultVar0, resultVar1
}
func (s *TimerLayerTeamStore) AnalyticsPublicTeamCount() (int64, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.TeamStore.AnalyticsPublicTeamCount()
t := timemodule.Now()
elapsed := t.Sub(start)
if s.Root.Metrics != nil {
success := "false"
if resultVar1 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.AnalyticsPublicTeamCount", success, float64(elapsed))
}
return resultVar0, resultVar1
}
func (s *TimerLayerTeamStore) AnalyticsTeamCount() (int64, *model.AppError) {
start := timemodule.Now()
@@ -5530,6 +5598,23 @@ func (s *TimerLayerTeamStore) GetAllPrivateTeamPageListing(offset int, limit int
return resultVar0, resultVar1
}
func (s *TimerLayerTeamStore) GetAllPublicTeamPageListing(offset int, limit int) ([]*model.Team, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.TeamStore.GetAllPublicTeamPageListing(offset, limit)
t := timemodule.Now()
elapsed := t.Sub(start)
if s.Root.Metrics != nil {
success := "false"
if resultVar1 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetAllPublicTeamPageListing", success, float64(elapsed))
}
return resultVar0, resultVar1
}
func (s *TimerLayerTeamStore) GetAllTeamListing() ([]*model.Team, *model.AppError) {
start := timemodule.Now()
@@ -6737,10 +6822,10 @@ func (s *TimerLayerUserStore) GetProfilesNotInTeam(teamId string, groupConstrain
return resultVar0, resultVar1
}
func (s *TimerLayerUserStore) GetProfilesWithoutTeam(offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) {
func (s *TimerLayerUserStore) GetProfilesWithoutTeam(options *model.UserGetOptions) ([]*model.User, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.UserStore.GetProfilesWithoutTeam(offset, limit, viewRestrictions)
resultVar0, resultVar1 := s.UserStore.GetProfilesWithoutTeam(options)
t := timemodule.Now()
elapsed := t.Sub(start)