Document sqlTeamStore get methods (#14567)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c529d5190a
Коммит
54a4c10ed4
@@ -292,6 +292,9 @@ func (s SqlTeamStore) Update(team *model.Team) (*model.Team, *model.AppError) {
|
||||
return team, nil
|
||||
}
|
||||
|
||||
// Get returns from the database the team that matches the id provided as parameter.
|
||||
// If the team doesn't exist it returns a model.AppError with a
|
||||
// http.StatusNotFound in the StatusCode field.
|
||||
func (s SqlTeamStore) Get(id string) (*model.Team, *model.AppError) {
|
||||
obj, err := s.GetReplica().Get(model.Team{}, id)
|
||||
if err != nil {
|
||||
@@ -304,6 +307,9 @@ func (s SqlTeamStore) Get(id string) (*model.Team, *model.AppError) {
|
||||
return obj.(*model.Team), nil
|
||||
}
|
||||
|
||||
// GetByInviteId returns from the database the team that matches the inviteId provided as parameter.
|
||||
// If the parameter provided is empty or if there is no match in the database, it returns a model.AppError
|
||||
// with a http.StatusNotFound in the StatusCode field.
|
||||
func (s SqlTeamStore) GetByInviteId(inviteId string) (*model.Team, *model.AppError) {
|
||||
team := model.Team{}
|
||||
|
||||
@@ -318,6 +324,9 @@ func (s SqlTeamStore) GetByInviteId(inviteId string) (*model.Team, *model.AppErr
|
||||
return &team, nil
|
||||
}
|
||||
|
||||
// GetByName returns from the database the team that matches the name provided as parameter.
|
||||
// If there is no match in the database, it returns a model.AppError with a
|
||||
// http.StatusNotFound in the StatusCode field.
|
||||
func (s SqlTeamStore) GetByName(name string) (*model.Team, *model.AppError) {
|
||||
|
||||
team := model.Team{}
|
||||
@@ -454,6 +463,7 @@ func (s SqlTeamStore) GetAllPage(offset int, limit int) ([]*model.Team, *model.A
|
||||
return teams, nil
|
||||
}
|
||||
|
||||
// GetTeamsByUserId returns from the database all teams that userId belongs to.
|
||||
func (s SqlTeamStore) GetTeamsByUserId(userId string) ([]*model.Team, *model.AppError) {
|
||||
var teams []*model.Team
|
||||
if _, err := s.GetReplica().Select(&teams, "SELECT Teams.* FROM Teams, TeamMembers WHERE TeamMembers.TeamId = Teams.Id AND TeamMembers.UserId = :UserId AND TeamMembers.DeleteAt = 0 AND Teams.DeleteAt = 0", map[string]interface{}{"UserId": userId}); err != nil {
|
||||
@@ -1090,6 +1100,8 @@ func (s SqlTeamStore) UpdateLastTeamIconUpdate(teamId string, curTime int64) *mo
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetTeamsByScheme returns from the database all teams that match the schemeId provided as parameter, up to
|
||||
// a total limit passed as paramater and paginated by offset number passed as parameter.
|
||||
func (s SqlTeamStore) GetTeamsByScheme(schemeId string, offset int, limit int) ([]*model.Team, *model.AppError) {
|
||||
var teams []*model.Team
|
||||
_, err := s.GetReplica().Select(&teams, "SELECT * FROM Teams WHERE SchemeId = :SchemeId ORDER BY DisplayName LIMIT :Limit OFFSET :Offset", map[string]interface{}{"SchemeId": schemeId, "Offset": offset, "Limit": limit})
|
||||
|
||||
Ссылка в новой задаче
Block a user