Giveth / DeVouch-BE

DeVouch - Decentralized Vouching via Attestations
GNU General Public License v3.0
22 stars 2 forks source link

Sort count of flags for all tracked attestor groups for a project by highest/lowest #34

Closed divine-comedian closed 3 months ago

divine-comedian commented 5 months ago

From the query response of all projects for the list view - we will need to be able to know the count from each registered/tracked attester groups that have FLAGGED a project and show the count in order from group that has made the MOST flags down the group that has made the lowest (descending order)

endpoint: https://backend.devouch.xyz/graphql

It will be used on this card component to give you a visual example: image

AC

in the query response should fulfill the following requirements:

aminlatifi commented 4 months ago

Sample query

{
  projects(where: {}, orderBy: totalFlags_ASC) {
    id
    totalVouches
    totalFlags
    totalAttests
    attestedOrganisations(orderBy:count_DESC) {
      organisation {
        name
      }
      vouch
      count
    }
  }
}

Sample response

{
  "data": {
    "projects": [
      {
        "id": "giveth-2881",
        "totalVouches": 1,
        "totalFlags": 0,
        "totalAttests": 1,
        "attestedOrganisations": [
          {
            "organisation": {
              "name": "Trace"
            },
            "vouch": true,
            "count": 1
          }
        ]
      },
      {
        "id": "giveth-2880",
        "totalVouches": 3,
        "totalFlags": 0,
        "totalAttests": 3,
        "attestedOrganisations": [
          {
            "organisation": {
              "name": "Trace"
            },
            "vouch": true,
            "count": 2
          },
          {
            "organisation": {
              "name": "Giveth Verification Team"
            },
            "vouch": true,
            "count": 1
          }
        ]
      },
      {
        "id": "giveth-123",
        "totalVouches": 1,
        "totalFlags": 2,
        "totalAttests": 3,
        "attestedOrganisations": [
          {
            "organisation": {
              "name": "Trace"
            },
            "vouch": false,
            "count": 2
          },
          {
            "organisation": {
              "name": "Trace"
            },
            "vouch": true,
            "count": 1
          }
        ]
      }
    ]
  }
}