Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback for “GraphQL API” #8717

Open
zahinafsar opened this issue Sep 17, 2024 · 0 comments
Open

Feedback for “GraphQL API” #8717

zahinafsar opened this issue Sep 17, 2024 · 0 comments

Comments

@zahinafsar
Copy link

zahinafsar commented Sep 17, 2024

Using fragment in GraphQL

Returns

{
  "errors": [
    {
      "message": "Query should contain either measures, dimensions or timeDimensions with granularities in order to be valid",
      "locations": [
        {
          "line": 34,
          "column": 3
        }
      ],
      "path": [
        "cube"
      ]
    }
  ],
  "data": null
}

The Query

	fragment recoveredSalesStats on Result {
		orders {
			recovered_sales
			created_at @include(if: $charts) {
                            hour @include(if: $isHourly)
                            day @include(if: $isDaily)
                            week @include(if: $isWeekly)
                            month @include(if: $isMonthly)
                            year @include(if: $isYearly)
                        }
		}
	}
	
	query GetRecoveredSalesStats(
		$currDateRange: [String]
		$prevDateRange: [String]
		$brandId: String
		$workflowId: String
		$charts: Boolean = true
		$isHourly: Boolean = false
		$isDaily: Boolean = false
		$isWeekly: Boolean = false
		$isMonthly: Boolean = false
		$isYearly: Boolean = false
		$timezone: String
	) {
		cube(
			timezone: $timezone
			where: {
				workflows: { id: { equals: $workflowId } }
				brands: { id: { equals: $brandId } }
				orders: { created_at: { inDateRange: $currDateRange } }
			}
		) {
			...recoveredSalesStats
		}
		prev: cube(
			timezone: $timezone
			where: {
				workflows: { id: { equals: $workflowId } }
				brands: { id: { equals: $brandId } }
				orders: { created_at: { inDateRange: $prevDateRange } }
			}
		) {
			...recoveredSalesStats
		}
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant