Remove unused fields, update response.

Этот коммит содержится в:
Conor Macpherson
2022-12-19 15:36:15 -05:00
родитель cad414fd4d
Коммит 96ed60a472
2 изменённых файлов: 9 добавлений и 17 удалений

Просмотреть файл

@@ -327,7 +327,7 @@ func requestTrueUpReview(c *Context, w http.ResponseWriter, r *http.Request) {
reviewProfile.LicensePlan = license.SkuName reviewProfile.LicensePlan = license.SkuName
// Customer Info & Usage Analytics // Customer Info & Usage Analytics
activeUserCount, err := c.App.Srv().GetStore().Status().GetTotalActiveUsersCount() activeUserCount, err := c.App.Srv().Store().Status().GetTotalActiveUsersCount()
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
return return
@@ -337,7 +337,6 @@ func requestTrueUpReview(c *Context, w http.ResponseWriter, r *http.Request) {
reviewProfile.ActiveUsers = activeUserCount reviewProfile.ActiveUsers = activeUserCount
// Webhook, calls, boards, and playbook counts // Webhook, calls, boards, and playbook counts
var totalWebHookCount int64 = 0
incomingWebhookCount, err := c.App.Srv().Store().Webhook().GetIncomingTotal() incomingWebhookCount, err := c.App.Srv().Store().Webhook().GetIncomingTotal()
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
@@ -349,13 +348,8 @@ func requestTrueUpReview(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
totalWebHookCount += incomingWebhookCount reviewProfile.TotalIncomingWebhooks = incomingWebhookCount
totalWebHookCount += outgoingWebhookCount reviewProfile.TotalOutgoingWebhooks = outgoingWebhookCount
reviewProfile.TotalWebhooks = totalWebHookCount
reviewProfile.TotalCalls = 0 // TODO: Maybe from plugin?
reviewProfile.TotalBoards = 0 // TODO: Maybe from plugin?
reviewProfile.TotalPlaybooks = 0 // TODO: Maybe from plugin?
// Plugin Data // Plugin Data
trueUpReviewPlugins := model.TrueUpReviewPlugins{ trueUpReviewPlugins := model.TrueUpReviewPlugins{
@@ -400,17 +394,17 @@ func requestTrueUpReview(c *Context, w http.ResponseWriter, r *http.Request) {
// Convert true up review profile struct to map // Convert true up review profile struct to map
var telemetryProperties map[string]interface{} var telemetryProperties map[string]interface{}
marshalled, _ := json.Marshal(reviewProfile) reviewProfileJson, err := json.Marshal(reviewProfile)
json.Unmarshal(marshalled, &telemetryProperties) json.Unmarshal(reviewProfileJson, &telemetryProperties)
// Send telemetry data. // Send telemetry data.
telemetryService := c.App.Srv().GetTelemetryService() telemetryService := c.App.Srv().GetTelemetryService()
telemetryService.SendTelemetry(model.TrueUpReviewTelemetryName, telemetryProperties) telemetryService.SendTelemetry(model.TrueUpReviewTelemetryName, telemetryProperties)
json, err := json.Marshal(reviewProfile)
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
return return
} }
w.Write(json)
ReturnStatusOK(w)
} }

Просмотреть файл

@@ -14,10 +14,8 @@ type TrueUpReviewProfile struct {
ActiveUsers int64 `json:"active_users"` ActiveUsers int64 `json:"active_users"`
AuthenticationFeatures []string `json:"authentication_features"` AuthenticationFeatures []string `json:"authentication_features"`
Plugins TrueUpReviewPlugins `json:"plugins"` Plugins TrueUpReviewPlugins `json:"plugins"`
TotalWebhooks int64 `json:"webhooks_count"` TotalIncomingWebhooks int64 `json:"incoming_webhooks_count"`
TotalPlaybooks int `json:"playbooks_count"` TotalOutgoingWebhooks int64 `json:"outgoing_webhooks_count"`
TotalBoards int `json:"boards_count"`
TotalCalls int `json:"calls_count"`
} }
type TrueUpReviewPlugins struct { type TrueUpReviewPlugins struct {