Fluent Commerce Logo
Docs
Essential knowledgeCore knowledge to understand Fluent Commerce

Intended Audience:

Technical User

Author:

Kirill Gaiduk

Changed on:

20 Feb 2025

Overview

The `comments` Query retrieves Comments based on various filter criteria.
Prerequisites
  • `COMMENT_VIEW` Permission is required for retrieving Comments

Key points

  • Use the `comments` Query to retrieve existing Comments
  • Manage the Comment Permissions at the Account or Retailer level
  • Apply the "Retailer-specific Comment Permission Check" validation logic with the `fc.graphql.comment.access` Setting (`retailer` value)

Inputs

The Input arguments for retrieving Comments:
ArgumentTypeDescriptionNotes
`entityType`[String!]Type of the EntityFor example:
  • `ORDER`
  • `FULFILMENT`
  • `ORDER_ITEM`
  • `PRODUCT_CATALOGUE`
`entityId`[ID]Id of the Entity
`entityRef`[String]Reference of the Entity
`text`[String!]Comment text
`createdOn`DateRangeDate range for Comments creation
`updatedOn`DateRangeDate range for Comments last update
`first`IntReturns the first n elements from the list
`last`IntReturns the last n elements from the list
`before`StringReturns the elements in the list that come before the specified global IdThis is a cursor (the value is used for pagination)
`after`StringReturns the elements in the list that come after the specified global IdThis is a cursor (the value is used for pagination)

Validation

Comment Permissions could be managed at the Account or Retailer level, which is controlled via the `fc.graphql.comment.access` Setting. The `retailer` Setting value enables the Retailer-specific access management, so the validation logic is applied to verify that your User has the correct rights to execute the `comments` Query - "Retailer-specific Comment Permission Check":
  • Comments are searched by the given Input Arguments
  • A Comment Entity `retailerId` field stores a Retailer of the associated Entity
  • For all the found Comments, the Comment `retailerId` is compared to the querying User `retailerId` (defined with the User Role Context Id)
  • The list of the retrieved Comments contains:
    • The Comments for which the mentioned (User and Comment) `retailerId`-s matches
    • The Comments with empty `retailerId`

Response

Sample Payload