[MM-15191] Migrate Webhook.AnalyticsIncomingCount to Sync (#10674)
* Migrate Webhook.AnalyticsIncomingCount to Sync * update indentation * fix indentation
Этот коммит содержится в:
коммит произвёл
Jesús Espino
родитель
cf5f5be0d8
Коммит
88810a8ec7
@@ -326,26 +326,25 @@ func (s SqlWebhookStore) UpdateOutgoing(hook *model.OutgoingWebhook) store.Store
|
||||
})
|
||||
}
|
||||
|
||||
func (s SqlWebhookStore) AnalyticsIncomingCount(teamId string) store.StoreChannel {
|
||||
return store.Do(func(result *store.StoreResult) {
|
||||
query :=
|
||||
`SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
IncomingWebhooks
|
||||
WHERE
|
||||
DeleteAt = 0`
|
||||
func (s SqlWebhookStore) AnalyticsIncomingCount(teamId string) (int64, *model.AppError) {
|
||||
query :=
|
||||
`SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
IncomingWebhooks
|
||||
WHERE
|
||||
DeleteAt = 0`
|
||||
|
||||
if len(teamId) > 0 {
|
||||
query += " AND TeamId = :TeamId"
|
||||
}
|
||||
if len(teamId) > 0 {
|
||||
query += " AND TeamId = :TeamId"
|
||||
}
|
||||
|
||||
if v, err := s.GetReplica().SelectInt(query, map[string]interface{}{"TeamId": teamId}); err != nil {
|
||||
result.Err = model.NewAppError("SqlWebhookStore.AnalyticsIncomingCount", "store.sql_webhooks.analytics_incoming_count.app_error", nil, "team_id="+teamId+", err="+err.Error(), http.StatusInternalServerError)
|
||||
} else {
|
||||
result.Data = v
|
||||
}
|
||||
})
|
||||
v, err := s.GetReplica().SelectInt(query, map[string]interface{}{"TeamId": teamId})
|
||||
if err != nil {
|
||||
return 0, model.NewAppError("SqlWebhookStore.AnalyticsIncomingCount", "store.sql_webhooks.analytics_incoming_count.app_error", nil, "team_id="+teamId+", err="+err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func (s SqlWebhookStore) AnalyticsOutgoingCount(teamId string) store.StoreChannel {
|
||||
|
||||
Ссылка в новой задаче
Block a user