diff options
author | =Corey Hulen <corey@hulen.com> | 2015-11-16 18:18:37 -0800 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2015-11-16 18:18:37 -0800 |
commit | cbee8674d2c930a1d9ee98c1f2fb76f96d666900 (patch) | |
tree | 835ffcc7d447cdf40dc239832132b0cd7ee5819f /store | |
parent | 2ddbf518f437b8894cd1c3c02bd7d7fcb98e60f4 (diff) | |
download | chat-cbee8674d2c930a1d9ee98c1f2fb76f96d666900.tar.gz chat-cbee8674d2c930a1d9ee98c1f2fb76f96d666900.tar.bz2 chat-cbee8674d2c930a1d9ee98c1f2fb76f96d666900.zip |
Adding perm delete channels by team
Diffstat (limited to 'store')
-rw-r--r-- | store/sql_channel_store.go | 17 | ||||
-rw-r--r-- | store/store.go | 1 |
2 files changed, 18 insertions, 0 deletions
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 diff --git a/store/store.go b/store/store.go index a8b57dcdd..338ae186f 100644 --- a/store/store.go +++ b/store/store.go @@ -61,6 +61,7 @@ type ChannelStore interface { Update(channel *model.Channel) StoreChannel Get(id string) StoreChannel Delete(channelId string, time int64) StoreChannel + PermanentDeleteByTeam(teamId string) StoreChannel GetByName(team_id string, domain string) StoreChannel GetChannels(teamId string, userId string) StoreChannel GetMoreChannels(teamId string, userId string) StoreChannel |