Skip to content
This repository was archived by the owner on Jan 15, 2022. It is now read-only.

Commit 6c96b94

Browse files
authored
Merge pull request #8 from jonyw4/1.2.0
1.2.0
2 parents bdd5624 + 2c58e98 commit 6c96b94

26 files changed

Lines changed: 297 additions & 101 deletions

e2e/graphql/admin-api.graphql.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const ADMIN_REVIEW_STORE_FRAGMENT = gql`
88
state
99
nps
1010
nextStates
11+
customerNameIsPublic
1112
customer {
1213
id
1314
firstName
@@ -69,6 +70,7 @@ export const ADMIN_REVIEW_PRODUCT_FRAGMENT = gql`
6970
state
7071
stars
7172
nextStates
73+
customerNameIsPublic
7274
customer {
7375
id
7476
firstName

e2e/graphql/admin-api.graphql.types.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import * as Types from '../../src/types/generated-admin-schema';
22

33
export type AdminReviewStoreFragment = { __typename?: 'ReviewStore' } & Pick<
44
Types.ReviewStore,
5-
'id' | 'title' | 'description' | 'state' | 'nps' | 'nextStates'
5+
| 'id'
6+
| 'title'
7+
| 'description'
8+
| 'state'
9+
| 'nps'
10+
| 'nextStates'
11+
| 'customerNameIsPublic'
612
> & {
713
customer: { __typename?: 'Customer' } & Pick<
814
Types.Customer,
@@ -66,7 +72,13 @@ export type AdminReviewProductFragment = {
6672
__typename?: 'ReviewProduct';
6773
} & Pick<
6874
Types.ReviewProduct,
69-
'id' | 'title' | 'description' | 'state' | 'stars' | 'nextStates'
75+
| 'id'
76+
| 'title'
77+
| 'description'
78+
| 'state'
79+
| 'stars'
80+
| 'nextStates'
81+
| 'customerNameIsPublic'
7082
> & {
7183
customer: { __typename?: 'Customer' } & Pick<
7284
Types.Customer,

e2e/graphql/shop-api.graphql.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export const SHOP_REVIEW_STORE_FRAGMENT = gql`
66
title
77
description
88
nps
9+
customerNameIsPublic
10+
customerName
911
}
1012
`;
1113

@@ -58,6 +60,8 @@ export const SHOP_REVIEW_PRODUCT_FRAGMENT = gql`
5860
title
5961
description
6062
stars
63+
customerNameIsPublic
64+
customerName
6165
}
6266
`;
6367

e2e/graphql/shop-api.graphql.types.ts

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import * as Types from '../../src/types/generated-shop-schema';
22

33
export type ShopReviewStoreFragment = { __typename?: 'ReviewStore' } & Pick<
44
Types.ReviewStore,
5-
'id' | 'title' | 'description' | 'nps'
5+
| 'id'
6+
| 'title'
7+
| 'description'
8+
| 'nps'
9+
| 'customerNameIsPublic'
10+
| 'customerName'
611
>;
712

813
export type CreateReviewStoreMutationVariables = Types.Exact<{
@@ -35,18 +40,6 @@ export type ListReviewStoreQuery = { __typename?: 'Query' } & {
3540
};
3641
};
3742

38-
export type AvailableProductsReviewQueryVariables = Types.Exact<{
39-
[key: string]: never;
40-
}>;
41-
42-
export type AvailableProductsReviewQuery = { __typename?: 'Query' } & {
43-
availableProductsToReview: { __typename?: 'ProductList' } & {
44-
items: Array<
45-
{ __typename?: 'Product' } & Pick<Types.Product, 'id' | 'name'>
46-
>;
47-
};
48-
};
49-
5043
export type MyReviewStoreQueryVariables = Types.Exact<{ [key: string]: never }>;
5144

5245
export type MyReviewStoreQuery = { __typename?: 'Query' } & {
@@ -66,9 +59,46 @@ export type AvgReviewStoreQuery = { __typename?: 'Query' } & Pick<
6659

6760
export type ShopReviewProductFragment = { __typename?: 'ReviewProduct' } & Pick<
6861
Types.ReviewProduct,
69-
'id' | 'title' | 'description' | 'stars'
62+
| 'id'
63+
| 'title'
64+
| 'description'
65+
| 'stars'
66+
| 'customerNameIsPublic'
67+
| 'customerName'
7068
>;
7169

70+
export type AvailableProductsReviewQueryVariables = Types.Exact<{
71+
[key: string]: never;
72+
}>;
73+
74+
export type AvailableProductsReviewQuery = { __typename?: 'Query' } & {
75+
availableProductsToReview: { __typename?: 'ProductList' } & {
76+
items: Array<
77+
{ __typename?: 'Product' } & Pick<Types.Product, 'id' | 'name'>
78+
>;
79+
};
80+
};
81+
82+
export type ReviewProductQueryVariables = Types.Exact<{
83+
id: Types.Scalars['ID'];
84+
}>;
85+
86+
export type ReviewProductQuery = { __typename?: 'Query' } & {
87+
reviewProduct?: Types.Maybe<
88+
{ __typename?: 'ReviewProduct' } & ShopReviewProductFragment
89+
>;
90+
};
91+
92+
export type ListReviewProductQueryVariables = Types.Exact<{
93+
[key: string]: never;
94+
}>;
95+
96+
export type ListReviewProductQuery = { __typename?: 'Query' } & {
97+
reviewsProduct: { __typename?: 'ReviewProductList' } & {
98+
items: Array<{ __typename?: 'ReviewProduct' } & ShopReviewProductFragment>;
99+
};
100+
};
101+
72102
export type CreateReviewProductMutationVariables = Types.Exact<{
73103
input: Types.CreateReviewProductInput;
74104
}>;

e2e/review-product.spec.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ const customerTestPassword = 'test';
5151
const exampleCreteReviewProduct = {
5252
title: 'Good company',
5353
description: 'Good company',
54-
stars: 5
54+
stars: 5,
55+
customerNameIsPublic: false
5556
};
5657

5758
describe('Review Product E2E', () => {
@@ -139,6 +140,7 @@ describe('Review Product E2E', () => {
139140
).resolves.toEqual({
140141
createReviewProduct: {
141142
id: 'T_1',
143+
customerName: null,
142144
...exampleCreteReviewProduct
143145
}
144146
});
@@ -186,6 +188,7 @@ describe('Review Product E2E', () => {
186188
items: [
187189
{
188190
id: 'T_1',
191+
customerName: null,
189192
...exampleCreteReviewProduct
190193
}
191194
]
@@ -199,6 +202,7 @@ describe('Review Product E2E', () => {
199202
).resolves.toEqual({
200203
reviewProduct: {
201204
id: 'T_1',
205+
customerName: null,
202206
...exampleCreteReviewProduct
203207
}
204208
});
@@ -300,6 +304,7 @@ describe('Review Product E2E', () => {
300304
items: [
301305
{
302306
id: 'T_1',
307+
customerName: null,
303308
...exampleCreteReviewProduct
304309
}
305310
]
@@ -321,13 +326,16 @@ describe('Review Product E2E', () => {
321326
>(SHOP_UPDATE_REVIEW_PRODUCT, {
322327
input: {
323328
id: 'T_1',
324-
...exampleCreteReviewProduct
329+
...exampleCreteReviewProduct,
330+
customerNameIsPublic: true
325331
}
326332
})
327333
).resolves.toEqual({
328334
updateReviewProduct: {
329335
id: 'T_1',
330-
...exampleCreteReviewProduct
336+
...exampleCreteReviewProduct,
337+
customerNameIsPublic: true,
338+
customerName: 'Trevor'
331339
}
332340
});
333341
});
@@ -353,7 +361,8 @@ describe('Review Product E2E', () => {
353361
},
354362
nextStates: ['Authorized', 'Denied'],
355363
state: 'Updated',
356-
...exampleCreteReviewProduct
364+
...exampleCreteReviewProduct,
365+
customerNameIsPublic: true
357366
}
358367
});
359368
});

e2e/review-store.spec.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ const customerTestPassword = 'test';
5353
const exampleCreteReviewStore = {
5454
title: 'Good company',
5555
description: 'Good company',
56-
nps: 10
56+
nps: 10,
57+
customerNameIsPublic: false
5758
};
5859

5960
describe('Review Store E2E', () => {
@@ -117,7 +118,8 @@ describe('Review Store E2E', () => {
117118
).resolves.toEqual({
118119
createReviewStore: {
119120
id: 'T_1',
120-
...exampleCreteReviewStore
121+
...exampleCreteReviewStore,
122+
customerName: null
121123
}
122124
});
123125
});
@@ -143,6 +145,7 @@ describe('Review Store E2E', () => {
143145
).resolves.toEqual({
144146
myReviewStore: {
145147
id: 'T_1',
148+
customerName: null,
146149
...exampleCreteReviewStore
147150
}
148151
});
@@ -238,6 +241,7 @@ describe('Review Store E2E', () => {
238241
items: [
239242
{
240243
id: 'T_1',
244+
customerName: null,
241245
...exampleCreteReviewStore
242246
}
243247
]
@@ -277,13 +281,16 @@ describe('Review Store E2E', () => {
277281
UpdateReviewStoreMutationVariables
278282
>(SHOP_UPDATE_REVIEW_STORE, {
279283
input: {
280-
...exampleCreteReviewStore
284+
...exampleCreteReviewStore,
285+
customerNameIsPublic: true
281286
}
282287
})
283288
).resolves.toEqual({
284289
updateReviewStore: {
285290
id: 'T_1',
286-
...exampleCreteReviewStore
291+
...exampleCreteReviewStore,
292+
customerNameIsPublic: true,
293+
customerName: 'Trevor'
287294
}
288295
});
289296
});
@@ -305,7 +312,8 @@ describe('Review Store E2E', () => {
305312
},
306313
nextStates: ['Authorized', 'Denied'],
307314
state: 'Updated',
308-
...exampleCreteReviewStore
315+
...exampleCreteReviewStore,
316+
customerNameIsPublic: true
309317
}
310318
});
311319
});

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
"dev-server:run:worker": "node -r ts-node/register dev-server/index-worker.ts"
2727
},
2828
"dependencies": {
29-
"@vendure/ui-devkit": "0.14.0"
29+
"@vendure/ui-devkit": "0.15.0"
3030
},
3131
"peerDependencies": {
32-
"@vendure/core": ">=0.14.0"
32+
"@vendure/core": ">=0.15.0"
3333
},
3434
"devDependencies": {
3535
"@commitlint/config-conventional": "9.1.1",
@@ -43,9 +43,9 @@
4343
"@types/jest": "26.0.4",
4444
"@typescript-eslint/eslint-plugin": "3.6.1",
4545
"@typescript-eslint/parser": "3.6.1",
46-
"@vendure/core": "0.14.0",
47-
"@vendure/create": "0.14.0",
48-
"@vendure/testing": "0.14.0",
46+
"@vendure/core": "0.15.0",
47+
"@vendure/create": "0.15.0",
48+
"@vendure/testing": "0.15.0",
4949
"codecov": "^3.7.2",
5050
"commitlint": "9.1.0",
5151
"concurrently": "5.3.0",

src/api/schemas/review-product.admin.schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const reviewProductAdminApiExtension = gql`
1010
nextStates: [String!]!
1111
customer: Customer!
1212
product: Product!
13+
customerNameIsPublic: Boolean
1314
}
1415
type ReviewProductList implements PaginatedList {
1516
items: [ReviewProduct!]!

src/api/schemas/review-product.shop.schema.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,35 @@ export const reviewProductShopApiExtension = gql`
77
description: String!
88
stars: Int!
99
product: Product!
10+
customerName: String
11+
customerNameIsPublic: Boolean!
1012
}
1113
input CreateReviewProductInput {
1214
productId: ID!
1315
title: String!
1416
description: String!
1517
stars: Int!
18+
customerNameIsPublic: Boolean!
1619
}
1720
input UpdateReviewProductInput {
1821
id: ID!
1922
title: String
2023
description: String
2124
stars: Int
25+
customerNameIsPublic: Boolean
2226
}
2327
type ReviewProductList implements PaginatedList {
2428
items: [ReviewProduct!]!
2529
totalItems: Int!
2630
}
2731
extend type Product {
28-
reviewAvg: Int!
32+
reviewAvg: Float!
2933
reviews(options: ReviewProductListOptions): ReviewProductList!
34+
"Use this in your Storefront to show in product page if user can create a review"
3035
canReview: Boolean
3136
}
3237
extend type Query {
38+
"A list of available products to user review"
3339
availableProductsToReview(options: ProductListOptions): ProductList!
3440
reviewProduct(id: ID!): ReviewProduct
3541
reviewsProduct(options: ReviewProductListOptions): ReviewProductList!

src/api/schemas/review-store.admin.schema.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const reviewStoreAdminApiExtension = gql`
99
nps: Int!
1010
nextStates: [String!]!
1111
customer: Customer!
12+
customerNameIsPublic: Boolean
1213
}
1314
type ReviewStoreList implements PaginatedList {
1415
items: [ReviewStore!]!
@@ -19,7 +20,7 @@ export const reviewStoreAdminApiExtension = gql`
1920
}
2021
extend type Query {
2122
"Get the average of review store"
22-
avgReviewStore: Int
23+
avgReviewStore: Float
2324
2425
"Get the review store"
2526
reviewStore(id: ID!): ReviewStore

0 commit comments

Comments
 (0)