From 03c6dcbd865e2af2db5db150189504bfa493ae2e Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Sun, 15 Nov 2015 18:18:02 -0800 Subject: PLT-975 adding perm deletes --- store/sql_webhook_store.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'store/sql_webhook_store.go') diff --git a/store/sql_webhook_store.go b/store/sql_webhook_store.go index c758e2339..11b9f6e52 100644 --- a/store/sql_webhook_store.go +++ b/store/sql_webhook_store.go @@ -116,6 +116,24 @@ func (s SqlWebhookStore) DeleteIncoming(webhookId string, time int64) StoreChann return storeChannel } +func (s SqlWebhookStore) DeleteIncomingByUser(userId string) StoreChannel { + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + + _, err := s.GetMaster().Exec("DELETE FROM IncomingWebhooks WHERE UserId = :UserId", map[string]interface{}{"UserId": userId}) + if err != nil { + result.Err = model.NewAppError("SqlWebhookStore.DeleteIncomingByUser", "We couldn't delete the webhook", "id="+userId+", err="+err.Error()) + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} + func (s SqlWebhookStore) GetIncomingByUser(userId string) StoreChannel { storeChannel := make(StoreChannel) @@ -294,6 +312,24 @@ func (s SqlWebhookStore) DeleteOutgoing(webhookId string, time int64) StoreChann return storeChannel } +func (s SqlWebhookStore) DeleteOutgoingByUser(userId string) StoreChannel { + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + + _, err := s.GetMaster().Exec("DELETE FROM OutgoingWebhooks WHERE CreatorId = :UserId", map[string]interface{}{"UserId": userId}) + if err != nil { + result.Err = model.NewAppError("SqlWebhookStore.DeleteOutgoingByUser", "We couldn't delete the webhook", "id="+userId+", err="+err.Error()) + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} + func (s SqlWebhookStore) UpdateOutgoing(hook *model.OutgoingWebhook) StoreChannel { storeChannel := make(StoreChannel) -- cgit v1.2.3-1-g7c22 From 6b2eabf6108e078bed8143e91c605dec5ccfafa6 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Mon, 16 Nov 2015 17:12:49 -0800 Subject: Adding perm delete to cmd line --- store/sql_webhook_store.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'store/sql_webhook_store.go') diff --git a/store/sql_webhook_store.go b/store/sql_webhook_store.go index 11b9f6e52..b7bf0615f 100644 --- a/store/sql_webhook_store.go +++ b/store/sql_webhook_store.go @@ -116,7 +116,7 @@ func (s SqlWebhookStore) DeleteIncoming(webhookId string, time int64) StoreChann return storeChannel } -func (s SqlWebhookStore) DeleteIncomingByUser(userId string) StoreChannel { +func (s SqlWebhookStore) PermanentDeleteIncomingByUser(userId string) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -312,7 +312,7 @@ func (s SqlWebhookStore) DeleteOutgoing(webhookId string, time int64) StoreChann return storeChannel } -func (s SqlWebhookStore) DeleteOutgoingByUser(userId string) StoreChannel { +func (s SqlWebhookStore) PermanentDeleteOutgoingByUser(userId string) StoreChannel { storeChannel := make(StoreChannel) go func() { -- cgit v1.2.3-1-g7c22