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 index 589cb40f1..b18b21546 100644 --- a/client/src/components/jobs-available-supplement/jobs-available-supplement.component.jsx +++ b/client/src/components/jobs-available-supplement/jobs-available-supplement.component.jsx @@ -1,4 +1,8 @@ -import { DeleteFilled, PlusCircleFilled, SyncOutlined } from "@ant-design/icons"; +import { + DeleteFilled, + PlusCircleFilled, + SyncOutlined, +} from "@ant-design/icons"; import { Button, notification, Table } from "antd"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; @@ -22,13 +26,13 @@ export default function JobsAvailableSupplementComponent({ deleteAllNewJobs, loadEstData, estData, - importOptionsState + importOptionsState, }) { const { t } = useTranslation(); const [state, setState] = useState({ sortedInfo: {}, - filteredInfo: { text: "" } + filteredInfo: { text: "" }, }); const handleTableChange = (pagination, filters, sorter) => { @@ -45,7 +49,7 @@ export default function JobsAvailableSupplementComponent({ // filteredValue: state.filteredInfo.text || null, sorter: (a, b) => alphaSort(a, b), sortOrder: - state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order + state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order, }, { title: t("jobs.fields.ro_number"), @@ -57,7 +61,7 @@ export default function JobsAvailableSupplementComponent({ sorter: (a, b) => alphaSort(a, b), sortOrder: state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order, - render: (text, record) =>
{record.job && record.job.ro_number}
+ render: (text, record) =>
{record.job && record.job.ro_number}
, }, { title: t("jobs.fields.owner"), @@ -67,7 +71,7 @@ export default function JobsAvailableSupplementComponent({ sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln), //width: "25%", sortOrder: - state.sortedInfo.columnKey === "ownr_name" && state.sortedInfo.order + state.sortedInfo.columnKey === "ownr_name" && state.sortedInfo.order, }, { title: t("jobs.fields.vehicle"), @@ -75,7 +79,7 @@ export default function JobsAvailableSupplementComponent({ key: "vehicle_info", sorter: (a, b) => alphaSort(a.vehicle_info, b.vehicle_info), sortOrder: - state.sortedInfo.columnKey === "vehicle_info" && state.sortedInfo.order + state.sortedInfo.columnKey === "vehicle_info" && state.sortedInfo.order, //ellipsis: true }, { @@ -84,7 +88,7 @@ export default function JobsAvailableSupplementComponent({ key: "clm_no", sorter: (a, b) => alphaSort(a.clm_no, b.clm_no), sortOrder: - state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order + state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order, //width: "12%", //ellipsis: true }, @@ -97,7 +101,7 @@ export default function JobsAvailableSupplementComponent({ state.sortedInfo.columnKey === "clm_amt" && state.sortedInfo.order, render: (text, record) => ( {record.clm_amt} - ) + ), //width: "12%", //ellipsis: true }, @@ -107,7 +111,7 @@ export default function JobsAvailableSupplementComponent({ key: "uploaded_by", sorter: (a, b) => alphaSort(a.uploaded_by, b.uploaded_by), sortOrder: - state.sortedInfo.columnKey === "uploaded_by" && state.sortedInfo.order + state.sortedInfo.columnKey === "uploaded_by" && state.sortedInfo.order, //width: "12%", //ellipsis: true }, @@ -120,7 +124,7 @@ export default function JobsAvailableSupplementComponent({ state.sortedInfo.columnKey === "updated_at" && state.sortedInfo.order, render: (text, record) => ( {record.updated_at} - ) + ), //width: "12%", //ellipsis: true }, @@ -131,31 +135,46 @@ export default function JobsAvailableSupplementComponent({ - ) + ), //width: "12%", //ellipsis: true - } + }, ]; + const handleDeleteAll = () => { + deleteAllNewJobs() + .then((r) => { + notification["success"]({ + message: t("jobs.successes.all_deleted", { + count: r.data.delete_available_jobs.affected_rows, + }), + }); + refetch(); + }) + .catch((r) => { + notification["error"]({ + message: t("jobs.errors.deleted") + " " + r.message, + }); + }); + }; + return (
{ refetch(); - }} - > + }}> - +
); }} - size="small" + size='small' pagination={{ position: "top" }} - columns={columns.map(item => ({ ...item }))} - rowKey="id" + columns={columns} + 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 index a341f920f..d84157583 100644 --- a/client/src/components/jobs-available-supplement/jobs-available-supplement.container.jsx +++ b/client/src/components/jobs-available-supplement/jobs-available-supplement.container.jsx @@ -1,4 +1,4 @@ -import { useMutation, useQuery } from "@apollo/react-hooks"; +import { useMutation, useQuery, useApolloClient } from "@apollo/react-hooks"; import { notification } from "antd"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; @@ -6,13 +6,18 @@ import { connect } from "react-redux"; import { useHistory } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { CalculateJob } from "../../components/job-totals-table/job-totals.utility"; -import { DELETE_ALL_AVAILABLE_SUPPLEMENT_JOBS, QUERY_AVAILABLE_SUPPLEMENT_JOBS } from "../../graphql/available-jobs.queries"; +import { + DELETE_ALL_AVAILABLE_SUPPLEMENT_JOBS, + QUERY_AVAILABLE_SUPPLEMENT_JOBS, +} from "../../graphql/available-jobs.queries"; import { UPDATE_JOB } from "../../graphql/jobs.queries"; import { selectBodyshop } from "../../redux/user/user.selectors"; import AlertComponent from "../alert/alert.component"; import LoadingSpinner from "../loading-spinner/loading-spinner.component"; import JobsAvailableSupplementComponent from "./jobs-available-supplement.component"; import HeaderFields from "./jobs-available-supplement.headerfields"; +import { GetSupplementDelta } from "./jobs-available-supplement.estlines.util"; +import { gql } from "apollo-boost"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -31,6 +36,7 @@ export function JobsAvailableSupplementContainer({ ); const { t } = useTranslation(); const history = useHistory(); + const client = useApolloClient(); const [deleteAllNewJobs] = useMutation(DELETE_ALL_AVAILABLE_SUPPLEMENT_JOBS); const [modalVisible, setModalVisible] = useState(false); @@ -40,7 +46,8 @@ export function JobsAvailableSupplementContainer({ const [loadEstData, estData] = estDataLazyLoad; const importOptionsState = useState({ overrideHeaders: false }); const importOptions = importOptionsState[0]; - const onModalOk = () => { + + const onModalOk = async () => { setModalVisible(false); setInsertLoading(true); @@ -61,10 +68,8 @@ export function JobsAvailableSupplementContainer({ let supp = estData.data.available_jobs_by_pk.est_data; console.log("supp before", supp); - //TODO How to update the estimate lines. delete supp.owner; delete supp.vehicle; - if (importOptions.overrideHeaders) { HeaderFields.forEach((item) => delete supp[item]); } @@ -77,8 +82,19 @@ export function JobsAvailableSupplementContainer({ bodyshop.shoprates ); - console.log('newTotals', newTotals) + let suppDelta = await GetSupplementDelta( + client, + selectedJob, + estData.data.available_jobs_by_pk.est_data.joblines.data + ); + console.log("onModalOk -> suppDelta", suppDelta); + delete supp.joblines; + await client.mutate({ + mutation: gql` + ${suppDelta} + `, + }); updateJob({ variables: { jobId: selectedJob, @@ -123,12 +139,11 @@ export function JobsAvailableSupplementContainer({ setSelectedJob(null); }; - if (error) return ; + if (error) return ; return ( + message={t("jobs.labels.creating_new_job")}> { + console.log("-----Begin Supplement-----"); + console.log("Supplement delta for jobId", jobId); + console.log("New Lines", newLines); + + const { + data: { joblines: existingLines }, + } = await client.query({ + query: GET_JOB_LINES_BY_PK, + variables: { id: jobId }, + }); + + const linesToInsert = []; + const linesToUpdate = []; + + newLines.forEach((newLine) => { + const matchingIndex = existingLines.findIndex( + (eL) => eL.unq_seq === newLine.unq_seq + ); + if (matchingIndex >= 0) { + //Found a relevant matching line. Add it to lines to update. + linesToUpdate.push({ + id: existingLines[matchingIndex].id, + newData: newLine, + }); + + //Splice out item we found for performance. + existingLines.splice(matchingIndex, 1); + } else { + //Didn't find a match. Must be a new line. + linesToInsert.push(newLine); + } + }); + + //Wahtever is left in the existing lines, are lines that should be removed. + + const insertQueries = linesToInsert.reduce((acc, value, idx) => { + return acc + generateInsertQuery(value, idx, jobId); + }, ""); + + const updateQueries = linesToUpdate.reduce((acc, value, idx) => { + return acc + generateUpdateQuery(value, idx); + }, ""); + + const removeQueries = existingLines.reduce((acc, value, idx) => { + return acc + generateRemoveQuery(value, idx); + }, ""); + + return new Promise((resolve, reject) => { + resolve(gql` + mutation SUPPLEMENT_EST_LINES{ + ${insertQueries + updateQueries + removeQueries} + } + `); + }); +}; + +const generateInsertQuery = (lineToInsert, index, jobId) => { + lineToInsert.jobid = jobId; + return ` + insert_joblines${index}: insert_joblines(objects: ${JSON.stringify( + lineToInsert + ).replace(/"(\w+)"\s*:/g, "$1:")}) { + returning { + id + } + }`; +}; + +const generateUpdateQuery = (lineToUpdate, index) => { + return ` + update_joblines${index}: update_joblines(where: { id: { _eq: "${ + lineToUpdate.id + }" } }, _set: ${JSON.stringify(lineToUpdate.newData).replace( + /"(\w+)"\s*:/g, + "$1:" + )}) { + returning { + id + } + }`; +}; + +const generateRemoveQuery = (lineToRemove, index) => { + return ` + update_joblines_r${index}: update_joblines(where: {id: {_eq: "${lineToRemove.id}"}}, _set: {removed: true}) { + returning{ + id + } + }`; +}; diff --git a/client/src/graphql/jobs-lines.queries.js b/client/src/graphql/jobs-lines.queries.js index e07ffe7e8..daf8f5dad 100644 --- a/client/src/graphql/jobs-lines.queries.js +++ b/client/src/graphql/jobs-lines.queries.js @@ -2,8 +2,9 @@ import { gql } from "apollo-boost"; export const GET_JOB_LINES_BY_PK = gql` query GET_JOB_LINES_BY_PK($id: uuid!) { - joblines(where: { jobid: { _eq: $id } }, order_by: { unq_seq: asc }) { + joblines(where: { jobid: { _eq: $id } }, order_by: { line_no: asc }) { id + line_no unq_seq line_ind line_desc diff --git a/hasura/migrations/1587662612682_alter_table_public_joblines_add_column_removed/down.yaml b/hasura/migrations/1587662612682_alter_table_public_joblines_add_column_removed/down.yaml new file mode 100644 index 000000000..c7e3cffdb --- /dev/null +++ b/hasura/migrations/1587662612682_alter_table_public_joblines_add_column_removed/down.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."joblines" DROP COLUMN "removed"; + type: run_sql diff --git a/hasura/migrations/1587662612682_alter_table_public_joblines_add_column_removed/up.yaml b/hasura/migrations/1587662612682_alter_table_public_joblines_add_column_removed/up.yaml new file mode 100644 index 000000000..708dec3bc --- /dev/null +++ b/hasura/migrations/1587662612682_alter_table_public_joblines_add_column_removed/up.yaml @@ -0,0 +1,6 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."joblines" ADD COLUMN "removed" boolean NOT NULL DEFAULT + false; + type: run_sql diff --git a/hasura/migrations/1587662623164_update_permission_user_public_table_joblines/down.yaml b/hasura/migrations/1587662623164_update_permission_user_public_table_joblines/down.yaml new file mode 100644 index 000000000..df8b59464 --- /dev/null +++ b/hasura/migrations/1587662623164_update_permission_user_public_table_joblines/down.yaml @@ -0,0 +1,76 @@ +- args: + role: user + table: + name: joblines + schema: public + type: drop_insert_permission +- args: + permission: + check: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - jobid + - unq_seq + - line_ind + - line_desc + - part_type + - oem_partno + - est_seq + - db_ref + - line_ref + - tax_part + - db_price + - act_price + - part_qty + - alt_partno + - mod_lbr_ty + - db_hrs + - mod_lb_hrs + - lbr_op + - lbr_amt + - glass_flag + - price_inc + - alt_part_i + - price_j + - cert_part + - alt_co_id + - alt_overrd + - alt_partm + - prt_dsmk_p + - prt_dsmk_m + - lbr_inc + - lbr_hrs_j + - lbr_typ_j + - lbr_op_j + - paint_stg + - paint_tone + - lbr_tax + - misc_amt + - misc_sublt + - misc_tax + - bett_type + - bett_pctg + - bett_amt + - bett_tax + - op_code_desc + - status + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: joblines + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1587662623164_update_permission_user_public_table_joblines/up.yaml b/hasura/migrations/1587662623164_update_permission_user_public_table_joblines/up.yaml new file mode 100644 index 000000000..b538e5cd6 --- /dev/null +++ b/hasura/migrations/1587662623164_update_permission_user_public_table_joblines/up.yaml @@ -0,0 +1,77 @@ +- args: + role: user + table: + name: joblines + schema: public + type: drop_insert_permission +- args: + permission: + check: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - act_price + - alt_co_id + - alt_overrd + - alt_part_i + - alt_partm + - alt_partno + - bett_amt + - bett_pctg + - bett_tax + - bett_type + - cert_part + - created_at + - db_hrs + - db_price + - db_ref + - est_seq + - glass_flag + - id + - jobid + - lbr_amt + - lbr_hrs_j + - lbr_inc + - lbr_op + - lbr_op_j + - lbr_tax + - lbr_typ_j + - line_desc + - line_ind + - line_ref + - misc_amt + - misc_sublt + - misc_tax + - mod_lb_hrs + - mod_lbr_ty + - oem_partno + - op_code_desc + - paint_stg + - paint_tone + - part_qty + - part_type + - price_inc + - price_j + - prt_dsmk_m + - prt_dsmk_p + - removed + - status + - tax_part + - unq_seq + - updated_at + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: joblines + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1587662633919_update_permission_user_public_table_joblines/down.yaml b/hasura/migrations/1587662633919_update_permission_user_public_table_joblines/down.yaml new file mode 100644 index 000000000..317c3b0d8 --- /dev/null +++ b/hasura/migrations/1587662633919_update_permission_user_public_table_joblines/down.yaml @@ -0,0 +1,74 @@ +- args: + role: user + table: + name: joblines + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: true + columns: + - alt_overrd + - alt_part_i + - bett_tax + - cert_part + - glass_flag + - lbr_hrs_j + - lbr_inc + - lbr_op_j + - lbr_tax + - lbr_typ_j + - misc_sublt + - misc_tax + - price_inc + - price_j + - tax_part + - est_seq + - paint_stg + - paint_tone + - part_qty + - unq_seq + - act_price + - bett_amt + - bett_pctg + - db_hrs + - db_price + - lbr_amt + - line_ref + - misc_amt + - mod_lb_hrs + - prt_dsmk_m + - prt_dsmk_p + - alt_co_id + - alt_partm + - alt_partno + - bett_type + - db_ref + - lbr_op + - line_desc + - line_ind + - mod_lbr_ty + - oem_partno + - op_code_desc + - part_type + - status + - created_at + - updated_at + - id + - jobid + computed_fields: [] + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: joblines + schema: public + type: create_select_permission diff --git a/hasura/migrations/1587662633919_update_permission_user_public_table_joblines/up.yaml b/hasura/migrations/1587662633919_update_permission_user_public_table_joblines/up.yaml new file mode 100644 index 000000000..38bb4c509 --- /dev/null +++ b/hasura/migrations/1587662633919_update_permission_user_public_table_joblines/up.yaml @@ -0,0 +1,75 @@ +- args: + role: user + table: + name: joblines + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: true + columns: + - act_price + - alt_co_id + - alt_overrd + - alt_part_i + - alt_partm + - alt_partno + - bett_amt + - bett_pctg + - bett_tax + - bett_type + - cert_part + - created_at + - db_hrs + - db_price + - db_ref + - est_seq + - glass_flag + - id + - jobid + - lbr_amt + - lbr_hrs_j + - lbr_inc + - lbr_op + - lbr_op_j + - lbr_tax + - lbr_typ_j + - line_desc + - line_ind + - line_ref + - misc_amt + - misc_sublt + - misc_tax + - mod_lb_hrs + - mod_lbr_ty + - oem_partno + - op_code_desc + - paint_stg + - paint_tone + - part_qty + - part_type + - price_inc + - price_j + - prt_dsmk_m + - prt_dsmk_p + - removed + - status + - tax_part + - unq_seq + - updated_at + computed_fields: [] + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: joblines + schema: public + type: create_select_permission diff --git a/hasura/migrations/1587662641941_update_permission_user_public_table_joblines/down.yaml b/hasura/migrations/1587662641941_update_permission_user_public_table_joblines/down.yaml new file mode 100644 index 000000000..a04baffe3 --- /dev/null +++ b/hasura/migrations/1587662641941_update_permission_user_public_table_joblines/down.yaml @@ -0,0 +1,76 @@ +- args: + role: user + table: + name: joblines + schema: public + type: drop_update_permission +- args: + permission: + columns: + - alt_overrd + - alt_part_i + - bett_tax + - cert_part + - glass_flag + - lbr_hrs_j + - lbr_inc + - lbr_op_j + - lbr_tax + - lbr_typ_j + - misc_sublt + - misc_tax + - price_inc + - price_j + - tax_part + - est_seq + - paint_stg + - paint_tone + - part_qty + - unq_seq + - act_price + - bett_amt + - bett_pctg + - db_hrs + - db_price + - lbr_amt + - line_ref + - misc_amt + - mod_lb_hrs + - prt_dsmk_m + - prt_dsmk_p + - alt_co_id + - alt_partm + - alt_partno + - bett_type + - db_ref + - lbr_op + - line_desc + - line_ind + - mod_lbr_ty + - oem_partno + - op_code_desc + - part_type + - status + - created_at + - updated_at + - id + - jobid + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: joblines + schema: public + type: create_update_permission diff --git a/hasura/migrations/1587662641941_update_permission_user_public_table_joblines/up.yaml b/hasura/migrations/1587662641941_update_permission_user_public_table_joblines/up.yaml new file mode 100644 index 000000000..179d1c4d2 --- /dev/null +++ b/hasura/migrations/1587662641941_update_permission_user_public_table_joblines/up.yaml @@ -0,0 +1,77 @@ +- args: + role: user + table: + name: joblines + schema: public + type: drop_update_permission +- args: + permission: + columns: + - act_price + - alt_co_id + - alt_overrd + - alt_part_i + - alt_partm + - alt_partno + - bett_amt + - bett_pctg + - bett_tax + - bett_type + - cert_part + - created_at + - db_hrs + - db_price + - db_ref + - est_seq + - glass_flag + - id + - jobid + - lbr_amt + - lbr_hrs_j + - lbr_inc + - lbr_op + - lbr_op_j + - lbr_tax + - lbr_typ_j + - line_desc + - line_ind + - line_ref + - misc_amt + - misc_sublt + - misc_tax + - mod_lb_hrs + - mod_lbr_ty + - oem_partno + - op_code_desc + - paint_stg + - paint_tone + - part_qty + - part_type + - price_inc + - price_j + - prt_dsmk_m + - prt_dsmk_p + - removed + - status + - tax_part + - unq_seq + - updated_at + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: joblines + schema: public + type: create_update_permission diff --git a/hasura/migrations/1587663736545_alter_table_public_joblines_add_column_line_no/down.yaml b/hasura/migrations/1587663736545_alter_table_public_joblines_add_column_line_no/down.yaml new file mode 100644 index 000000000..d5935b182 --- /dev/null +++ b/hasura/migrations/1587663736545_alter_table_public_joblines_add_column_line_no/down.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."joblines" DROP COLUMN "line_no"; + type: run_sql diff --git a/hasura/migrations/1587663736545_alter_table_public_joblines_add_column_line_no/up.yaml b/hasura/migrations/1587663736545_alter_table_public_joblines_add_column_line_no/up.yaml new file mode 100644 index 000000000..c1ab9a269 --- /dev/null +++ b/hasura/migrations/1587663736545_alter_table_public_joblines_add_column_line_no/up.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."joblines" ADD COLUMN "line_no" integer NULL; + type: run_sql diff --git a/hasura/migrations/1587663746281_update_permission_user_public_table_joblines/down.yaml b/hasura/migrations/1587663746281_update_permission_user_public_table_joblines/down.yaml new file mode 100644 index 000000000..b538e5cd6 --- /dev/null +++ b/hasura/migrations/1587663746281_update_permission_user_public_table_joblines/down.yaml @@ -0,0 +1,77 @@ +- args: + role: user + table: + name: joblines + schema: public + type: drop_insert_permission +- args: + permission: + check: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - act_price + - alt_co_id + - alt_overrd + - alt_part_i + - alt_partm + - alt_partno + - bett_amt + - bett_pctg + - bett_tax + - bett_type + - cert_part + - created_at + - db_hrs + - db_price + - db_ref + - est_seq + - glass_flag + - id + - jobid + - lbr_amt + - lbr_hrs_j + - lbr_inc + - lbr_op + - lbr_op_j + - lbr_tax + - lbr_typ_j + - line_desc + - line_ind + - line_ref + - misc_amt + - misc_sublt + - misc_tax + - mod_lb_hrs + - mod_lbr_ty + - oem_partno + - op_code_desc + - paint_stg + - paint_tone + - part_qty + - part_type + - price_inc + - price_j + - prt_dsmk_m + - prt_dsmk_p + - removed + - status + - tax_part + - unq_seq + - updated_at + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: joblines + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1587663746281_update_permission_user_public_table_joblines/up.yaml b/hasura/migrations/1587663746281_update_permission_user_public_table_joblines/up.yaml new file mode 100644 index 000000000..7e1e53880 --- /dev/null +++ b/hasura/migrations/1587663746281_update_permission_user_public_table_joblines/up.yaml @@ -0,0 +1,78 @@ +- args: + role: user + table: + name: joblines + schema: public + type: drop_insert_permission +- args: + permission: + check: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - act_price + - alt_co_id + - alt_overrd + - alt_part_i + - alt_partm + - alt_partno + - bett_amt + - bett_pctg + - bett_tax + - bett_type + - cert_part + - created_at + - db_hrs + - db_price + - db_ref + - est_seq + - glass_flag + - id + - jobid + - lbr_amt + - lbr_hrs_j + - lbr_inc + - lbr_op + - lbr_op_j + - lbr_tax + - lbr_typ_j + - line_desc + - line_ind + - line_no + - line_ref + - misc_amt + - misc_sublt + - misc_tax + - mod_lb_hrs + - mod_lbr_ty + - oem_partno + - op_code_desc + - paint_stg + - paint_tone + - part_qty + - part_type + - price_inc + - price_j + - prt_dsmk_m + - prt_dsmk_p + - removed + - status + - tax_part + - unq_seq + - updated_at + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: joblines + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1587663753304_update_permission_user_public_table_joblines/down.yaml b/hasura/migrations/1587663753304_update_permission_user_public_table_joblines/down.yaml new file mode 100644 index 000000000..38bb4c509 --- /dev/null +++ b/hasura/migrations/1587663753304_update_permission_user_public_table_joblines/down.yaml @@ -0,0 +1,75 @@ +- args: + role: user + table: + name: joblines + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: true + columns: + - act_price + - alt_co_id + - alt_overrd + - alt_part_i + - alt_partm + - alt_partno + - bett_amt + - bett_pctg + - bett_tax + - bett_type + - cert_part + - created_at + - db_hrs + - db_price + - db_ref + - est_seq + - glass_flag + - id + - jobid + - lbr_amt + - lbr_hrs_j + - lbr_inc + - lbr_op + - lbr_op_j + - lbr_tax + - lbr_typ_j + - line_desc + - line_ind + - line_ref + - misc_amt + - misc_sublt + - misc_tax + - mod_lb_hrs + - mod_lbr_ty + - oem_partno + - op_code_desc + - paint_stg + - paint_tone + - part_qty + - part_type + - price_inc + - price_j + - prt_dsmk_m + - prt_dsmk_p + - removed + - status + - tax_part + - unq_seq + - updated_at + computed_fields: [] + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: joblines + schema: public + type: create_select_permission diff --git a/hasura/migrations/1587663753304_update_permission_user_public_table_joblines/up.yaml b/hasura/migrations/1587663753304_update_permission_user_public_table_joblines/up.yaml new file mode 100644 index 000000000..ce9b320bc --- /dev/null +++ b/hasura/migrations/1587663753304_update_permission_user_public_table_joblines/up.yaml @@ -0,0 +1,76 @@ +- args: + role: user + table: + name: joblines + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: true + columns: + - act_price + - alt_co_id + - alt_overrd + - alt_part_i + - alt_partm + - alt_partno + - bett_amt + - bett_pctg + - bett_tax + - bett_type + - cert_part + - created_at + - db_hrs + - db_price + - db_ref + - est_seq + - glass_flag + - id + - jobid + - lbr_amt + - lbr_hrs_j + - lbr_inc + - lbr_op + - lbr_op_j + - lbr_tax + - lbr_typ_j + - line_desc + - line_ind + - line_no + - line_ref + - misc_amt + - misc_sublt + - misc_tax + - mod_lb_hrs + - mod_lbr_ty + - oem_partno + - op_code_desc + - paint_stg + - paint_tone + - part_qty + - part_type + - price_inc + - price_j + - prt_dsmk_m + - prt_dsmk_p + - removed + - status + - tax_part + - unq_seq + - updated_at + computed_fields: [] + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: joblines + schema: public + type: create_select_permission diff --git a/hasura/migrations/1587663758715_update_permission_user_public_table_joblines/down.yaml b/hasura/migrations/1587663758715_update_permission_user_public_table_joblines/down.yaml new file mode 100644 index 000000000..179d1c4d2 --- /dev/null +++ b/hasura/migrations/1587663758715_update_permission_user_public_table_joblines/down.yaml @@ -0,0 +1,77 @@ +- args: + role: user + table: + name: joblines + schema: public + type: drop_update_permission +- args: + permission: + columns: + - act_price + - alt_co_id + - alt_overrd + - alt_part_i + - alt_partm + - alt_partno + - bett_amt + - bett_pctg + - bett_tax + - bett_type + - cert_part + - created_at + - db_hrs + - db_price + - db_ref + - est_seq + - glass_flag + - id + - jobid + - lbr_amt + - lbr_hrs_j + - lbr_inc + - lbr_op + - lbr_op_j + - lbr_tax + - lbr_typ_j + - line_desc + - line_ind + - line_ref + - misc_amt + - misc_sublt + - misc_tax + - mod_lb_hrs + - mod_lbr_ty + - oem_partno + - op_code_desc + - paint_stg + - paint_tone + - part_qty + - part_type + - price_inc + - price_j + - prt_dsmk_m + - prt_dsmk_p + - removed + - status + - tax_part + - unq_seq + - updated_at + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: joblines + schema: public + type: create_update_permission diff --git a/hasura/migrations/1587663758715_update_permission_user_public_table_joblines/up.yaml b/hasura/migrations/1587663758715_update_permission_user_public_table_joblines/up.yaml new file mode 100644 index 000000000..9320e3bbc --- /dev/null +++ b/hasura/migrations/1587663758715_update_permission_user_public_table_joblines/up.yaml @@ -0,0 +1,78 @@ +- args: + role: user + table: + name: joblines + schema: public + type: drop_update_permission +- args: + permission: + columns: + - act_price + - alt_co_id + - alt_overrd + - alt_part_i + - alt_partm + - alt_partno + - bett_amt + - bett_pctg + - bett_tax + - bett_type + - cert_part + - created_at + - db_hrs + - db_price + - db_ref + - est_seq + - glass_flag + - id + - jobid + - lbr_amt + - lbr_hrs_j + - lbr_inc + - lbr_op + - lbr_op_j + - lbr_tax + - lbr_typ_j + - line_desc + - line_ind + - line_no + - line_ref + - misc_amt + - misc_sublt + - misc_tax + - mod_lb_hrs + - mod_lbr_ty + - oem_partno + - op_code_desc + - paint_stg + - paint_tone + - part_qty + - part_type + - price_inc + - price_j + - prt_dsmk_m + - prt_dsmk_p + - removed + - status + - tax_part + - unq_seq + - updated_at + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: joblines + schema: public + type: create_update_permission