From cbee8674d2c930a1d9ee98c1f2fb76f96d666900 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Mon, 16 Nov 2015 18:18:37 -0800 Subject: Adding perm delete channels by team --- store/sql_channel_store.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'store/sql_channel_store.go') diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go index cc5c86107..badaa4d13 100644 --- a/store/sql_channel_store.go +++ b/store/sql_channel_store.go @@ -279,6 +279,23 @@ func (s SqlChannelStore) Delete(channelId string, time int64) StoreChannel { return storeChannel } +func (s SqlChannelStore) PermanentDeleteByTeam(teamId string) StoreChannel { + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + + if _, err := s.GetMaster().Exec("DELETE FROM Channels WHERE TeamId = :TeamId", map[string]interface{}{"TeamId": teamId}); err != nil { + result.Err = model.NewAppError("SqlChannelStore.PermanentDeleteByTeam", "We couldn't delete the channels", "teamId="+teamId+", "+err.Error()) + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} + type channelWithMember struct { model.Channel model.ChannelMember -- cgit v1.2.3-1-g7c22