react-admin-amplify icon indicating copy to clipboard operation
react-admin-amplify copied to clipboard

How to display active or inactive drivers using AmplifyFilter

Open rayshi67 opened this issue 3 years ago • 0 comments

Hi @MrHertal,

Thank you for the great work on react-admin-amplify. And I am currently building a prototype application based on it.

I was wondering if you could shed some lights on how to implement a filter of dropdown box that can be used to list only the active, inactive, or all drivers respectively for the following Driver type,

type Driver
  @model(timestamps:{createdAt: "createdOn", updatedAt: "updatedOn"})
  @auth(rules: [
    {allow: private}
  ])
  @key(name: "byFirstName", fields: ["firstName", "id"], queryField: "driversByFirstName")
  @key(name: "byLastName", fields: ["lastName", "id"], queryField: "driversByLastName") {
  id: ID!
  firstName: String!
  lastName: String!
  startDate: AWSDateTime!
  endDate: AWSDateTime!
}
  • the query should return all the drivers by default
  • if the active option is selected in the dropdown filter, the query should return all active drivers where the current date is between the startDate and endDate, i.e., startDate < currentDate < endDate
  • if the inactive option is selected in the dropdown filter, the query should return all inactive drivers where the current date is outside the startDate and endDate, i.e. currentDate < startDate || current > endDate

Is the above filter currently supported in react-admin-amplify? If not, what would be the best way to have this implemented?

Thanks in advance Ray

rayshi67 avatar Jul 20 '22 10:07 rayshi67