瀏覽代碼

feat(server): Add productId field to ProductVariant entity

Michael Bromley 6 年之前
父節點
當前提交
81bc07c5b5

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


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


+ 26 - 0
schema.json

@@ -6711,6 +6711,16 @@
             },
             "defaultValue": null
           },
+          {
+            "name": "productId",
+            "description": null,
+            "type": {
+              "kind": "ENUM",
+              "name": "SortOrder",
+              "ofType": null
+            },
+            "defaultValue": null
+          },
           {
             "name": "createdAt",
             "description": null,
@@ -6976,6 +6986,22 @@
             "isDeprecated": false,
             "deprecationReason": null
           },
+          {
+            "name": "productId",
+            "description": null,
+            "args": [],
+            "type": {
+              "kind": "NON_NULL",
+              "name": null,
+              "ofType": {
+                "kind": "SCALAR",
+                "name": "ID",
+                "ofType": null
+              }
+            },
+            "isDeprecated": false,
+            "deprecationReason": null
+          },
           {
             "name": "createdAt",
             "description": null,

+ 4 - 3
server/e2e/collection.e2e-spec.ts

@@ -2,13 +2,15 @@
 import gql from 'graphql-tag';
 import path from 'path';
 
-import { FACET_VALUE_FRAGMENT } from '../../admin-ui/src/app/data/definitions/facet-definitions';
 import {
     CREATE_COLLECTION,
-    GET_ASSET_LIST,
     GET_COLLECTION,
     MOVE_COLLECTION,
     UPDATE_COLLECTION,
+} from '../../admin-ui/src/app/data/definitions/collection-definitions';
+import { FACET_VALUE_FRAGMENT } from '../../admin-ui/src/app/data/definitions/facet-definitions';
+import {
+    GET_ASSET_LIST,
     UPDATE_PRODUCT,
     UPDATE_PRODUCT_VARIANTS,
 } from '../../admin-ui/src/app/data/definitions/product-definitions';
@@ -20,7 +22,6 @@ import {
     FacetValue,
     GetAssetList,
     GetCollection,
-    GetProductWithVariants,
     LanguageCode,
     MoveCollection,
     ProductWithVariants,

+ 1 - 0
server/src/api/schema/type/product.type.graphql

@@ -31,6 +31,7 @@ type ProductList implements PaginatedList {
 
 type ProductVariant implements Node {
     id: ID!
+    productId: ID!
     createdAt: DateTime!
     updatedAt: DateTime!
     languageCode: LanguageCode!

+ 3 - 0
server/src/entity/product-variant/product-variant.entity.ts

@@ -84,6 +84,9 @@ export class ProductVariant extends VendureEntity implements Translatable, HasCu
     @ManyToOne(type => Product, product => product.variants)
     product: Product;
 
+    @Column({ nullable: true })
+    productId: number;
+
     @ManyToMany(type => ProductOption)
     @JoinTable()
     options: ProductOption[];

+ 5 - 1
shared/generated-shop-types.ts

@@ -1,5 +1,5 @@
 // tslint:disable
-// Generated in 2019-03-06T21:22:24+01:00
+// Generated in 2019-03-07T10:54:02+01:00
 export type Maybe<T> = T | null;
 
 export interface OrderListOptions {
@@ -155,6 +155,8 @@ export interface ProductVariantListOptions {
 export interface ProductVariantSortParameter {
     id?: Maybe<SortOrder>;
 
+    productId?: Maybe<SortOrder>;
+
     createdAt?: Maybe<SortOrder>;
 
     updatedAt?: Maybe<SortOrder>;
@@ -1012,6 +1014,8 @@ export interface OrderLine extends Node {
 export interface ProductVariant extends Node {
     id: string;
 
+    productId: string;
+
     createdAt: DateTime;
 
     updatedAt: DateTime;

+ 5 - 174
shared/generated-types.ts

@@ -1,5 +1,5 @@
 // tslint:disable
-// Generated in 2019-03-06T21:22:26+01:00
+// Generated in 2019-03-07T10:54:03+01:00
 export type Maybe<T> = T | null;
 
 
@@ -186,6 +186,8 @@ export interface ProductVariantSortParameter {
   
   id?: Maybe<SortOrder>;
   
+  productId?: Maybe<SortOrder>;
+  
   createdAt?: Maybe<SortOrder>;
   
   updatedAt?: Maybe<SortOrder>;
@@ -2640,119 +2642,6 @@ export namespace CreateAssets {
   export type CreateAssets = Asset.Fragment
 }
 
-export namespace GetCollectionFilters {
-  export type Variables = {
-  }
-
-  export type Query = {
-    __typename?: "Query";
-    
-    collectionFilters: CollectionFilters[];
-  }
-
-  export type CollectionFilters = ConfigurableOperation.Fragment
-}
-
-export namespace GetCollectionList {
-  export type Variables = {
-    options?: Maybe<CollectionListOptions>;
-    languageCode?: Maybe<LanguageCode>;
-  }
-
-  export type Query = {
-    __typename?: "Query";
-    
-    collections: Collections;
-  }
-
-  export type Collections = {
-    __typename?: "CollectionList";
-    
-    items: Items[];
-    
-    totalItems: number;
-  } 
-
-  export type Items = {
-    __typename?: "Collection";
-    
-    id: string;
-    
-    name: string;
-    
-    description: string;
-    
-    featuredAsset: Maybe<FeaturedAsset>;
-    
-    parent: Parent;
-  } 
-
-  export type FeaturedAsset = Asset.Fragment
-
-  export type Parent = {
-    __typename?: "Collection";
-    
-    id: string;
-  } 
-}
-
-export namespace GetCollection {
-  export type Variables = {
-    id: string;
-    languageCode?: Maybe<LanguageCode>;
-  }
-
-  export type Query = {
-    __typename?: "Query";
-    
-    collection: Maybe<Collection>;
-  }
-
-  export type Collection = Collection.Fragment
-}
-
-export namespace CreateCollection {
-  export type Variables = {
-    input: CreateCollectionInput;
-  }
-
-  export type Mutation = {
-    __typename?: "Mutation";
-    
-    createCollection: CreateCollection;
-  }
-
-  export type CreateCollection = Collection.Fragment
-}
-
-export namespace UpdateCollection {
-  export type Variables = {
-    input: UpdateCollectionInput;
-  }
-
-  export type Mutation = {
-    __typename?: "Mutation";
-    
-    updateCollection: UpdateCollection;
-  }
-
-  export type UpdateCollection = Collection.Fragment
-}
-
-export namespace MoveCollection {
-  export type Variables = {
-    input: MoveCollectionInput;
-  }
-
-  export type Mutation = {
-    __typename?: "Mutation";
-    
-    moveCollection: MoveCollection;
-  }
-
-  export type MoveCollection = Collection.Fragment
-}
-
 export namespace SearchProducts {
   export type Variables = {
     input: SearchInput;
@@ -4136,66 +4025,6 @@ export namespace ProductOptionGroup {
   }
 }
 
-export namespace Collection {
-  export type Fragment = {
-    __typename?: "Collection";
-    
-    id: string;
-    
-    name: string;
-    
-    description: string;
-    
-    languageCode: Maybe<LanguageCode>;
-    
-    featuredAsset: Maybe<FeaturedAsset>;
-    
-    assets: Assets[];
-    
-    filters: Filters[];
-    
-    translations: Translations[];
-    
-    parent: Parent;
-    
-    children: Maybe<Children[]>;
-  }
-
-  export type FeaturedAsset =Asset.Fragment
-
-  export type Assets =Asset.Fragment
-
-  export type Filters =ConfigurableOperation.Fragment
-
-  export type Translations = {
-    __typename?: "CollectionTranslation";
-    
-    id: string;
-    
-    languageCode: LanguageCode;
-    
-    name: string;
-    
-    description: string;
-  }
-
-  export type Parent = {
-    __typename?: "Collection";
-    
-    id: string;
-    
-    name: string;
-  }
-
-  export type Children = {
-    __typename?: "Collection";
-    
-    id: string;
-    
-    name: string;
-  }
-}
-
 export namespace ConfigurableOperation {
   export type Fragment = {
     __typename?: "ConfigurableOperation";
@@ -4829,6 +4658,8 @@ export interface ProductVariant extends Node {
   
   id: string;
   
+  productId: string;
+  
   createdAt: DateTime;
   
   updatedAt: DateTime;

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