github.com/haalcala/mattermost-server-change-repo/v5@v5.33.2/store/searchlayer/team_layer.go (about) 1 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2 // See LICENSE.txt for license information. 3 4 package searchlayer 5 6 import ( 7 model "github.com/mattermost/mattermost-server/v5/model" 8 store "github.com/mattermost/mattermost-server/v5/store" 9 ) 10 11 type SearchTeamStore struct { 12 store.TeamStore 13 rootStore *SearchStore 14 } 15 16 func (s SearchTeamStore) SaveMember(teamMember *model.TeamMember, maxUsersPerTeam int) (*model.TeamMember, error) { 17 member, err := s.TeamStore.SaveMember(teamMember, maxUsersPerTeam) 18 if err == nil { 19 s.rootStore.indexUserFromID(member.UserId) 20 } 21 return member, err 22 } 23 24 func (s SearchTeamStore) UpdateMember(teamMember *model.TeamMember) (*model.TeamMember, error) { 25 member, err := s.TeamStore.UpdateMember(teamMember) 26 if err == nil { 27 s.rootStore.indexUserFromID(member.UserId) 28 } 29 return member, err 30 } 31 32 func (s SearchTeamStore) RemoveMember(teamId string, userId string) error { 33 err := s.TeamStore.RemoveMember(teamId, userId) 34 if err == nil { 35 s.rootStore.indexUserFromID(userId) 36 } 37 return err 38 } 39 40 func (s SearchTeamStore) RemoveAllMembersByUser(userId string) error { 41 err := s.TeamStore.RemoveAllMembersByUser(userId) 42 if err == nil { 43 s.rootStore.indexUserFromID(userId) 44 } 45 return err 46 }