Added cc contract searching by date range BOD-236

This commit is contained in:
Patrick Fic
2020-07-29 10:48:11 -07:00
parent b51f5b0db2
commit 1f95b37778
8 changed files with 247 additions and 30 deletions

View File

@@ -97,9 +97,20 @@ export const QUERY_CONTRACT_BY_PK = gql`
}
`;
export const QUERY_ACTIVE_CONTRACTS = gql`
query QUERY_ACTIVE_CONTRACTS {
cccontracts(where: { status: { _neq: "contracts.status.returned" } }) {
export const QUERY_ACTIVE_CONTRACTS_PAGINATED = gql`
query QUERY_ACTIVE_CONTRACTS_PAGINATED(
$offset: Int
$limit: Int
$order: [cccontracts_order_by!]!
$start: timestamptz
$end: timestamptz
) {
cccontracts(
offset: $offset
limit: $limit
order_by: $order
where: { actualreturn: { _lte: $end }, start: { _gte: $start } }
) {
agreementnumber
courtesycarid
driver_fn
@@ -116,6 +127,7 @@ export const QUERY_ACTIVE_CONTRACTS = gql`
ownr_co_nm
}
scheduledreturn
actualreturn
start
status
courtesycar {
@@ -127,5 +139,10 @@ export const QUERY_ACTIVE_CONTRACTS = gql`
plate
}
}
cccontracts_aggregate {
aggregate {
count(distinct: true)
}
}
}
`;