~netlandish/links

c2d2a2d2b4c08307ef8a1a57b2cd56c29e05f73f — Peter Sanchez a month ago f6d4ec7
Fix admin dashboard query
1 files changed, 9 insertions(+), 2 deletions(-)

M admin/routes.go
M admin/routes.go => admin/routes.go +9 -2
@@ 219,14 219,21 @@ func (s *Service) Dashboard(c echo.Context) error {
		} `json:"getAdminBillingStats"`
	}
	var billingStatsResult GraphQLBillingStatsResponse
	// XXX Review this in the future. We shouldn't have to set an interval here.
	// This broke after a gqlgen update from 0.17.29 to 0.17.49. May be related
	// to new omittable field feature. Could also just be our query was wrong all
	// along :)
	op = gqlclient.NewOperation(
		`query GetAdminBillingStats() {
			getAdminBillingStats(input: {}) {
		`query GetAdminBillingStats($interval: Int) {
			getAdminBillingStats(input: {
				interval: $interval
			}) {
				activeSubscriptions
				pendingCancelSubscriptions
				canceledSubscription
			}
		}`)
	op.Var("interval", links.FilterLast30Days)
	err = links.Execute(c.Request().Context(), op, &billingStatsResult)
	if err != nil {
		return err