Giveth/DeVouch-BE

[needs project info] sort user attestations alphabetically by project title

Closed this issue · 3 comments

When fetching attestations done by a user address we should be able to sort the responses according to the alphabetical order by project title in both ascending and descending order.

AC

  • can query attestation data for a single user
  • does not return data for other users not specified
  • can sort by project title alphabetically in ascending order
  • can sort by project title alphabetically in descending order

attestation data contains:

  • if flag or vouch
  • name of attester organization the attestation was associated with
  • comments included in attestation (if any)
  • date attestation was made
  • title of project
  • slug/link to project
  • source platform of project

We haven't filled in the project title yet, let's demonstrate with the project ID.
Sample query

{
  projectAttestations(
    where:{
      attestorOrganisation: {
        attestor: {
          id_eq: "0x826976d7c600d45fb8287ca1d7c76fc8eb732030"
        }
      }
    },
    orderBy: project_id_ASC
  ) {
    attestTimestamp
    vouch
    project {
      id
      source
    }
    attestorOrganisation {
      attestor {
        id
      }
    }
  }
}

Sample response

{
  "data": {
    "projectAttestations": [
      {
        "attestTimestamp": "2024-05-09T17:36:36.000000Z",
        "vouch": true,
        "project": {
          "id": "giveth-2880",
          "source": "giveth"
        },
        "attestorOrganisation": {
          "attestor": {
            "id": "0x826976d7c600d45fb8287ca1d7c76fc8eb732030"
          }
        }
      },
      {
        "attestTimestamp": "2024-05-10T12:24:36.000000Z",
        "vouch": true,
        "project": {
          "id": "giveth-2880",
          "source": "giveth"
        },
        "attestorOrganisation": {
          "attestor": {
            "id": "0x826976d7c600d45fb8287ca1d7c76fc8eb732030"
          }
        }
      },
      {
        "attestTimestamp": "2024-05-12T16:26:36.000000Z",
        "vouch": true,
        "project": {
          "id": "giveth-2881",
          "source": "giveth"
        },
        "attestorOrganisation": {
          "attestor": {
            "id": "0x826976d7c600d45fb8287ca1d7c76fc8eb732030"
          }
        }
      }
    ]
  }
}

We'll need the project information to be included in this in order to call it done!

"title","description" and "slug" have been added.