[MM-15192] Migrate "WebHook.AnalyticsOutgoingCount" to Sync by default (#10711)
Этот коммит содержится в:
коммит произвёл
Hanzei
родитель
2b6573316d
Коммит
b462941f48
@@ -338,24 +338,23 @@ func (s SqlWebhookStore) AnalyticsIncomingCount(teamId string) (int64, *model.Ap
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func (s SqlWebhookStore) AnalyticsOutgoingCount(teamId string) store.StoreChannel {
|
||||
return store.Do(func(result *store.StoreResult) {
|
||||
query :=
|
||||
`SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
OutgoingWebhooks
|
||||
WHERE
|
||||
DeleteAt = 0`
|
||||
func (s SqlWebhookStore) AnalyticsOutgoingCount(teamId string) (int64, *model.AppError) {
|
||||
query :=
|
||||
`SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
OutgoingWebhooks
|
||||
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.AnalyticsOutgoingCount", "store.sql_webhooks.analytics_outgoing_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.AnalyticsOutgoingCount", "store.sql_webhooks.analytics_outgoing_count.app_error", nil, "team_id="+teamId+", err="+err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return v, nil
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user