فهرست منبع

feat(core): Add "slug" field to CollectionBreadcrumb type

Michael Bromley 5 سال پیش
والد
کامیت
97ffb1d8b8

+ 2 - 0
packages/admin-ui/src/lib/core/src/common/generated-types.ts

@@ -249,6 +249,7 @@ export type CollectionBreadcrumb = {
    __typename?: 'CollectionBreadcrumb';
   id: Scalars['ID'];
   name: Scalars['String'];
+  slug: Scalars['String'];
 };
 
 export type CollectionFilterParameter = {
@@ -2411,6 +2412,7 @@ export type Order = Node & {
   /** Order-level adjustments to the order total, such as discounts from promotions */
   adjustments: Array<Adjustment>;
   couponCodes: Array<Scalars['String']>;
+  /** Promotions applied to the order. Only gets populated after the payment process has completed. */
   promotions: Array<Promotion>;
   payments?: Maybe<Array<Payment>>;
   fulfillments?: Maybe<Array<Fulfillment>>;

+ 2 - 0
packages/asset-server-plugin/e2e/graphql/generated-e2e-asset-server-plugin-types.ts

@@ -248,6 +248,7 @@ export type CollectionBreadcrumb = {
     __typename?: 'CollectionBreadcrumb';
     id: Scalars['ID'];
     name: Scalars['String'];
+    slug: Scalars['String'];
 };
 
 export type CollectionFilterParameter = {
@@ -2289,6 +2290,7 @@ export type Order = Node & {
     /** Order-level adjustments to the order total, such as discounts from promotions */
     adjustments: Array<Adjustment>;
     couponCodes: Array<Scalars['String']>;
+    /** Promotions applied to the order. Only gets populated after the payment process has completed. */
     promotions: Array<Promotion>;
     payments?: Maybe<Array<Payment>>;
     fulfillments?: Maybe<Array<Fulfillment>>;

+ 2 - 0
packages/common/src/generated-shop-types.ts

@@ -164,6 +164,7 @@ export type CollectionBreadcrumb = {
     __typename?: 'CollectionBreadcrumb';
     id: Scalars['ID'];
     name: Scalars['String'];
+    slug: Scalars['String'];
 };
 
 export type CollectionFilterParameter = {
@@ -1516,6 +1517,7 @@ export type Order = Node & {
     /** Order-level adjustments to the order total, such as discounts from promotions */
     adjustments: Array<Adjustment>;
     couponCodes: Array<Scalars['String']>;
+    /** Promotions applied to the order. Only gets populated after the payment process has completed. */
     promotions: Array<Promotion>;
     payments?: Maybe<Array<Payment>>;
     fulfillments?: Maybe<Array<Fulfillment>>;

+ 2 - 0
packages/common/src/generated-types.ts

@@ -248,6 +248,7 @@ export type CollectionBreadcrumb = {
    __typename?: 'CollectionBreadcrumb';
   id: Scalars['ID'];
   name: Scalars['String'];
+  slug: Scalars['String'];
 };
 
 export type CollectionFilterParameter = {
@@ -2371,6 +2372,7 @@ export type Order = Node & {
   /** Order-level adjustments to the order total, such as discounts from promotions */
   adjustments: Array<Adjustment>;
   couponCodes: Array<Scalars['String']>;
+  /** Promotions applied to the order. Only gets populated after the payment process has completed. */
   promotions: Array<Promotion>;
   payments?: Maybe<Array<Payment>>;
   fulfillments?: Maybe<Array<Fulfillment>>;

+ 14 - 5
packages/core/e2e/collection.e2e-spec.ts

@@ -300,6 +300,8 @@ describe('Collection resolver', () => {
             });
 
             expect(updateCollection).toMatchSnapshot();
+
+            pearCollection = updateCollection;
         });
 
         it('updating existing assets', async () => {
@@ -445,10 +447,14 @@ describe('Collection resolver', () => {
             return;
         }
         expect(result.collection.breadcrumbs).toEqual([
-            { id: 'T_1', name: ROOT_COLLECTION_NAME },
-            { id: electronicsCollection.id, name: electronicsCollection.name },
-            { id: computersCollection.id, name: computersCollection.name },
-            { id: pearCollection.id, name: pearCollection.name },
+            { id: 'T_1', name: ROOT_COLLECTION_NAME, slug: ROOT_COLLECTION_NAME },
+            {
+                id: electronicsCollection.id,
+                name: electronicsCollection.name,
+                slug: electronicsCollection.slug,
+            },
+            { id: computersCollection.id, name: computersCollection.name, slug: computersCollection.slug },
+            { id: pearCollection.id, name: pearCollection.name, slug: pearCollection.slug },
         ]);
     });
 
@@ -463,7 +469,9 @@ describe('Collection resolver', () => {
             fail(`did not return the collection`);
             return;
         }
-        expect(result.collection.breadcrumbs).toEqual([{ id: 'T_1', name: ROOT_COLLECTION_NAME }]);
+        expect(result.collection.breadcrumbs).toEqual([
+            { id: 'T_1', name: ROOT_COLLECTION_NAME, slug: ROOT_COLLECTION_NAME },
+        ]);
     });
 
     it('collections.assets', async () => {
@@ -1423,6 +1431,7 @@ const GET_COLLECTION_BREADCRUMBS = gql`
             breadcrumbs {
                 id
                 name
+                slug
             }
         }
     }

+ 3 - 1
packages/core/e2e/graphql/generated-e2e-admin-types.ts

@@ -248,6 +248,7 @@ export type CollectionBreadcrumb = {
     __typename?: 'CollectionBreadcrumb';
     id: Scalars['ID'];
     name: Scalars['String'];
+    slug: Scalars['String'];
 };
 
 export type CollectionFilterParameter = {
@@ -2289,6 +2290,7 @@ export type Order = Node & {
     /** Order-level adjustments to the order total, such as discounts from promotions */
     adjustments: Array<Adjustment>;
     couponCodes: Array<Scalars['String']>;
+    /** Promotions applied to the order. Only gets populated after the payment process has completed. */
     promotions: Array<Promotion>;
     payments?: Maybe<Array<Payment>>;
     fulfillments?: Maybe<Array<Fulfillment>>;
@@ -3803,7 +3805,7 @@ export type GetCollectionBreadcrumbsQuery = { __typename?: 'Query' } & {
     collection?: Maybe<
         { __typename?: 'Collection' } & {
             breadcrumbs: Array<
-                { __typename?: 'CollectionBreadcrumb' } & Pick<CollectionBreadcrumb, 'id' | 'name'>
+                { __typename?: 'CollectionBreadcrumb' } & Pick<CollectionBreadcrumb, 'id' | 'name' | 'slug'>
             >;
         }
     >;

+ 2 - 0
packages/core/e2e/graphql/generated-e2e-shop-types.ts

@@ -164,6 +164,7 @@ export type CollectionBreadcrumb = {
     __typename?: 'CollectionBreadcrumb';
     id: Scalars['ID'];
     name: Scalars['String'];
+    slug: Scalars['String'];
 };
 
 export type CollectionFilterParameter = {
@@ -1516,6 +1517,7 @@ export type Order = Node & {
     /** Order-level adjustments to the order total, such as discounts from promotions */
     adjustments: Array<Adjustment>;
     couponCodes: Array<Scalars['String']>;
+    /** Promotions applied to the order. Only gets populated after the payment process has completed. */
     promotions: Array<Promotion>;
     payments?: Maybe<Array<Payment>>;
     fulfillments?: Maybe<Array<Fulfillment>>;

+ 1 - 0
packages/core/src/api/schema/type/collection.type.graphql

@@ -20,6 +20,7 @@ type Collection implements Node {
 type CollectionBreadcrumb {
     id: ID!
     name: String!
+    slug: String!
 }
 
 type CollectionTranslation {

+ 2 - 2
packages/core/src/service/services/collection.service.ts

@@ -181,9 +181,9 @@ export class CollectionService implements OnModuleInit {
     ): Promise<Array<{ name: string; id: ID }>> {
         const rootCollection = await this.getRootCollection(ctx);
         if (idsAreEqual(collection.id, rootCollection.id)) {
-            return [pick(rootCollection, ['id', 'name'])];
+            return [pick(rootCollection, ['id', 'name', 'slug'])];
         }
-        const pickProps = pick(['id', 'name']);
+        const pickProps = pick(['id', 'name', 'slug']);
         const ancestors = await this.getAncestors(collection.id, ctx);
         return [pickProps(rootCollection), ...ancestors.map(pickProps), pickProps(collection)];
     }

+ 2 - 0
packages/elasticsearch-plugin/e2e/graphql/generated-e2e-elasticsearch-plugin-types.ts

@@ -248,6 +248,7 @@ export type CollectionBreadcrumb = {
     __typename?: 'CollectionBreadcrumb';
     id: Scalars['ID'];
     name: Scalars['String'];
+    slug: Scalars['String'];
 };
 
 export type CollectionFilterParameter = {
@@ -2289,6 +2290,7 @@ export type Order = Node & {
     /** Order-level adjustments to the order total, such as discounts from promotions */
     adjustments: Array<Adjustment>;
     couponCodes: Array<Scalars['String']>;
+    /** Promotions applied to the order. Only gets populated after the payment process has completed. */
     promotions: Array<Promotion>;
     payments?: Maybe<Array<Payment>>;
     fulfillments?: Maybe<Array<Fulfillment>>;

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
schema-admin.json


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
schema-shop.json


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است