Skip to content

How to display active or inactive drivers using AmplifyFilter #74

@rayshi67

Description

@rayshi67

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions