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

Commit

Permalink
Merge pull request #8 from jonyw4/1.2.0
Browse files Browse the repository at this point in the history
1.2.0
  • Loading branch information
jonyw4 authored Aug 28, 2020
2 parents bdd5624 + 2c58e98 commit 6c96b94
Show file tree
Hide file tree
Showing 26 changed files with 297 additions and 101 deletions.
2 changes: 2 additions & 0 deletions e2e/graphql/admin-api.graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const ADMIN_REVIEW_STORE_FRAGMENT = gql`
state
nps
nextStates
customerNameIsPublic
customer {
id
firstName
Expand Down Expand Up @@ -69,6 +70,7 @@ export const ADMIN_REVIEW_PRODUCT_FRAGMENT = gql`
state
stars
nextStates
customerNameIsPublic
customer {
id
firstName
Expand Down
16 changes: 14 additions & 2 deletions e2e/graphql/admin-api.graphql.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import * as Types from '../../src/types/generated-admin-schema';

export type AdminReviewStoreFragment = { __typename?: 'ReviewStore' } & Pick<
Types.ReviewStore,
'id' | 'title' | 'description' | 'state' | 'nps' | 'nextStates'
| 'id'
| 'title'
| 'description'
| 'state'
| 'nps'
| 'nextStates'
| 'customerNameIsPublic'
> & {
customer: { __typename?: 'Customer' } & Pick<
Types.Customer,
Expand Down Expand Up @@ -66,7 +72,13 @@ export type AdminReviewProductFragment = {
__typename?: 'ReviewProduct';
} & Pick<
Types.ReviewProduct,
'id' | 'title' | 'description' | 'state' | 'stars' | 'nextStates'
| 'id'
| 'title'
| 'description'
| 'state'
| 'stars'
| 'nextStates'
| 'customerNameIsPublic'
> & {
customer: { __typename?: 'Customer' } & Pick<
Types.Customer,
Expand Down
4 changes: 4 additions & 0 deletions e2e/graphql/shop-api.graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export const SHOP_REVIEW_STORE_FRAGMENT = gql`
title
description
nps
customerNameIsPublic
customerName
}
`;

Expand Down Expand Up @@ -58,6 +60,8 @@ export const SHOP_REVIEW_PRODUCT_FRAGMENT = gql`
title
description
stars
customerNameIsPublic
customerName
}
`;

Expand Down
58 changes: 44 additions & 14 deletions e2e/graphql/shop-api.graphql.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import * as Types from '../../src/types/generated-shop-schema';

export type ShopReviewStoreFragment = { __typename?: 'ReviewStore' } & Pick<
Types.ReviewStore,
'id' | 'title' | 'description' | 'nps'
| 'id'
| 'title'
| 'description'
| 'nps'
| 'customerNameIsPublic'
| 'customerName'
>;

export type CreateReviewStoreMutationVariables = Types.Exact<{
Expand Down Expand Up @@ -35,18 +40,6 @@ export type ListReviewStoreQuery = { __typename?: 'Query' } & {
};
};

export type AvailableProductsReviewQueryVariables = Types.Exact<{
[key: string]: never;
}>;

export type AvailableProductsReviewQuery = { __typename?: 'Query' } & {
availableProductsToReview: { __typename?: 'ProductList' } & {
items: Array<
{ __typename?: 'Product' } & Pick<Types.Product, 'id' | 'name'>
>;
};
};

export type MyReviewStoreQueryVariables = Types.Exact<{ [key: string]: never }>;

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

export type ShopReviewProductFragment = { __typename?: 'ReviewProduct' } & Pick<
Types.ReviewProduct,
'id' | 'title' | 'description' | 'stars'
| 'id'
| 'title'
| 'description'
| 'stars'
| 'customerNameIsPublic'
| 'customerName'
>;

export type AvailableProductsReviewQueryVariables = Types.Exact<{
[key: string]: never;
}>;

export type AvailableProductsReviewQuery = { __typename?: 'Query' } & {
availableProductsToReview: { __typename?: 'ProductList' } & {
items: Array<
{ __typename?: 'Product' } & Pick<Types.Product, 'id' | 'name'>
>;
};
};

export type ReviewProductQueryVariables = Types.Exact<{
id: Types.Scalars['ID'];
}>;

export type ReviewProductQuery = { __typename?: 'Query' } & {
reviewProduct?: Types.Maybe<
{ __typename?: 'ReviewProduct' } & ShopReviewProductFragment
>;
};

export type ListReviewProductQueryVariables = Types.Exact<{
[key: string]: never;
}>;

export type ListReviewProductQuery = { __typename?: 'Query' } & {
reviewsProduct: { __typename?: 'ReviewProductList' } & {
items: Array<{ __typename?: 'ReviewProduct' } & ShopReviewProductFragment>;
};
};

export type CreateReviewProductMutationVariables = Types.Exact<{
input: Types.CreateReviewProductInput;
}>;
Expand Down
17 changes: 13 additions & 4 deletions e2e/review-product.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ const customerTestPassword = 'test';
const exampleCreteReviewProduct = {
title: 'Good company',
description: 'Good company',
stars: 5
stars: 5,
customerNameIsPublic: false
};

describe('Review Product E2E', () => {
Expand Down Expand Up @@ -139,6 +140,7 @@ describe('Review Product E2E', () => {
).resolves.toEqual({
createReviewProduct: {
id: 'T_1',
customerName: null,
...exampleCreteReviewProduct
}
});
Expand Down Expand Up @@ -186,6 +188,7 @@ describe('Review Product E2E', () => {
items: [
{
id: 'T_1',
customerName: null,
...exampleCreteReviewProduct
}
]
Expand All @@ -199,6 +202,7 @@ describe('Review Product E2E', () => {
).resolves.toEqual({
reviewProduct: {
id: 'T_1',
customerName: null,
...exampleCreteReviewProduct
}
});
Expand Down Expand Up @@ -300,6 +304,7 @@ describe('Review Product E2E', () => {
items: [
{
id: 'T_1',
customerName: null,
...exampleCreteReviewProduct
}
]
Expand All @@ -321,13 +326,16 @@ describe('Review Product E2E', () => {
>(SHOP_UPDATE_REVIEW_PRODUCT, {
input: {
id: 'T_1',
...exampleCreteReviewProduct
...exampleCreteReviewProduct,
customerNameIsPublic: true
}
})
).resolves.toEqual({
updateReviewProduct: {
id: 'T_1',
...exampleCreteReviewProduct
...exampleCreteReviewProduct,
customerNameIsPublic: true,
customerName: 'Trevor'
}
});
});
Expand All @@ -353,7 +361,8 @@ describe('Review Product E2E', () => {
},
nextStates: ['Authorized', 'Denied'],
state: 'Updated',
...exampleCreteReviewProduct
...exampleCreteReviewProduct,
customerNameIsPublic: true
}
});
});
Expand Down
18 changes: 13 additions & 5 deletions e2e/review-store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ const customerTestPassword = 'test';
const exampleCreteReviewStore = {
title: 'Good company',
description: 'Good company',
nps: 10
nps: 10,
customerNameIsPublic: false
};

describe('Review Store E2E', () => {
Expand Down Expand Up @@ -117,7 +118,8 @@ describe('Review Store E2E', () => {
).resolves.toEqual({
createReviewStore: {
id: 'T_1',
...exampleCreteReviewStore
...exampleCreteReviewStore,
customerName: null
}
});
});
Expand All @@ -143,6 +145,7 @@ describe('Review Store E2E', () => {
).resolves.toEqual({
myReviewStore: {
id: 'T_1',
customerName: null,
...exampleCreteReviewStore
}
});
Expand Down Expand Up @@ -238,6 +241,7 @@ describe('Review Store E2E', () => {
items: [
{
id: 'T_1',
customerName: null,
...exampleCreteReviewStore
}
]
Expand Down Expand Up @@ -277,13 +281,16 @@ describe('Review Store E2E', () => {
UpdateReviewStoreMutationVariables
>(SHOP_UPDATE_REVIEW_STORE, {
input: {
...exampleCreteReviewStore
...exampleCreteReviewStore,
customerNameIsPublic: true
}
})
).resolves.toEqual({
updateReviewStore: {
id: 'T_1',
...exampleCreteReviewStore
...exampleCreteReviewStore,
customerNameIsPublic: true,
customerName: 'Trevor'
}
});
});
Expand All @@ -305,7 +312,8 @@ describe('Review Store E2E', () => {
},
nextStates: ['Authorized', 'Denied'],
state: 'Updated',
...exampleCreteReviewStore
...exampleCreteReviewStore,
customerNameIsPublic: true
}
});
});
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"dev-server:run:worker": "node -r ts-node/register dev-server/index-worker.ts"
},
"dependencies": {
"@vendure/ui-devkit": "0.14.0"
"@vendure/ui-devkit": "0.15.0"
},
"peerDependencies": {
"@vendure/core": ">=0.14.0"
"@vendure/core": ">=0.15.0"
},
"devDependencies": {
"@commitlint/config-conventional": "9.1.1",
Expand All @@ -43,9 +43,9 @@
"@types/jest": "26.0.4",
"@typescript-eslint/eslint-plugin": "3.6.1",
"@typescript-eslint/parser": "3.6.1",
"@vendure/core": "0.14.0",
"@vendure/create": "0.14.0",
"@vendure/testing": "0.14.0",
"@vendure/core": "0.15.0",
"@vendure/create": "0.15.0",
"@vendure/testing": "0.15.0",
"codecov": "^3.7.2",
"commitlint": "9.1.0",
"concurrently": "5.3.0",
Expand Down
1 change: 1 addition & 0 deletions src/api/schemas/review-product.admin.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const reviewProductAdminApiExtension = gql`
nextStates: [String!]!
customer: Customer!
product: Product!
customerNameIsPublic: Boolean
}
type ReviewProductList implements PaginatedList {
items: [ReviewProduct!]!
Expand Down
8 changes: 7 additions & 1 deletion src/api/schemas/review-product.shop.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,35 @@ export const reviewProductShopApiExtension = gql`
description: String!
stars: Int!
product: Product!
customerName: String
customerNameIsPublic: Boolean!
}
input CreateReviewProductInput {
productId: ID!
title: String!
description: String!
stars: Int!
customerNameIsPublic: Boolean!
}
input UpdateReviewProductInput {
id: ID!
title: String
description: String
stars: Int
customerNameIsPublic: Boolean
}
type ReviewProductList implements PaginatedList {
items: [ReviewProduct!]!
totalItems: Int!
}
extend type Product {
reviewAvg: Int!
reviewAvg: Float!
reviews(options: ReviewProductListOptions): ReviewProductList!
"Use this in your Storefront to show in product page if user can create a review"
canReview: Boolean
}
extend type Query {
"A list of available products to user review"
availableProductsToReview(options: ProductListOptions): ProductList!
reviewProduct(id: ID!): ReviewProduct
reviewsProduct(options: ReviewProductListOptions): ReviewProductList!
Expand Down
3 changes: 2 additions & 1 deletion src/api/schemas/review-store.admin.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const reviewStoreAdminApiExtension = gql`
nps: Int!
nextStates: [String!]!
customer: Customer!
customerNameIsPublic: Boolean
}
type ReviewStoreList implements PaginatedList {
items: [ReviewStore!]!
Expand All @@ -19,7 +20,7 @@ export const reviewStoreAdminApiExtension = gql`
}
extend type Query {
"Get the average of review store"
avgReviewStore: Int
avgReviewStore: Float
"Get the review store"
reviewStore(id: ID!): ReviewStore
Expand Down
6 changes: 5 additions & 1 deletion src/api/schemas/review-store.shop.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ export const reviewStoreShopApiExtension = gql`
title: String!
description: String!
nps: Int!
customerName: String
customerNameIsPublic: Boolean!
}
input CreateReviewStoreInput {
title: String!
description: String!
nps: Int!
customerNameIsPublic: Boolean!
}
input UpdateReviewStoreInput {
title: String
description: String
nps: Int
customerNameIsPublic: Boolean
}
type ReviewStoreList implements PaginatedList {
Expand All @@ -29,7 +33,7 @@ export const reviewStoreShopApiExtension = gql`
}
extend type Query {
"Get the average of review store"
avgReviewStore: Int
avgReviewStore: Float
"Get the review store of the current customer"
myReviewStore: ReviewStore
Expand Down
Loading

0 comments on commit 6c96b94

Please sign in to comment.