Resolve backward compatibility issues (#29566)
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -17,10 +17,20 @@ import (
|
|||||||
|
|
||||||
type SqlOutgoingOAuthConnectionStore struct {
|
type SqlOutgoingOAuthConnectionStore struct {
|
||||||
*SqlStore
|
*SqlStore
|
||||||
|
|
||||||
|
tableSelectQuery sq.SelectBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
func newSqlOutgoingOAuthConnectionStore(sqlStore *SqlStore) store.OutgoingOAuthConnectionStore {
|
func newSqlOutgoingOAuthConnectionStore(sqlStore *SqlStore) store.OutgoingOAuthConnectionStore {
|
||||||
return &SqlOutgoingOAuthConnectionStore{sqlStore}
|
s := SqlOutgoingOAuthConnectionStore{
|
||||||
|
SqlStore: sqlStore,
|
||||||
|
}
|
||||||
|
|
||||||
|
s.tableSelectQuery = s.getQueryBuilder().
|
||||||
|
Select("Id", "CreatorId", "CreateAt", "UpdateAt", "Name", "ClientId", "ClientSecret", "CredentialsUsername", "CredentialsPassword", "OAuthTokenURL", "GrantType", "Audiences").
|
||||||
|
From("OutgoingOAuthConnections")
|
||||||
|
|
||||||
|
return &s
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SqlOutgoingOAuthConnectionStore) SaveConnection(c request.CTX, conn *model.OutgoingOAuthConnection) (*model.OutgoingOAuthConnection, error) {
|
func (s *SqlOutgoingOAuthConnectionStore) SaveConnection(c request.CTX, conn *model.OutgoingOAuthConnection) (*model.OutgoingOAuthConnection, error) {
|
||||||
@@ -86,7 +96,9 @@ func (s *SqlOutgoingOAuthConnectionStore) UpdateConnection(c request.CTX, conn *
|
|||||||
|
|
||||||
func (s *SqlOutgoingOAuthConnectionStore) GetConnection(c request.CTX, id string) (*model.OutgoingOAuthConnection, error) {
|
func (s *SqlOutgoingOAuthConnectionStore) GetConnection(c request.CTX, id string) (*model.OutgoingOAuthConnection, error) {
|
||||||
conn := &model.OutgoingOAuthConnection{}
|
conn := &model.OutgoingOAuthConnection{}
|
||||||
if err := s.GetReplica().Get(conn, `SELECT * FROM OutgoingOAuthConnections WHERE Id=?`, id); err != nil {
|
query := s.tableSelectQuery.Where(sq.Eq{"Id": id})
|
||||||
|
|
||||||
|
if err := s.GetReplica().GetBuilder(conn, query); err != nil {
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
return nil, store.NewErrNotFound("OutgoingOAuthConnection", id)
|
return nil, store.NewErrNotFound("OutgoingOAuthConnection", id)
|
||||||
}
|
}
|
||||||
@@ -99,11 +111,7 @@ func (s *SqlOutgoingOAuthConnectionStore) GetConnections(c request.CTX, filters
|
|||||||
filters.SetDefaults()
|
filters.SetDefaults()
|
||||||
|
|
||||||
conns := []*model.OutgoingOAuthConnection{}
|
conns := []*model.OutgoingOAuthConnection{}
|
||||||
query := s.getQueryBuilder().
|
query := s.tableSelectQuery.OrderBy("Id").Limit(uint64(filters.Limit))
|
||||||
Select("*").
|
|
||||||
From("OutgoingOAuthConnections").
|
|
||||||
OrderBy("Id").
|
|
||||||
Limit(uint64(filters.Limit))
|
|
||||||
|
|
||||||
if filters.OffsetId != "" {
|
if filters.OffsetId != "" {
|
||||||
query = query.Where("Id > ?", filters.OffsetId)
|
query = query.Where("Id > ?", filters.OffsetId)
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user