Browse Source

fix(admin-ui): Update queries to use new list options format

Michael Bromley 7 years ago
parent
commit
c6f45595cc

+ 1 - 1
admin-ui/src/app/catalog/components/product-list/product-list.component.ts

@@ -25,7 +25,7 @@ export class ProductListComponent implements OnInit, OnDestroy {
         const fetchPage = ([currentPage, itemsPerPage]: [number, number]) => {
             const take = itemsPerPage;
             const skip = (currentPage - 1) * itemsPerPage;
-            productsQuery.ref.refetch({ skip, take });
+            productsQuery.ref.refetch({ options: { skip, take } });
         };
 
         this.products$ = productsQuery.stream$.pipe(map(data => data.products.items));

+ 4 - 2
admin-ui/src/app/data/providers/product-data.service.ts

@@ -51,8 +51,10 @@ export class ProductDataService {
 
     getProducts(take: number = 10, skip: number = 0): QueryResult<GetProductList, GetProductListVariables> {
         return this.baseDataService.query<GetProductList, GetProductListVariables>(GET_PRODUCT_LIST, {
-            take,
-            skip,
+            options: {
+                take,
+                skip,
+            },
             languageCode: getDefaultLanguage(),
         });
     }

+ 2 - 2
admin-ui/src/app/data/queries/product-queries.ts

@@ -12,8 +12,8 @@ export const GET_PRODUCT_WITH_VARIANTS = gql`
 `;
 
 export const GET_PRODUCT_LIST = gql`
-    query GetProductList($take: Int, $skip: Int, $languageCode: LanguageCode) {
-        products(languageCode: $languageCode, take: $take, skip: $skip) {
+    query GetProductList($options: ProductListOptions, $languageCode: LanguageCode) {
+        products(languageCode: $languageCode, options: $options) {
             items {
                 id
                 languageCode

+ 42 - 2
admin-ui/src/app/data/types/gql-generated-types.ts

@@ -617,8 +617,7 @@ export interface GetProductList {
 }
 
 export interface GetProductListVariables {
-    take?: number | null;
-    skip?: number | null;
+    options?: ProductListOptions | null;
     languageCode?: LanguageCode | null;
 }
 
@@ -985,6 +984,11 @@ export enum LanguageCode {
     zu = 'zu',
 }
 
+export enum SortOrder {
+    ASC = 'ASC',
+    DESC = 'DESC',
+}
+
 export interface UpdateProductInput {
     id: string;
     image?: string | null;
@@ -1059,6 +1063,42 @@ export interface CreateProductOptionInput {
     customFields?: any | null;
 }
 
+export interface ProductListOptions {
+    take?: number | null;
+    skip?: number | null;
+    sort?: ProductSortParameter | null;
+    filter?: ProductFilterParameter | null;
+}
+
+export interface ProductSortParameter {
+    id?: SortOrder | null;
+    name?: SortOrder | null;
+    slug?: SortOrder | null;
+    description?: SortOrder | null;
+    image?: SortOrder | null;
+    infoUrl?: SortOrder | null;
+    downloadable?: SortOrder | null;
+    nickname?: SortOrder | null;
+}
+
+export interface ProductFilterParameter {
+    name?: StringOperators | null;
+    slug?: StringOperators | null;
+    description?: StringOperators | null;
+    infoUrl?: StringOperators | null;
+    downloadable?: BooleanOperators | null;
+    nickname?: StringOperators | null;
+}
+
+export interface StringOperators {
+    eq?: string | null;
+    contains?: string | null;
+}
+
+export interface BooleanOperators {
+    eq?: boolean | null;
+}
+
 //==============================================================
 // END Enums and Input Objects
 //==============================================================

File diff suppressed because it is too large
+ 0 - 0
schema.json


Some files were not shown because too many files changed in this diff