MM-19336 Migrated GetMembersByIds and GetMembersByChannelIds to Squirrel (#19728)

* Ported GetMembersByIds and GetMembersByChannelIds to Squirrel

* Added checks for empty ID lists

* Updated GetAllChannelMembersById to use Squirrel

* Added a method to get the query placeholder directly

* Migrated UpdateMultipleMembers to use a Squirrel query

* Migrated UpdateMultipleMembers to Squirrel

* Initialize a prepared query builder for channelMembersForTeamWithSchemeSelectQuery

* Migrated GetMembersForUser to Squirrel

* Slight improvement for constructMySQLJSONArgs

* Migrated UpdateMemberNotifyProps to Squirrel

* Migrated GetMembers to Squirrel

* Migrated GetMember to Squirrel

* Avoid shadowing err

* Don't set query builder on copy of SqlChannelStore

* Fixed typo in error message

* Fixed missing elipsis

* Shorter SQL generation for GetAllChannelMembersById

* Don't unnecessarily copy the reference

* Use a function to generate the ChannelMember map

* Avoid shadowing err

* Don't use IN for matching multiple possible values

* Initialize the members lists

* Remove check for empty channelIDs list

* Fixed test and removed check for empty list

* Use err2 rather than eerr

Co-authored-by: Tim Scheuermann <tim@plusmid.dev>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Tim Scheuermann
2022-03-10 20:57:09 +01:00
коммит произвёл GitHub
родитель f5b6e09965
Коммит caa30c9bc4
5 изменённых файлов: 215 добавлений и 121 удалений

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

@@ -6321,8 +6321,9 @@ func testChannelStoreGetMembersByIds(t *testing.T, ss store.Store) {
require.NoError(t, nErr, nErr)
require.Len(t, members, 2, "return wrong number of results")
_, nErr = ss.Channel().GetMembersByIds(m1.ChannelId, []string{})
require.Error(t, nErr, "empty user ids - should have failed")
members, nErr = ss.Channel().GetMembersByIds(m1.ChannelId, []string{})
require.NoError(t, nErr)
require.Len(t, members, 0)
}
func testChannelStoreGetMembersByChannelIds(t *testing.T, ss store.Store) {