【问题标题】:In Apostrophe cms ,How can i get the list of the specialist whose value corresponding to the country(joinByArray) are same?在 Apostrophe cms 中,如何获取与国家(joinByArray)对应的值相同的专家列表?
【发布时间】:2020-12-17 06:07:44
【问题描述】:

我创建了一个名为“专家”的撇号片段,其中包含几位专家的数据。片段模式中的一个字段是 COUNTRY (他们访问过的国家的名称),它由 array 连接。现在如何获取与国家对应的值相同的专家列表。即..我怎样才能只得到那些访问过印度或中国的专家。 [我使用撇号作为无头]

我的架构如下所示:

module.exports = {
  name: 'specialist',
  extend: 'apostrophe-pieces',
  label: 'Specialist',
  restApi:true,
  pluralLabel: 'Specialists',
  addFields: [
    {
      name: 'name',
      label: 'Name',
      type: 'string',
      required: true
    },
    {
      name: 'photo',
      label: 'Photo',
      type: 'singleton',
      widgetType: 'apostrophe-images',
      options: {
        aspectRatio: [ 1, 1 ],
        minSize: [ 300, 300 ],
        limit: 1
      }
    },
    {
      name: 'phoneNumber',
      label: 'Phone Number',
      type: 'integer',
      required: true
    },
    {
      name: 'email',
      label: 'E Mail',
      type: 'email',
      required: true

  }
    {
      name: '_country',
      label: 'Country',
      type: 'joinByOne,
      required: true,
      withType: 'country'
    },

【问题讨论】:

  • 请提供您迄今为止尝试过的内容以及有关上下文的更多信息。这是在页面中吗?在小部件中?您已经参考了哪些文档?
  • 我想获取其国家被选为印度的所有专家的列表...其中国家是专家模式中的 joinbyOne 部分。我曾经像这样过滤“api/v1/specialist?country[]=India”,但没有用……相反,我得到了所有的专家数据

标签: apostrophe-cms


【解决方案1】:

Apostrophe Headless 文档包含有关配置的信息,以允许 filtering piece GET requests。您可能不需要做太多其他事情,但如果您需要,可以使用 additional docs on setting custom cursors 过滤器。

【讨论】:

    猜你喜欢
    • 2023-03-15
    • 1970-01-01
    • 1970-01-01
    • 2014-08-10
    • 2013-02-27
    • 2022-08-22
    • 1970-01-01
    • 1970-01-01
    • 2011-01-20
    相关资源
    最近更新 更多