```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Agniva De Sarker
2022-04-11 20:51:33 +05:30
коммит произвёл GitHub
родитель 16b1cbd6e3
Коммит 7f0d1cf0dd
14 изменённых файлов: 258 добавлений и 3 удалений

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

@@ -303,6 +303,29 @@ func (s SqlTeamStore) Get(id string) (*model.Team, error) {
return &team, nil
}
func (s SqlTeamStore) GetMany(ids []string) ([]*model.Team, error) {
query := s.getQueryBuilder().
Select("*").
From("Teams").
Where(sq.Eq{"Id": ids})
sql, args, err := query.ToSql()
if err != nil {
return nil, errors.Wrapf(err, "getmany_tosql")
}
teams := []*model.Team{}
err = s.GetReplicaX().Select(&teams, sql, args...)
if err != nil {
return nil, errors.Wrapf(err, "failed to get teams with ids %v", ids)
}
if len(teams) == 0 {
return nil, store.NewErrNotFound("Team", fmt.Sprintf("ids=%v", ids))
}
return teams, 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.