Giveth/DeVouch-BE

Default Sort response by count of attestation on projects

Closed this issue · 3 comments

The default sorting given by the unified API response of the projects should be projects that have the highest count of attestations (vouch AND Flags together) from all tracked attester groups.

If a filter has been applied to look only for a certain attester group then the default sorting should filter by this as well. Similarly if we filter for a specific platform.

@aminlatifi - Did we already figure this one out?

We can add define sort condition in queries like this

query {
  projects(orderBy:totalAttests_DESC, where: {
    attestedOrganisations_some:{
      organisation: {
        name_eq: "Trace"
      }
    }
  }) {
    title
    totalAttests
    totalVouches
    totalFlags
    attestedOrganisations {
      organisation {
        name
      }
      vouch
      count
    }
  }
}

thanks! tested and response is as expected.

on first page load by user without any filtering or sorting applied by the user our default should be this:

{
  projects(orderBy: totalAttests_DESC) {
    title
    totalAttests
    totalVouches
    totalFlags
    attestedOrganisations {
      organisation {
        name
      }
      vouch
      count
    }
  }
}