Este é um plugin para o framework de e-commerce Vendure projetado para gerenciar funcionalidades relacionadas a avaliação do produto comprado pelo cliente. Ele também permite o gerenciamento de aceitar ou negar essa avaliação por parte do backoffice ao projeto Gseller.
Após configurar o seu projeto Vendure, você pode usar este plugin via npm install:
npm install review-plugin
e inclua-o no arquivo vendure-config conforme abaixo:
import { ReviewsPlugin } from "review-plugin";
...
export const config: VendureConfig = {
...
plugins: [
...,
ReviewsPlugin
]
}
Os tipos, entradas e mutações atualizadas após a instalação do plugin são:
type ProductReview implements Node {
id: ID!
createdAt: DateTime!
updatedAt: DateTime!
product: Product!
productVariant: ProductVariant
summary: String!
body: String
rating: Float!
authorName: String!
authorLocation: String
upvotes: Int!
downvotes: Int!
state: String!
response: String
responseCreatedAt: DateTime
}
type ProductReviewList implements PaginatedList {
items: [ProductReview!]!
totalItems: Int!
}
type ProductReviewHistogramItem {
bin: Int!
frequency: Int!
}
extend type Product {
reviews(options: ProductReviewListOptions): ProductReviewList!
reviewsHistogram: [ProductReviewHistogramItem!]!
}
# Auto-generated at runtime
input ProductReviewListOptions
extend type ProductReview {
author: Customer
}
input UpdateProductReviewInput {
id: ID!
summary: String
body: String
response: String
}
extend type Query {
productReviews(options: ProductReviewListOptions): ProductReviewList!
productReview(id: ID!): ProductReview
}
extend type Mutation {
updateProductReview(input: UpdateProductReviewInput!): ProductReview!
approveProductReview(id: ID!): ProductReview
rejectProductReview(id: ID!): ProductReview
}
input SubmitProductReviewInput {
productId: ID!
variantId: ID
customerId: ID
summary: String!
body: String!
rating: Float!
authorName: String!
authorLocation: String
}
extend type Mutation {
submitProductReview(input: SubmitProductReviewInput!): ProductReview!
voteOnReview(id: ID!, vote: Boolean!): ProductReview!
}