diff --git a/README.MD b/README.MD index 560bb2d4b..6e060741a 100644 --- a/README.MD +++ b/README.MD @@ -9,4 +9,4 @@ To Start Hasura CLI: npx hasura console --admin-secret Dev-BodyShopAppBySnaptSoftware! Migrating to Staging: -npx hasura migrate apply --endpoint https://bodyshop-staging-db.herokuapp.com/ --admin-secret Staging-BodyShopAppBySnaptSoftware! \ No newline at end of file +npx hasura migrate apply --up 10 --endpoint https://bodyshop-staging-db.herokuapp.com/ --admin-secret Staging-BodyShopAppBySnaptSoftware! \ No newline at end of file diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index a8e589448..e34457cbc 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -217,6 +217,27 @@ labels + + actions + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + in false @@ -557,6 +578,27 @@ errors + + deleted + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + noaccess false @@ -814,6 +856,27 @@ + + cieca_id + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + claim_total false @@ -2074,6 +2137,48 @@ + + updated_at + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + uploaded_by + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + vehicle false @@ -2488,6 +2593,27 @@ successes + + all_deleted + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + converted false @@ -2509,6 +2635,27 @@ + + deleted + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + save false diff --git a/client/src/components/header/header.container.jsx b/client/src/components/header/header.container.jsx index d2081292c..db3d0e9f2 100644 --- a/client/src/components/header/header.container.jsx +++ b/client/src/components/header/header.container.jsx @@ -1,46 +1,45 @@ import React from "react"; import "./header.styles.scss"; import { useQuery } from "react-apollo"; -import { - GET_LANDING_NAV_ITEMS, - GET_NAV_ITEMS -} from "../../graphql/metadata.queries"; +// //import { +// GET_LANDING_NAV_ITEMS, +// GET_NAV_ITEMS +// } from "../../graphql/metadata.queries"; import { GET_CURRENT_SELECTED_NAV_ITEM } from "../../graphql/local.queries"; -import LoadingSpinner from "../loading-spinner/loading-spinner.component"; -import AlertComponent from "../alert/alert.component"; +//import LoadingSpinner from "../loading-spinner/loading-spinner.component"; +//import AlertComponent from "../alert/alert.component"; import HeaderComponent from "./header.component"; export default ({ landingHeader, signedIn }) => { const hookSelectedNavItem = useQuery(GET_CURRENT_SELECTED_NAV_ITEM); - let hookNavItems; - if (landingHeader) { - hookNavItems = useQuery(GET_LANDING_NAV_ITEMS, { - fetchPolicy: "network-only" - }); - } else { - hookNavItems = useQuery(GET_NAV_ITEMS, { - fetchPolicy: "network-only" - }); - } + // let hookNavItems; + // if (landingHeader) { + // hookNavItems = useQuery(GET_LANDING_NAV_ITEMS, { + // fetchPolicy: "network-only" + // }); + // } else { + // hookNavItems = useQuery(GET_NAV_ITEMS, { + // fetchPolicy: "network-only" + // }); + // } - if (hookNavItems.loading || hookSelectedNavItem.loading) - return ; - if (hookNavItems.error) - return ; - if (hookSelectedNavItem.error) - return console.log( - "Unable to load Selected Navigation Item.", - hookSelectedNavItem.error - ); + // if (hookNavItems.loading || hookSelectedNavItem.loading) + // return ; + // if (hookNavItems.error) + // return ; + // if (hookSelectedNavItem.error) + // return console.log( + // "Unable to load Selected Navigation Item.", + // hookSelectedNavItem.error + // ); const { selectedNavItem } = hookSelectedNavItem.data; - const navItems = JSON.parse(hookNavItems.data.masterdata_by_pk.value); + // const navItems = JSON.parse(hookNavItems.data.masterdata_by_pk.value); return ( ); diff --git a/client/src/components/jobs-available-new/jobs-available-new.component.jsx b/client/src/components/jobs-available-new/jobs-available-new.component.jsx new file mode 100644 index 000000000..76db9474e --- /dev/null +++ b/client/src/components/jobs-available-new/jobs-available-new.component.jsx @@ -0,0 +1,180 @@ +import { Input, Table, Button, Icon, notification } from "antd"; +import React, { useState } from "react"; +import { useTranslation } from "react-i18next"; +import { alphaSort } from "../../utils/sorters"; +import { DateTimeFormatter } from "../../utils/DateFormatter"; +export default function JobsAvailableComponent({ + loading, + data, + refetch, + deleteJob, + deleteAllNewJobs +}) { + const { t } = useTranslation(); + + const [state, setState] = useState({ + sortedInfo: {}, + filteredInfo: { text: "" } + }); + + const handleTableChange = (pagination, filters, sorter) => { + setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); + }; + + const columns = [ + { + title: t("jobs.fields.cieca_id"), + dataIndex: "cieca_id", + key: "cieca_id", + //width: "8%", + // onFilter: (value, record) => record.ro_number.includes(value), + // filteredValue: state.filteredInfo.text || null, + sorter: (a, b) => alphaSort(a, b), + sortOrder: + state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order + }, + { + title: t("jobs.fields.owner"), + dataIndex: "ownr_name", + key: "ownr_name", + ellipsis: true, + sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln), + //width: "25%", + sortOrder: + state.sortedInfo.columnKey === "ownr_name" && state.sortedInfo.order + }, + { + title: t("jobs.fields.vehicle"), + dataIndex: "vehicle_info", + key: "vehicle_info", + sorter: (a, b) => alphaSort(a.vehicle_info, b.vehicle_info), + sortOrder: + state.sortedInfo.columnKey === "vehicle_info" && state.sortedInfo.order + //ellipsis: true + }, + { + title: t("jobs.fields.clm_no"), + dataIndex: "clm_no", + key: "clm_no", + sorter: (a, b) => alphaSort(a.clm_no, b.clm_no), + sortOrder: + state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order + //width: "12%", + //ellipsis: true + }, + { + title: t("jobs.fields.clm_total"), + dataIndex: "clm_amt", + key: "clm_amt", + sorter: (a, b) => a.clm_amt - b.clm_amt, + sortOrder: + state.sortedInfo.columnKey === "clm_amt" && state.sortedInfo.order + //width: "12%", + //ellipsis: true + }, + { + title: t("jobs.fields.uploaded_by"), + dataIndex: "uploaded_by", + key: "uploaded_by", + sorter: (a, b) => alphaSort(a.uploaded_by, b.uploaded_by), + sortOrder: + state.sortedInfo.columnKey === "uploaded_by" && state.sortedInfo.order + //width: "12%", + //ellipsis: true + }, + { + title: t("jobs.fields.updated_at"), + dataIndex: "updated_at", + key: "updated_at", + sorter: (a, b) => new Date(a.updated_at) - new Date(b.updated_at), + sortOrder: + state.sortedInfo.columnKey === "updated_at" && state.sortedInfo.order, + render: (text, record) => ( + {record.updated_at} + ) + //width: "12%", + //ellipsis: true + }, + { + title: t("general.labels.actions"), + key: "actions", + render: (text, record) => ( + + + + + ) + //width: "12%", + //ellipsis: true + } + ]; + + return ( + { + return ( +
+ { + console.log(value); + }} + enterButton + /> + + +
+ ); + }} + size="small" + pagination={{ position: "top" }} + columns={columns.map(item => ({ ...item }))} + rowKey="id" + dataSource={data && data.available_jobs} + onChange={handleTableChange} + /> + ); +} diff --git a/client/src/components/jobs-available-new/jobs-available-new.container.jsx b/client/src/components/jobs-available-new/jobs-available-new.container.jsx new file mode 100644 index 000000000..7f0de5e68 --- /dev/null +++ b/client/src/components/jobs-available-new/jobs-available-new.container.jsx @@ -0,0 +1,28 @@ +import React from "react"; +import { useQuery, useMutation } from "react-apollo"; +import { + QUERY_AVAILABLE_NEW_JOBS, + DELETE_AVAILABLE_JOB, + DELETE_ALL_AVAILABLE_NEW_JOBS +} from "../../graphql/available-jobs.queries"; +import AlertComponent from "../alert/alert.component"; +import JobsAvailableComponent from "./jobs-available-new.component"; + +export default function JobsAvailableContainer() { + const { loading, error, data, refetch } = useQuery(QUERY_AVAILABLE_NEW_JOBS, { + fetchPolicy: "network-only" + }); + const [deleteJob] = useMutation(DELETE_AVAILABLE_JOB); + const [deleteAllNewJobs] = useMutation(DELETE_ALL_AVAILABLE_NEW_JOBS); + + if (error) return ; + return ( + + ); +} diff --git a/client/src/components/jobs-available-supplement/jobs-available-supplement.component.jsx b/client/src/components/jobs-available-supplement/jobs-available-supplement.component.jsx new file mode 100644 index 000000000..f5e5d9793 --- /dev/null +++ b/client/src/components/jobs-available-supplement/jobs-available-supplement.component.jsx @@ -0,0 +1,192 @@ +import { Input, Table, Button, Icon, notification } from "antd"; +import React, { useState } from "react"; +import { useTranslation } from "react-i18next"; +import { alphaSort } from "../../utils/sorters"; +import { DateTimeFormatter } from "../../utils/DateFormatter"; +export default function JobsAvailableSupplementComponent({ + loading, + data, + refetch, + deleteJob, + deleteAllNewJobs +}) { + const { t } = useTranslation(); + + const [state, setState] = useState({ + sortedInfo: {}, + filteredInfo: { text: "" } + }); + + const handleTableChange = (pagination, filters, sorter) => { + setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); + }; + + const columns = [ + { + title: t("jobs.fields.cieca_id"), + dataIndex: "cieca_id", + key: "cieca_id", + //width: "8%", + // onFilter: (value, record) => record.ro_number.includes(value), + // filteredValue: state.filteredInfo.text || null, + sorter: (a, b) => alphaSort(a, b), + sortOrder: + state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order + }, + { + title: t("jobs.fields.ro_number"), + dataIndex: "job_id", + key: "job_id", + //width: "8%", + // onFilter: (value, record) => record.ro_number.includes(value), + // filteredValue: state.filteredInfo.text || null, + sorter: (a, b) => alphaSort(a, b), + sortOrder: + state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order, + render: (text, record) =>
{record.job && record.job.ro_number}
+ }, + { + title: t("jobs.fields.owner"), + dataIndex: "ownr_name", + key: "ownr_name", + ellipsis: true, + sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln), + //width: "25%", + sortOrder: + state.sortedInfo.columnKey === "ownr_name" && state.sortedInfo.order + }, + { + title: t("jobs.fields.vehicle"), + dataIndex: "vehicle_info", + key: "vehicle_info", + sorter: (a, b) => alphaSort(a.vehicle_info, b.vehicle_info), + sortOrder: + state.sortedInfo.columnKey === "vehicle_info" && state.sortedInfo.order + //ellipsis: true + }, + { + title: t("jobs.fields.clm_no"), + dataIndex: "clm_no", + key: "clm_no", + sorter: (a, b) => alphaSort(a.clm_no, b.clm_no), + sortOrder: + state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order + //width: "12%", + //ellipsis: true + }, + { + title: t("jobs.fields.clm_total"), + dataIndex: "clm_amt", + key: "clm_amt", + sorter: (a, b) => a.clm_amt - b.clm_amt, + sortOrder: + state.sortedInfo.columnKey === "clm_amt" && state.sortedInfo.order + //width: "12%", + //ellipsis: true + }, + { + title: t("jobs.fields.uploaded_by"), + dataIndex: "uploaded_by", + key: "uploaded_by", + sorter: (a, b) => alphaSort(a.uploaded_by, b.uploaded_by), + sortOrder: + state.sortedInfo.columnKey === "uploaded_by" && state.sortedInfo.order + //width: "12%", + //ellipsis: true + }, + { + title: t("jobs.fields.updated_at"), + dataIndex: "updated_at", + key: "updated_at", + sorter: (a, b) => new Date(a.updated_at) - new Date(b.updated_at), + sortOrder: + state.sortedInfo.columnKey === "updated_at" && state.sortedInfo.order, + render: (text, record) => ( + {record.updated_at} + ) + //width: "12%", + //ellipsis: true + }, + { + title: t("general.labels.actions"), + key: "actions", + render: (text, record) => ( + + + + + ) + //width: "12%", + //ellipsis: true + } + ]; + + return ( +
{ + return ( +
+ { + console.log(value); + }} + enterButton + /> + + +
+ ); + }} + size="small" + pagination={{ position: "top" }} + columns={columns.map(item => ({ ...item }))} + rowKey="id" + dataSource={data && data.available_jobs} + onChange={handleTableChange} + /> + ); +} diff --git a/client/src/components/jobs-available-supplement/jobs-available-supplement.container.jsx b/client/src/components/jobs-available-supplement/jobs-available-supplement.container.jsx new file mode 100644 index 000000000..661edbfb0 --- /dev/null +++ b/client/src/components/jobs-available-supplement/jobs-available-supplement.container.jsx @@ -0,0 +1,31 @@ +import React from "react"; +import { useQuery, useMutation } from "react-apollo"; +import { + QUERY_AVAILABLE_SUPPLEMENT_JOBS, + DELETE_AVAILABLE_JOB, + DELETE_ALL_AVAILABLE_SUPPLEMENT_JOBS +} from "../../graphql/available-jobs.queries"; +import AlertComponent from "../alert/alert.component"; +import JobsAvailableSupplementComponent from "./jobs-available-supplement.component"; + +export default function JobsAvailableSupplementContainer() { + const { loading, error, data, refetch } = useQuery( + QUERY_AVAILABLE_SUPPLEMENT_JOBS, + { + fetchPolicy: "network-only" + } + ); + const [deleteJob] = useMutation(DELETE_AVAILABLE_JOB); + const [deleteAllNewJobs] = useMutation(DELETE_ALL_AVAILABLE_SUPPLEMENT_JOBS); + + if (error) return ; + return ( + + ); +} diff --git a/client/src/graphql/available-jobs.queries.js b/client/src/graphql/available-jobs.queries.js new file mode 100644 index 000000000..de5c5469c --- /dev/null +++ b/client/src/graphql/available-jobs.queries.js @@ -0,0 +1,72 @@ +import { gql } from "apollo-boost"; + +export const QUERY_AVAILABLE_NEW_JOBS = gql` + query QUERY_AVAILABLE_NEW_JOBS { + available_jobs( + where: { issupplement: { _eq: false } } + order_by: { updated_at: desc } + ) { + cieca_id + clm_amt + clm_no + created_at + id + issupplement + ownr_name + source_system + supplement_number + updated_at + uploaded_by + vehicle_info + } + } +`; + +export const QUERY_AVAILABLE_SUPPLEMENT_JOBS = gql` + query QUERY_AVAILABLE_SUPPLEMENT_JOBS { + available_jobs( + where: { issupplement: { _eq: true } } + order_by: { updated_at: desc } + ) { + cieca_id + clm_amt + clm_no + created_at + id + issupplement + ownr_name + source_system + supplement_number + updated_at + uploaded_by + vehicle_info + job { + ro_number + } + } + } +`; + +export const DELETE_AVAILABLE_JOB = gql` + mutation DELETE_AVAILABLE_JOB($id: uuid) { + delete_available_jobs(where: { id: { _eq: $id } }) { + affected_rows + } + } +`; + +export const DELETE_ALL_AVAILABLE_NEW_JOBS = gql` + mutation DELETE_ALL_AVAILABLE_NEW_JOBS { + delete_available_jobs(where: { issupplement: { _eq: false } }) { + affected_rows + } + } +`; + +export const DELETE_ALL_AVAILABLE_SUPPLEMENT_JOBS = gql` + mutation DELETE_ALL_AVAILABLE_NEW_JOBS { + delete_available_jobs(where: { issupplement: { _eq: true } }) { + affected_rows + } + } +`; diff --git a/client/src/pages/jobs-available/jobs-available.page.component.jsx b/client/src/pages/jobs-available/jobs-available.page.component.jsx index 9dc5b81fe..7afa216f4 100644 --- a/client/src/pages/jobs-available/jobs-available.page.component.jsx +++ b/client/src/pages/jobs-available/jobs-available.page.component.jsx @@ -1,9 +1,13 @@ -import React from 'react' +import React from "react"; +import JobsAvailableContainer from "../../components/jobs-available-new/jobs-available-new.container"; +import JobsAvailableSupplementContainer from "../../components/jobs-available-supplement/jobs-available-supplement.container"; export default function JobsAvailablePageComponent() { - return ( -
- JobsAvailablePageComponent -
- ) + return ( +
+ + + +
+ ); } diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 7684ebab6..345a74077 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -20,6 +20,7 @@ "reset": "Reset to original." }, "labels": { + "actions": "Actions", "in": "In", "loading": "Loading...", "na": "N/A", @@ -45,6 +46,7 @@ "printCenter": "Print Center" }, "errors": { + "deleted": "Error deleting job.", "noaccess": "This job does not exist or you do not have access to it.", "nodates": "No dates specified for this job.", "nojobselected": "No job is selected.", @@ -59,6 +61,7 @@ "actual_delivery": "Actual Delivery", "actual_in": "Actual In", "adjustment_bottom_line": "Adjustments", + "cieca_id": "CIECA ID", "claim_total": "Claim Total", "clm_no": "Claim #", "clm_total": "Claim Total", @@ -119,6 +122,8 @@ "storage_payable": "Storage/PVRT", "towing_payable": "Towing Payable", "unitnumber": "Unit #", + "updated_at": "Updated At", + "uploaded_by": "Uploaded By", "vehicle": "Vehicle" }, "labels": { @@ -144,7 +149,9 @@ "vehicle_info": "Vehicle" }, "successes": { + "all_deleted": "{{count}} jobs deleted successfully.", "converted": "Job converted successfully.", + "deleted": "Job deleted successfully.", "save": "Record Saved", "savetitle": "Record saved successfully." } diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index a3583f1cc..2a5f5e741 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -20,6 +20,7 @@ "reset": "Restablecer a original." }, "labels": { + "actions": "Comportamiento", "in": "en", "loading": "Cargando...", "na": "N / A", @@ -45,6 +46,7 @@ "printCenter": "Centro de impresión" }, "errors": { + "deleted": "Error al eliminar el trabajo.", "noaccess": "Este trabajo no existe o no tiene acceso a él.", "nodates": "No hay fechas especificadas para este trabajo.", "nojobselected": "No hay trabajo seleccionado.", @@ -59,6 +61,7 @@ "actual_delivery": "Entrega real", "actual_in": "Real en", "adjustment_bottom_line": "Ajustes", + "cieca_id": "CIECA ID", "claim_total": "Reclamar total", "clm_no": "Reclamación #", "clm_total": "Reclamar total", @@ -119,6 +122,8 @@ "storage_payable": "Almacenamiento / PVRT", "towing_payable": "Remolque a pagar", "unitnumber": "Unidad #", + "updated_at": "Actualizado en", + "uploaded_by": "Subido por", "vehicle": "Vehículo" }, "labels": { @@ -144,7 +149,9 @@ "vehicle_info": "Vehículo" }, "successes": { + "all_deleted": "{{count}} trabajos eliminados con éxito.", "converted": "Trabajo convertido con éxito.", + "deleted": "Trabajo eliminado con éxito.", "save": "Registro guardado", "savetitle": "Registro guardado con éxito." } diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 1dc6386ef..48558307f 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -20,6 +20,7 @@ "reset": "Rétablir l'original." }, "labels": { + "actions": "actes", "in": "dans", "loading": "Chargement...", "na": "N / A", @@ -45,6 +46,7 @@ "printCenter": "Centre d'impression" }, "errors": { + "deleted": "Erreur lors de la suppression du travail.", "noaccess": "Ce travail n'existe pas ou vous n'y avez pas accès.", "nodates": "Aucune date spécifiée pour ce travail.", "nojobselected": "Aucun travail n'est sélectionné.", @@ -59,6 +61,7 @@ "actual_delivery": "Livraison réelle", "actual_in": "En réel", "adjustment_bottom_line": "Ajustements", + "cieca_id": "CIECA ID", "claim_total": "Total réclamation", "clm_no": "Prétendre #", "clm_total": "Total réclamation", @@ -119,6 +122,8 @@ "storage_payable": "Stockage / PVRT", "towing_payable": "Remorquage à payer", "unitnumber": "Unité #", + "updated_at": "Mis à jour à", + "uploaded_by": "Telechargé par", "vehicle": "Véhicule" }, "labels": { @@ -144,7 +149,9 @@ "vehicle_info": "Véhicule" }, "successes": { + "all_deleted": "{{count}} travaux supprimés avec succès.", "converted": "Travail converti avec succès.", + "deleted": "Le travail a bien été supprimé.", "save": "Enregistrement enregistré", "savetitle": "Enregistrement enregistré avec succès." } diff --git a/client/src/utils/DateFormatter.jsx b/client/src/utils/DateFormatter.jsx new file mode 100644 index 000000000..4d860662d --- /dev/null +++ b/client/src/utils/DateFormatter.jsx @@ -0,0 +1,10 @@ +import React from "react"; +import Moment from "react-moment"; + +export function DateFormatter(props) { + return {props.children || ""}; +} + +export function DateTimeFormatter(props) { + return {props.children || ""}; +} diff --git a/hasura/migrations/1580237327073_create_table_public_available_jobs/down.yaml b/hasura/migrations/1580237327073_create_table_public_available_jobs/down.yaml new file mode 100644 index 000000000..06b5056e9 --- /dev/null +++ b/hasura/migrations/1580237327073_create_table_public_available_jobs/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: DROP TABLE "public"."available_jobs" + type: run_sql diff --git a/hasura/migrations/1580237327073_create_table_public_available_jobs/up.yaml b/hasura/migrations/1580237327073_create_table_public_available_jobs/up.yaml new file mode 100644 index 000000000..d75401021 --- /dev/null +++ b/hasura/migrations/1580237327073_create_table_public_available_jobs/up.yaml @@ -0,0 +1,25 @@ +- args: + sql: CREATE EXTENSION IF NOT EXISTS pgcrypto; + type: run_sql +- args: + sql: "CREATE TABLE \"public\".\"available_jobs\"(\"id\" uuid NOT NULL DEFAULT + gen_random_uuid(), \"created_at\" timestamptz NOT NULL DEFAULT now(), \"updated_at\" + timestamptz NOT NULL DEFAULT now(), \"uploaded_by\" text NOT NULL, \"cieca_id\" + text NOT NULL, \"bodyshopid\" uuid NOT NULL, \"est_data\" jsonb NOT NULL, \"issupplement\" + boolean NOT NULL DEFAULT false, \"jobid\" uuid, \"supplement_number\" integer, + \"ownr_name\" text, \"vehicle_info\" text, \"clm_amt\" numeric, \"clm_no\" text, + \"source_system\" text, PRIMARY KEY (\"id\") , FOREIGN KEY (\"bodyshopid\") + REFERENCES \"public\".\"bodyshops\"(\"id\") ON UPDATE cascade ON DELETE cascade, + FOREIGN KEY (\"jobid\") REFERENCES \"public\".\"jobs\"(\"id\") ON UPDATE restrict + ON DELETE cascade);\nCREATE OR REPLACE FUNCTION \"public\".\"set_current_timestamp_updated_at\"()\nRETURNS + TRIGGER AS $$\nDECLARE\n _new record;\nBEGIN\n _new := NEW;\n _new.\"updated_at\" + = NOW();\n RETURN _new;\nEND;\n$$ LANGUAGE plpgsql;\nCREATE TRIGGER \"set_public_available_jobs_updated_at\"\nBEFORE + UPDATE ON \"public\".\"available_jobs\"\nFOR EACH ROW\nEXECUTE PROCEDURE \"public\".\"set_current_timestamp_updated_at\"();\nCOMMENT + ON TRIGGER \"set_public_available_jobs_updated_at\" ON \"public\".\"available_jobs\" + \nIS 'trigger to set value of column \"updated_at\" to current timestamp on + row update';\n" + type: run_sql +- args: + name: available_jobs + schema: public + type: add_existing_table_or_view diff --git a/hasura/migrations/1580237346108_track_all_relationships/down.yaml b/hasura/migrations/1580237346108_track_all_relationships/down.yaml new file mode 100644 index 000000000..d0e83782e --- /dev/null +++ b/hasura/migrations/1580237346108_track_all_relationships/down.yaml @@ -0,0 +1,24 @@ +- args: + relationship: bodyshop + table: + name: available_jobs + schema: public + type: drop_relationship +- args: + relationship: job + table: + name: available_jobs + schema: public + type: drop_relationship +- args: + relationship: available_jobs + table: + name: bodyshops + schema: public + type: drop_relationship +- args: + relationship: available_jobs + table: + name: jobs + schema: public + type: drop_relationship diff --git a/hasura/migrations/1580237346108_track_all_relationships/up.yaml b/hasura/migrations/1580237346108_track_all_relationships/up.yaml new file mode 100644 index 000000000..5f0bb6804 --- /dev/null +++ b/hasura/migrations/1580237346108_track_all_relationships/up.yaml @@ -0,0 +1,40 @@ +- args: + name: bodyshop + table: + name: available_jobs + schema: public + using: + foreign_key_constraint_on: bodyshopid + type: create_object_relationship +- args: + name: job + table: + name: available_jobs + schema: public + using: + foreign_key_constraint_on: jobid + type: create_object_relationship +- args: + name: available_jobs + table: + name: bodyshops + schema: public + using: + foreign_key_constraint_on: + column: bodyshopid + table: + name: available_jobs + schema: public + type: create_array_relationship +- args: + name: available_jobs + table: + name: jobs + schema: public + using: + foreign_key_constraint_on: + column: jobid + table: + name: available_jobs + schema: public + type: create_array_relationship diff --git a/hasura/migrations/1580237387921_update_permission_user_public_table_available_jobs/down.yaml b/hasura/migrations/1580237387921_update_permission_user_public_table_available_jobs/down.yaml new file mode 100644 index 000000000..5cdb25469 --- /dev/null +++ b/hasura/migrations/1580237387921_update_permission_user_public_table_available_jobs/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: available_jobs + schema: public + type: drop_insert_permission diff --git a/hasura/migrations/1580237387921_update_permission_user_public_table_available_jobs/up.yaml b/hasura/migrations/1580237387921_update_permission_user_public_table_available_jobs/up.yaml new file mode 100644 index 000000000..6d55f1a31 --- /dev/null +++ b/hasura/migrations/1580237387921_update_permission_user_public_table_available_jobs/up.yaml @@ -0,0 +1,37 @@ +- args: + permission: + allow_upsert: true + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - uploaded_by + - cieca_id + - bodyshopid + - est_data + - issupplement + - jobid + - supplement_number + - ownr_name + - vehicle_info + - clm_amt + - clm_no + - source_system + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: available_jobs + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1580237392798_update_permission_user_public_table_available_jobs/down.yaml b/hasura/migrations/1580237392798_update_permission_user_public_table_available_jobs/down.yaml new file mode 100644 index 000000000..3a94b077d --- /dev/null +++ b/hasura/migrations/1580237392798_update_permission_user_public_table_available_jobs/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: available_jobs + schema: public + type: drop_select_permission diff --git a/hasura/migrations/1580237392798_update_permission_user_public_table_available_jobs/up.yaml b/hasura/migrations/1580237392798_update_permission_user_public_table_available_jobs/up.yaml new file mode 100644 index 000000000..d3b07cbf7 --- /dev/null +++ b/hasura/migrations/1580237392798_update_permission_user_public_table_available_jobs/up.yaml @@ -0,0 +1,34 @@ +- args: + permission: + allow_aggregations: false + columns: + - issupplement + - supplement_number + - est_data + - clm_amt + - cieca_id + - clm_no + - ownr_name + - source_system + - uploaded_by + - vehicle_info + - created_at + - updated_at + - bodyshopid + - id + - jobid + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + limit: null + role: user + table: + name: available_jobs + schema: public + type: create_select_permission diff --git a/hasura/migrations/1580237398522_update_permission_user_public_table_available_jobs/down.yaml b/hasura/migrations/1580237398522_update_permission_user_public_table_available_jobs/down.yaml new file mode 100644 index 000000000..d0f2b05b4 --- /dev/null +++ b/hasura/migrations/1580237398522_update_permission_user_public_table_available_jobs/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: available_jobs + schema: public + type: drop_update_permission diff --git a/hasura/migrations/1580237398522_update_permission_user_public_table_available_jobs/up.yaml b/hasura/migrations/1580237398522_update_permission_user_public_table_available_jobs/up.yaml new file mode 100644 index 000000000..cf6c14ee3 --- /dev/null +++ b/hasura/migrations/1580237398522_update_permission_user_public_table_available_jobs/up.yaml @@ -0,0 +1,21 @@ +- args: + permission: + columns: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: available_jobs + schema: public + type: create_update_permission diff --git a/hasura/migrations/1580237406816_update_permission_user_public_table_available_jobs/down.yaml b/hasura/migrations/1580237406816_update_permission_user_public_table_available_jobs/down.yaml new file mode 100644 index 000000000..610466236 --- /dev/null +++ b/hasura/migrations/1580237406816_update_permission_user_public_table_available_jobs/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: available_jobs + schema: public + type: drop_delete_permission diff --git a/hasura/migrations/1580237406816_update_permission_user_public_table_available_jobs/up.yaml b/hasura/migrations/1580237406816_update_permission_user_public_table_available_jobs/up.yaml new file mode 100644 index 000000000..76e638642 --- /dev/null +++ b/hasura/migrations/1580237406816_update_permission_user_public_table_available_jobs/up.yaml @@ -0,0 +1,16 @@ +- args: + permission: + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: available_jobs + schema: public + type: create_delete_permission