Giveth/DeVouch-BE

[needs project info] sort user attestations by date of attestation

Closed this issue · 4 comments

When fetching attestations done by a user address we should be able to sort the responses according to the date the attestation was created 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 date attestation made in ascending order
  • can sort by date attestation made 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

How is it different that #21?

@aminlatifi this one is related to getting data related to user's attestations made, while #21 is related to a project's attestations received.

We will need project information such a title and slug/link (on devouch platform, not source platofrm) to call it done.

Sample query

{
  projectAttestations (where: {attestorOrganisation: {
    attestor: {
      id_eq:"0x826976d7c600d45fb8287ca1d7c76fc8eb732030"
    }
  }},
  orderBy: [attestTimestamp_ASC]) {
    attestTimestamp
    comment
    vouch
    revoked
    project {
      title
      description
      source
      projectId  
    }
    
  }
}

Response:

{
  "data": {
    "projectAttestations": [
      {
        "attestTimestamp": "2024-05-09T17:36:36.000000Z",
        "comment": "this is awesome",
        "vouch": true,
        "revoked": false,
        "project": {
          "title": null,
          "description": null,
          "source": "giveth",
          "projectId": "2880"
        }
      },
      {
        "attestTimestamp": "2024-05-10T12:24:36.000000Z",
        "comment": "cool project! good luck",
        "vouch": true,
        "revoked": false,
        "project": {
          "title": null,
          "description": null,
          "source": "giveth",
          "projectId": "2880"
        }
      },
      {
        "attestTimestamp": "2024-05-12T16:26:36.000000Z",
        "comment": "Does it show up now?",
        "vouch": true,
        "revoked": false,
        "project": {
          "title": null,
          "description": null,
          "source": "giveth",
          "projectId": "2881"
        }
      }
    ]
  }
}
  • title of project
  • slug/link to project

These 2 items aren't ready for testing