Mm 30807 granular data retention scaffold (#16891)
create the necessary tables, models and APIs for the granular data retention policy feature
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
03473f98ac
Коммит
3ea75332e7
64
app/team.go
64
app/team.go
@@ -879,8 +879,8 @@ func (a *App) GetAllTeams() ([]*model.Team, *model.AppError) {
|
||||
return teams, nil
|
||||
}
|
||||
|
||||
func (a *App) GetAllTeamsPage(offset int, limit int) ([]*model.Team, *model.AppError) {
|
||||
teams, err := a.Srv().Store.Team().GetAllPage(offset, limit)
|
||||
func (a *App) GetAllTeamsPage(offset int, limit int, opts *model.TeamSearch) ([]*model.Team, *model.AppError) {
|
||||
teams, err := a.Srv().Store.Team().GetAllPage(offset, limit, opts)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetAllTeamsPage", "app.team.get_all.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
@@ -888,12 +888,12 @@ func (a *App) GetAllTeamsPage(offset int, limit int) ([]*model.Team, *model.AppE
|
||||
return teams, nil
|
||||
}
|
||||
|
||||
func (a *App) GetAllTeamsPageWithCount(offset int, limit int) (*model.TeamsWithCount, *model.AppError) {
|
||||
totalCount, err := a.Srv().Store.Team().AnalyticsTeamCount(true)
|
||||
func (a *App) GetAllTeamsPageWithCount(offset int, limit int, opts *model.TeamSearch) (*model.TeamsWithCount, *model.AppError) {
|
||||
totalCount, err := a.Srv().Store.Team().AnalyticsTeamCount(opts)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetAllTeamsPageWithCount", "app.team.analytics_team_count.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
teams, err := a.Srv().Store.Team().GetAllPage(offset, limit)
|
||||
teams, err := a.Srv().Store.Team().GetAllPage(offset, limit, opts)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetAllTeamsPageWithCount", "app.team.get_all.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
@@ -909,27 +909,6 @@ func (a *App) GetAllPrivateTeams() ([]*model.Team, *model.AppError) {
|
||||
return teams, nil
|
||||
}
|
||||
|
||||
func (a *App) GetAllPrivateTeamsPage(offset int, limit int) ([]*model.Team, *model.AppError) {
|
||||
teams, err := a.Srv().Store.Team().GetAllPrivateTeamPageListing(offset, limit)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetAllPrivateTeamsPage", "app.team.get_all_private_team_page_listing.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return teams, nil
|
||||
}
|
||||
|
||||
func (a *App) GetAllPrivateTeamsPageWithCount(offset int, limit int) (*model.TeamsWithCount, *model.AppError) {
|
||||
totalCount, err := a.Srv().Store.Team().AnalyticsPrivateTeamCount()
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetAllPrivateTeamsPageWithCount", "app.team.analytics_private_team_count.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
teams, err := a.Srv().Store.Team().GetAllPrivateTeamPageListing(offset, limit)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetAllPrivateTeamsPageWithCount", "app.team.get_all_private_team_page_listing.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
return &model.TeamsWithCount{Teams: teams, TotalCount: totalCount}, nil
|
||||
}
|
||||
|
||||
func (a *App) GetAllPublicTeams() ([]*model.Team, *model.AppError) {
|
||||
teams, err := a.Srv().Store.Team().GetAllTeamListing()
|
||||
if err != nil {
|
||||
@@ -939,46 +918,25 @@ func (a *App) GetAllPublicTeams() ([]*model.Team, *model.AppError) {
|
||||
return teams, nil
|
||||
}
|
||||
|
||||
func (a *App) GetAllPublicTeamsPage(offset int, limit int) ([]*model.Team, *model.AppError) {
|
||||
teams, err := a.Srv().Store.Team().GetAllTeamPageListing(offset, limit)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetAllPublicTeamsPage", "app.team.get_all_team_listing.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return teams, nil
|
||||
}
|
||||
|
||||
func (a *App) GetAllPublicTeamsPageWithCount(offset int, limit int) (*model.TeamsWithCount, *model.AppError) {
|
||||
totalCount, err := a.Srv().Store.Team().AnalyticsPublicTeamCount()
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetAllPublicTeamsPageWithCount", "app.team.analytics_public_team_count.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
teams, err := a.Srv().Store.Team().GetAllPublicTeamPageListing(offset, limit)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetAllPublicTeamsPageWithCount", "app.team.get_all_private_team_listing.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
return &model.TeamsWithCount{Teams: teams, TotalCount: totalCount}, nil
|
||||
}
|
||||
|
||||
// SearchAllTeams returns a team list and the total count of the results
|
||||
func (a *App) SearchAllTeams(searchOpts *model.TeamSearch) ([]*model.Team, int64, *model.AppError) {
|
||||
if searchOpts.IsPaginated() {
|
||||
teams, count, err := a.Srv().Store.Team().SearchAllPaged(searchOpts.Term, searchOpts)
|
||||
teams, count, err := a.Srv().Store.Team().SearchAllPaged(searchOpts)
|
||||
if err != nil {
|
||||
return nil, 0, model.NewAppError("SearchAllTeams", "app.team.search_all_team.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return teams, count, nil
|
||||
}
|
||||
results, err := a.Srv().Store.Team().SearchAll(searchOpts.Term, searchOpts)
|
||||
results, err := a.Srv().Store.Team().SearchAll(searchOpts)
|
||||
if err != nil {
|
||||
return nil, 0, model.NewAppError("SearchAllTeams", "app.team.search_all_team.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
return results, int64(len(results)), nil
|
||||
}
|
||||
|
||||
func (a *App) SearchPublicTeams(term string) ([]*model.Team, *model.AppError) {
|
||||
teams, err := a.Srv().Store.Team().SearchOpen(term)
|
||||
func (a *App) SearchPublicTeams(searchOpts *model.TeamSearch) ([]*model.Team, *model.AppError) {
|
||||
teams, err := a.Srv().Store.Team().SearchOpen(searchOpts)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SearchPublicTeams", "app.team.search_open_team.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
@@ -986,8 +944,8 @@ func (a *App) SearchPublicTeams(term string) ([]*model.Team, *model.AppError) {
|
||||
return teams, nil
|
||||
}
|
||||
|
||||
func (a *App) SearchPrivateTeams(term string) ([]*model.Team, *model.AppError) {
|
||||
teams, err := a.Srv().Store.Team().SearchPrivate(term)
|
||||
func (a *App) SearchPrivateTeams(searchOpts *model.TeamSearch) ([]*model.Team, *model.AppError) {
|
||||
teams, err := a.Srv().Store.Team().SearchPrivate(searchOpts)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SearchPrivateTeams", "app.team.search_private_team.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user