Skip to main content

Links between Review Module and Other Modules

This document showcases the module links defined between the Review Module and other Commerce Modules.

Summary

The Review Module has the following links to other modules:
First Data ModelSecond Data ModelTypeDescription
CustomerReviewStored - one-to-manyAssociates a customer with their submitted reviews
OrderReviewStored - one-to-manyAssociates an order with its reviews
ProductReviewStored - one-to-manyAssociates a product with its reviews
SellerReviewStored - one-to-manyAssociates a seller with reviews about them

Customer Module

Mercur defines a link between the Customer Module’s Customer data model and the Review Module’s Review data model. This allows tracking all reviews submitted by a specific customer.

Retrieve with Query

To retrieve the reviews of a customer with Query, pass review.* in fields:
const { data: customers } = await query.graph({
  entity: "customer",
  fields: [
    "*",
    "review.*",
  ],
})

// customers[0].review
To manage the reviews of a customer, use Link:

Order Module

Mercur defines a link between the Order Module’s Order data model and the Review Module’s Review data model. This ensures customers can only review products or sellers from orders they’ve actually purchased.

Retrieve with Query

To retrieve the reviews of an order with Query, pass review.* in fields:
const { data: orders } = await query.graph({
  entity: "order",
  fields: [
    "*",
    "review.*",
  ],
})

// orders[0].review
To manage the reviews of an order, use Link:

Product Module

Mercur defines a link between the Product Module’s Product data model and the Review Module’s Review data model. This allows products to have multiple customer reviews for ratings and feedback.

Retrieve with Query

To retrieve the reviews of a product with Query, pass review.* in fields:
const { data: products } = await query.graph({
  entity: "product",
  fields: [
    "*",
    "review.*",
  ],
})

// products[0].review
To manage the reviews of a product, use Link:

Seller Module

Mercur defines a link between the Seller Module’s Seller data model and the Review Module’s Review data model. This allows sellers to receive customer reviews about their service and performance.

Retrieve with Query

To retrieve the reviews of a seller with Query, pass review.* in fields:
const { data: sellers } = await query.graph({
  entity: "seller",
  fields: [
    "*",
    "review.*",
  ],
})

// sellers[0].review
To manage the reviews of a seller, use Link: