Updated contract creation to include auto status changes. BOD-314

This commit is contained in:
Patrick Fic
2020-08-28 09:44:55 -07:00
parent 554a8f6170
commit fbde4ddc2a
15 changed files with 328 additions and 226 deletions

View File

@@ -1,12 +1,22 @@
import gql from "graphql-tag";
export const INSERT_NEW_CONTRACT = gql`
mutation INSERT_NEW_CONTRACT($contract: [cccontracts_insert_input!]!) {
mutation INSERT_NEW_CONTRACT(
$contract: [cccontracts_insert_input!]!
$ccId: uuid!
) {
insert_cccontracts(objects: $contract) {
returning {
id
}
}
update_courtesycars_by_pk(
pk_columns: { id: $ccId }
_set: { status: "courtesycars.status.out" }
) {
status
id
}
}
`;

View File

@@ -14,7 +14,12 @@ export const INSERT_NEW_COURTESY_CAR = gql`
export const QUERY_AVAILABLE_CC = gql`
query QUERY_AVAILABLE_CC {
courtesycars(where: { serviceenddate: { _is_null: true } }) {
courtesycars(
where: {
serviceenddate: { _is_null: true }
status: { _eq: "courtesycars.status.in" }
}
) {
color
dailycost
damage
@@ -26,6 +31,8 @@ export const QUERY_AVAILABLE_CC = gql`
plate
status
year
dailycost
mileage
}
}
`;
@@ -96,7 +103,9 @@ export const QUERY_CC_BY_PK = gql`
status
vin
year
mileage
cccontracts {
agreementnumber
id
status
start