diff --git a/package-lock.json b/package-lock.json index f014cad..0ef01a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14136,6 +14136,11 @@ "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", "dev": true }, + "ts-deep-extract-types": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ts-deep-extract-types/-/ts-deep-extract-types-1.0.1.tgz", + "integrity": "sha512-/ouif62vAoltKeN9tSxMkMfiFwrXttL5UHkGDDvshH3ml06t9HhTsrtVJneGJhojBlKbWs8qzHYhL7oGWuluUg==" + }, "ts-invariant": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.4.4.tgz", diff --git a/package.json b/package.json index 806102f..54335ca 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "apollo-angular": "^2.0.4", "graphql": "^15.3.0", "rxjs": "~6.5.5", + "ts-deep-extract-types": "^1.0.1", "tslib": "^2.0.0", "zone.js": "~0.10.3" }, diff --git a/src/app/graphqlOperations/bikes.graphql b/src/app/graphqlOperations/bikes.graphql index 133b7d0..bcfc6fb 100644 --- a/src/app/graphqlOperations/bikes.graphql +++ b/src/app/graphqlOperations/bikes.graphql @@ -1,6 +1,7 @@ -query CargoBikes { +query GetCargoBikes{ cargoBikes { id + group name events { date @@ -12,5 +13,28 @@ query CargoBikes { bikeLength bikeWeight } + numberOfChildren + security { + frameNumber + adfcCoding + keyNumberAXAChain + keyNumberFrameLock + policeCoding + } + dimensionsAndLoad { + bikeHeight + bikeLength + bikeWeight + bikeWidth + boxHeight + boxLength + boxWidth + hasCoverBox + lockable + maxWeightBox + maxWeightLuggageRack + maxWeightTotal + } + } } diff --git a/src/app/pages/bikes/bikes.component.ts b/src/app/pages/bikes/bikes.component.ts index 8ae65a6..8e29936 100644 --- a/src/app/pages/bikes/bikes.component.ts +++ b/src/app/pages/bikes/bikes.component.ts @@ -1,5 +1,8 @@ import { Component, OnInit } from '@angular/core'; -import { CargoBikesGQL, CargoBikesQuery, CargoBike } from '../../../generated/graphql'; +import { DeepExtractTypeSkipArrays } from 'ts-deep-extract-types'; +import { GetCargoBikesGQL, GetCargoBikesQuery } from '../../../generated/graphql'; + +type CargoBikeResult = DeepExtractTypeSkipArrays; @Component({ selector: 'app-bikes', @@ -9,12 +12,12 @@ import { CargoBikesGQL, CargoBikesQuery, CargoBike } from '../../../generated/gr export class BikesComponent implements OnInit { displayedColumns: string[] = ['position', 'name', 'weight', 'symbol']; dataSource = ELEMENT_DATA; - bikes: CargoBikesQuery; + + bikes: CargoBikeResult[]; - constructor(private bikesGQL: CargoBikesGQL) { + constructor(private bikesGQL: GetCargoBikesGQL) { this.bikesGQL.watch().valueChanges.subscribe((result) => { - console.log(result); - this.bikes = result.data; + this.bikes = result.data.cargoBikes; }); } diff --git a/src/generated/graphql.ts b/src/generated/graphql.ts index a2ce3fc..1323ed6 100644 --- a/src/generated/graphql.ts +++ b/src/generated/graphql.ts @@ -657,14 +657,14 @@ export enum CacheControlScope { } -export type CargoBikesQueryVariables = Exact<{ [key: string]: never; }>; +export type GetCargoBikesQueryVariables = Exact<{ [key: string]: never; }>; -export type CargoBikesQuery = ( +export type GetCargoBikesQuery = ( { __typename?: 'Query' } & { cargoBikes: Array + & Pick & { events?: Maybe @@ -673,13 +673,16 @@ export type CargoBikesQuery = ( & Pick ), dimensionsAndLoad: ( { __typename?: 'DimensionsAndLoad' } - & Pick + & Pick + ), security: ( + { __typename?: 'Security' } + & Pick ) } )>> } ); -export const CargoBikesDocument = gql` - query CargoBikes { +export const GetCargoBikesDocument = gql` + query GetCargoBikes { cargoBikes { id name @@ -692,6 +695,34 @@ export const CargoBikesDocument = gql` dimensionsAndLoad { bikeLength bikeWeight + bikeHeight + bikeWidth + boxHeight + boxLength + boxWidth + hasCoverBox + lockable + maxWeightBox + maxWeightLuggageRack + maxWeightTotal + } + numberOfChildren + security { + frameNumber + } + dimensionsAndLoad { + bikeHeight + bikeLength + bikeWeight + bikeWidth + boxHeight + boxLength + boxWidth + hasCoverBox + lockable + maxWeightBox + maxWeightLuggageRack + maxWeightTotal } } } @@ -700,8 +731,8 @@ export const CargoBikesDocument = gql` @Injectable({ providedIn: 'root' }) - export class CargoBikesGQL extends Apollo.Query { - document = CargoBikesDocument; + export class GetCargoBikesGQL extends Apollo.Query { + document = GetCargoBikesDocument; constructor(apollo: Apollo.Apollo) { super(apollo);