@ppci-mock/allocation-graph
Version:
Allocation graph
47 lines (45 loc) • 1.44 kB
JavaScript
import gql from 'graphql-tag';
export const query = gql`
query allocationGraph($deviceId: String!, $direction: String!, $aggregationType: String!, $allocationBody: any, $devicesBody: any) {
response(
deviceId: $deviceId, direction: $direction, aggregationType: $aggregationType,
) @rest(
type: "Device",
path: "api/rest?deviceId={args.deviceId}&requestType=devices",
endpoint: "connections",
method: "POST",
bodyBuilder: $devicesBody,
) {
device: content @export(as: "device") {
startDate
endDate
}
allocation: content @type(name: "allocation") {
content(direction: $direction, aggregationType: $aggregationType) @rest(
type: "AllocationIntervals",
path: "api/rest?aggregationType={args.aggregationType}&direction={args.direction}&requestName=allocationType",
endpoint: "proxy",
method: "post",
bodyBuilder: $allocationBody,
) {
records: content @type(name: "records") {
aggregationType
totalValue
periods: data @type(name: "periods") {
period
final
types: data @type(name: "types") {
backup
category
energyType
period
type
value
}
}
}
}
}
}
}
`;