Reference
Thereference field on the Review model decides what a review is about. It’s
an enum with two values, product and seller, and it works together with the
review’s link to the target record. There is no polymorphic id column on the
model itself; the target is resolved through a module link.
reference value selects which link is written:
reference: "product" links the review to a product, and reference: "seller"
links it to a seller. Reading a review back, you follow the matching relation
(review.product or review.seller) to reach its target.
Products are the shared master catalog, not seller-owned. A product review
rates the master product; a seller review rates the store. They are
independent. A customer can leave both for the same order.
Order & customer links
Beyond its target, every review is anchored to the order that earned it and the customer who wrote it. Creating a review writes two more links, one to theOrder and one to the Customer, so a review always has a verifiable purchase
behind it.
One review per target, per order
Because a review is tied to an order, the create flow enforces that a customer can leave at most one review per target per order. Submitting a second review for the samereference and reference_id on the same order is rejected. The
order must also belong to the customer submitting the review.