diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 17d6e7b03..36409c46d 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -123,6 +123,27 @@ + + new + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + reschedule false @@ -214,6 +235,32 @@ + + fields + + + title + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + labels diff --git a/client/src/components/schedule-appointment-modal/schedule-appointment-modal.component.jsx b/client/src/components/schedule-appointment-modal/schedule-appointment-modal.component.jsx new file mode 100644 index 000000000..756ab4fba --- /dev/null +++ b/client/src/components/schedule-appointment-modal/schedule-appointment-modal.component.jsx @@ -0,0 +1,67 @@ +import { Checkbox, Col, DatePicker, Modal, Row, TimePicker, Input } from "antd"; +import React from "react"; +import { useTranslation } from "react-i18next"; +import ScheduleDayViewContainer from "../schedule-day-view/schedule-day-view.container"; + +export default function ScheduleJobModalComponent({ + appData, + setAppData, + formData, + setFormData, + ...props +}) { + const { t } = useTranslation(); + //TODO: Existing appointments list only refreshes sometimes after modal close. May have to do with the container class. + return ( + + + + + Manual Job Selection Scheduled Time + { + setAppData({ ...appData, title: e.target.value }); + }} + /> + { + setAppData({ ...appData, start: e }); + }} + /> + { + setAppData({ ...appData, start: e }); + }} + /> + + + { + //TODO: Build out notifications. + } + + setFormData({ ...formData, notifyCustomer: e.target.checked }) + } + > + {t("jobs.labels.appointmentconfirmation")} + + + + + + + + ); +} diff --git a/client/src/components/schedule-appointment-modal/schedule-appointment-modal.container.jsx b/client/src/components/schedule-appointment-modal/schedule-appointment-modal.container.jsx new file mode 100644 index 000000000..e2ca97995 --- /dev/null +++ b/client/src/components/schedule-appointment-modal/schedule-appointment-modal.container.jsx @@ -0,0 +1,74 @@ +import { notification } from "antd"; +import moment from "moment"; +import React, { useState } from "react"; +import { useMutation } from "react-apollo"; +import { useTranslation } from "react-i18next"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { INSERT_APPOINTMENT } from "../../graphql/appointments.queries"; +import { selectBodyshop } from "../../redux/user/user.selectors"; +import ScheduleAppointmentModalComponent from "./schedule-appointment-modal.component"; + +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop +}); + +export default connect( + mapStateToProps, + null +)(function ScheduleAppointmentModalContainer({ + scheduleModalState, + jobId, + bodyshop, + refetch +}) { + const [scheduleModalVisible, setscheduleModalVisible] = scheduleModalState; + const [appData, setAppData] = useState({ + jobid: jobId, + bodyshopid: bodyshop.id, + isintake: false, + start: null + }); + const [insertAppointment] = useMutation(INSERT_APPOINTMENT); + const [formData, setFormData] = useState({ notifyCustomer: false }); + const { t } = useTranslation(); + + return ( + setscheduleModalVisible(false)} + onOk={() => { + //TODO: Customize the amount of minutes it will add. + insertAppointment({ + variables: { + app: { ...appData, end: moment(appData.start).add(60, "minutes") } + } + }) + .then(r => { + notification["success"]({ + message: t("appointments.successes.created") + }); + + if (formData.notifyCustomer) { + //TODO: Implement customer reminder on scheduling. + alert("Chosed to notify the customer somehow!"); + } + setscheduleModalVisible(false); + if (refetch) refetch(); + }) + .catch(error => { + notification["error"]({ + message: t("appointments.errors.saving", { + message: error.message + }) + }); + }); + }} + /> + ); +}); diff --git a/client/src/components/schedule-calendar/schedule-calendar.component.jsx b/client/src/components/schedule-calendar/schedule-calendar.component.jsx index a82231f64..61c3ffe3e 100644 --- a/client/src/components/schedule-calendar/schedule-calendar.component.jsx +++ b/client/src/components/schedule-calendar/schedule-calendar.component.jsx @@ -1,13 +1,46 @@ import React from "react"; //import "react-big-calendar/lib/css/react-big-calendar.css"; import ScheduleCalendarWrapperComponent from "../schedule-calendar-wrapper/scheduler-calendar-wrapper.component"; +import { Button, Icon } from "antd"; +import { useTranslation } from "react-i18next"; +import ScheduleAppointmentModalContainer from "../schedule-appointment-modal/schedule-appointment-modal.container"; + +export default function ScheduleCalendarComponent({ + data, + refetch, + scheduleModalState +}) { + const { t } = useTranslation(); -export default function ScheduleCalendarComponent({ data, refetch }) { return ( - +
+ + + + + + + +
); } diff --git a/client/src/components/schedule-calendar/schedule-calendar.container.jsx b/client/src/components/schedule-calendar/schedule-calendar.container.jsx index 22b2404d9..7d5605044 100644 --- a/client/src/components/schedule-calendar/schedule-calendar.container.jsx +++ b/client/src/components/schedule-calendar/schedule-calendar.container.jsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useState } from "react"; import { useQuery } from "react-apollo"; import ScheduleCalendarComponent from "./schedule-calendar.component"; import { QUERY_ALL_ACTIVE_APPOINTMENTS } from "../../graphql/appointments.queries"; @@ -12,6 +12,7 @@ export default function ScheduleCalendarContainer() { fetchPolicy: "network-only" } ); + const scheduleModalState = useState(false); if (loading) return ; if (error) return ; @@ -27,6 +28,7 @@ export default function ScheduleCalendarContainer() { return ( diff --git a/client/src/components/schedule-event/schedule-event.component.jsx b/client/src/components/schedule-event/schedule-event.component.jsx index e9bcd1918..17cbb8b39 100644 --- a/client/src/components/schedule-event/schedule-event.component.jsx +++ b/client/src/components/schedule-event/schedule-event.component.jsx @@ -9,22 +9,53 @@ export default function ScheduleEventComponent({ event, handleCancel }) { const { t } = useTranslation(); const popoverContent = (
-
{`${t("jobs.fields.ro_number")}: ${event.job.ro_number}`}
-
- {t("jobs.fields.clm_total")}: - {event.job.clm_total} -
-
{`${t("jobs.fields.clm_no")}: ${event.job.clm_no}`}
-
- {t("jobs.fields.ownr_ea")}:{event.job.ownr_ea} -
-
- {t("jobs.fields.ownr_ph1")}: - {event.job.ownr_ph1} -
- - - + {!event.isintake ? ( + {event.title} + ) : ( +
+ {`${(event.job && event.job.ownr_fn) || ""} ${(event.job && + event.job.ownr_ln) || + ""}`} + + {`${(event.job && event.job.vehicle.v_model_yr) || + ""} ${(event.job && event.job.vehicle.v_make_desc) || + ""} ${(event.job && event.job.vehicle.v_model_desc) || ""}`} + +
+ )} + {event.job ? ( +
+
{`${t("jobs.fields.ro_number")}: ${(event.job && + event.job.ro_number) || + ""}`}
+
+ {t("jobs.fields.clm_total")}: + + {(event.job && event.job.clm_total) || ""} + +
+
{`${t("jobs.fields.clm_no")}: ${(event.job && + event.job.clm_no) || + ""}`}
+
+ {t("jobs.fields.ownr_ea")}:{(event.job && event.job.ownr_ea) || ""} +
+
+ {t("jobs.fields.ownr_ph1")}: + + {(event.job && event.job.ownr_ph1) || ""} + +
+
+ ) : null} + { + //TODO Add phone 1 MessagingActionTypes. + } + {event.job ? ( + + + + ) : null} @@ -34,24 +65,36 @@ export default function ScheduleEventComponent({ event, handleCancel }) { } {t("appointments.actions.reschedule")} - + {event.isintake ? ( + + ) : null}
); return (
- {`${event.job.ownr_fn || ""} ${event.job.ownr_ln || - ""}`} - - {`${event.job.vehicle.v_model_yr || ""} ${event.job.vehicle - .v_make_desc || ""} ${event.job.vehicle.v_model_desc || ""}`} - + {event.isintake ? ( +
+ {`${(event.job && event.job.ownr_fn) || ""} ${(event.job && + event.job.ownr_ln) || + ""}`} + + {`${(event.job && event.job.vehicle.v_model_yr) || + ""} ${(event.job && event.job.vehicle.v_make_desc) || + ""} ${(event.job && event.job.vehicle.v_model_desc) || ""}`} + +
+ ) : ( +
+ {`${event.title || ""}`} +
+ )}
); diff --git a/client/src/components/schedule-job-modal/schedule-job-modal.container.jsx b/client/src/components/schedule-job-modal/schedule-job-modal.container.jsx index 9e9d8179b..4729e17dc 100644 --- a/client/src/components/schedule-job-modal/schedule-job-modal.container.jsx +++ b/client/src/components/schedule-job-modal/schedule-job-modal.container.jsx @@ -28,12 +28,16 @@ export default connect( refetch }) { const [scheduleModalVisible, setscheduleModalVisible] = scheduleModalState; - const [appData, setAppData] = useState({ jobid: jobId, start: null }); + const [appData, setAppData] = useState({ + jobid: jobId, + start: null, + bodyshopid: bodyshop.id + }); const [insertAppointment] = useMutation(INSERT_APPOINTMENT); const [updateJobStatus] = useMutation(UPDATE_JOB_STATUS, { variables: { jobId: jobId, - status: bodyshop.md_ro_statuses.default_scheduled + status: bodyshop.md_ro_statuses.default_scheduled } }); const [formData, setFormData] = useState({ notifyCustomer: false }); diff --git a/client/src/graphql/appointments.queries.js b/client/src/graphql/appointments.queries.js index b69d0c967..8a3fe571a 100644 --- a/client/src/graphql/appointments.queries.js +++ b/client/src/graphql/appointments.queries.js @@ -6,6 +6,8 @@ export const QUERY_ALL_ACTIVE_APPOINTMENTS = gql` start id end + title + isintake job { ro_number ownr_ln @@ -38,10 +40,14 @@ export const INSERT_APPOINTMENT = gql` export const QUERY_APPOINTMENT_BY_DATE = gql` query QUERY_APPOINTMENT_BY_DATE($start: timestamptz, $end: timestamptz) { - appointments(where: { start: { _lte: $end, _gte: $start } }) { + appointments( + where: { start: { _lte: $end, _gte: $start }, canceled: { _eq: false } } + ) { start id end + title + isintake job { ro_number ownr_ln @@ -81,6 +87,7 @@ export const QUERY_APPOINTMENTS_BY_JOBID = gql` start id end + isintake arrived canceled created_at diff --git a/client/src/pages/manage/manage.page.container.jsx b/client/src/pages/manage/manage.page.container.jsx index 28f97f3a6..e9af1b033 100644 --- a/client/src/pages/manage/manage.page.container.jsx +++ b/client/src/pages/manage/manage.page.container.jsx @@ -1,20 +1,28 @@ +import { notification } from "antd"; import React, { useEffect } from "react"; -import ManagePage from "./manage.page"; import { useQuery } from "react-apollo"; +import { useTranslation } from "react-i18next"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component"; import { QUERY_BODYSHOP } from "../../graphql/bodyshop.queries"; import { setBodyshop } from "../../redux/user/user.actions"; -import { connect } from "react-redux"; -import { notification } from "antd"; -import { useTranslation } from "react-i18next"; +import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors"; +import ManagePage from "./manage.page"; + +const mapStateToProps = createStructuredSelector({ + currentUser: selectCurrentUser, + bodyshop: selectBodyshop +}); const mapDispatchToProps = dispatch => ({ setBodyshop: bs => dispatch(setBodyshop(bs)) }); export default connect( - null, + mapStateToProps, mapDispatchToProps -)(function ManagePageContainer({ match, setBodyshop }) { +)(function ManagePageContainer({ match, setBodyshop, bodyshop }) { const { error, data } = useQuery(QUERY_BODYSHOP, { fetchPolicy: "network-only" }); @@ -30,5 +38,7 @@ export default connect( }; }, [data, setBodyshop]); + //TODO Translate later. + if (!bodyshop) return ; return ; }); diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 1968bd4bb..b93fd4c25 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -12,6 +12,7 @@ "actions": { "cancel": "Cancel", "intake": "Intake", + "new": "New Appointment", "reschedule": "Reschedule", "viewjob": "View Job" }, @@ -19,6 +20,9 @@ "canceling": "Error canceling appointment.", "saving": "Error scheduling appointment. {{message}}" }, + "fields": { + "title": "Title" + }, "labels": { "arrivedon": "Arrived on: ", "cancelledappointment": "Canceled appointment for: ", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index c33605a43..78066a6f7 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -12,6 +12,7 @@ "actions": { "cancel": "Cancelar", "intake": "Consumo", + "new": "Nueva cita", "reschedule": "Reprogramar", "viewjob": "Ver trabajo" }, @@ -19,6 +20,9 @@ "canceling": "Error al cancelar la cita.", "saving": "Error al programar la cita. {{message}}" }, + "fields": { + "title": "Título" + }, "labels": { "arrivedon": "Llegado el:", "cancelledappointment": "Cita cancelada para:", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index b0ef0b149..159b39982 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -12,6 +12,7 @@ "actions": { "cancel": "annuler", "intake": "Admission", + "new": "Nouveau rendez-vous", "reschedule": "Replanifier", "viewjob": "Voir le travail" }, @@ -19,6 +20,9 @@ "canceling": "Erreur lors de l'annulation du rendez-vous.", "saving": "Erreur lors de la planification du rendez-vous. {{message}}" }, + "fields": { + "title": "Titre" + }, "labels": { "arrivedon": "Arrivé le:", "cancelledappointment": "Rendez-vous annulé pour:", diff --git a/hasura/migrations/1581530616257_alter_table_public_appointments_add_column_isintake/down.yaml b/hasura/migrations/1581530616257_alter_table_public_appointments_add_column_isintake/down.yaml new file mode 100644 index 000000000..e02cfe92d --- /dev/null +++ b/hasura/migrations/1581530616257_alter_table_public_appointments_add_column_isintake/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."appointments" DROP COLUMN "isintake"; + type: run_sql diff --git a/hasura/migrations/1581530616257_alter_table_public_appointments_add_column_isintake/up.yaml b/hasura/migrations/1581530616257_alter_table_public_appointments_add_column_isintake/up.yaml new file mode 100644 index 000000000..62dbfbfac --- /dev/null +++ b/hasura/migrations/1581530616257_alter_table_public_appointments_add_column_isintake/up.yaml @@ -0,0 +1,4 @@ +- args: + sql: ALTER TABLE "public"."appointments" ADD COLUMN "isintake" boolean NOT NULL + DEFAULT true; + type: run_sql diff --git a/hasura/migrations/1581530623178_update_permission_user_public_table_appointments/down.yaml b/hasura/migrations/1581530623178_update_permission_user_public_table_appointments/down.yaml new file mode 100644 index 000000000..34cf4841b --- /dev/null +++ b/hasura/migrations/1581530623178_update_permission_user_public_table_appointments/down.yaml @@ -0,0 +1,36 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_insert_permission +- args: + permission: + check: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - arrived + - canceled + - created_at + - end + - start + - updated_at + - id + - jobid + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: appointments + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1581530623178_update_permission_user_public_table_appointments/up.yaml b/hasura/migrations/1581530623178_update_permission_user_public_table_appointments/up.yaml new file mode 100644 index 000000000..2d7c6806a --- /dev/null +++ b/hasura/migrations/1581530623178_update_permission_user_public_table_appointments/up.yaml @@ -0,0 +1,37 @@ +- args: + role: user + table: + name: appointments + 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 + - start + - end + - canceled + - arrived + - isintake + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: appointments + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1581530628660_update_permission_user_public_table_appointments/down.yaml b/hasura/migrations/1581530628660_update_permission_user_public_table_appointments/down.yaml new file mode 100644 index 000000000..7c6811bf8 --- /dev/null +++ b/hasura/migrations/1581530628660_update_permission_user_public_table_appointments/down.yaml @@ -0,0 +1,34 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: true + columns: + - arrived + - canceled + - created_at + - end + - start + - 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: appointments + schema: public + type: create_select_permission diff --git a/hasura/migrations/1581530628660_update_permission_user_public_table_appointments/up.yaml b/hasura/migrations/1581530628660_update_permission_user_public_table_appointments/up.yaml new file mode 100644 index 000000000..9b8f53a5b --- /dev/null +++ b/hasura/migrations/1581530628660_update_permission_user_public_table_appointments/up.yaml @@ -0,0 +1,35 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: true + columns: + - arrived + - canceled + - isintake + - created_at + - end + - start + - 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: appointments + schema: public + type: create_select_permission diff --git a/hasura/migrations/1581530632721_update_permission_user_public_table_appointments/down.yaml b/hasura/migrations/1581530632721_update_permission_user_public_table_appointments/down.yaml new file mode 100644 index 000000000..1644cd131 --- /dev/null +++ b/hasura/migrations/1581530632721_update_permission_user_public_table_appointments/down.yaml @@ -0,0 +1,36 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_update_permission +- args: + permission: + columns: + - arrived + - canceled + - created_at + - end + - start + - 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: appointments + schema: public + type: create_update_permission diff --git a/hasura/migrations/1581530632721_update_permission_user_public_table_appointments/up.yaml b/hasura/migrations/1581530632721_update_permission_user_public_table_appointments/up.yaml new file mode 100644 index 000000000..bd68314eb --- /dev/null +++ b/hasura/migrations/1581530632721_update_permission_user_public_table_appointments/up.yaml @@ -0,0 +1,37 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_update_permission +- args: + permission: + columns: + - arrived + - canceled + - isintake + - created_at + - end + - start + - 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: appointments + schema: public + type: create_update_permission diff --git a/hasura/migrations/1581533010996_alter_table_public_appointments_add_column_bodyshopid/down.yaml b/hasura/migrations/1581533010996_alter_table_public_appointments_add_column_bodyshopid/down.yaml new file mode 100644 index 000000000..a215f8049 --- /dev/null +++ b/hasura/migrations/1581533010996_alter_table_public_appointments_add_column_bodyshopid/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."appointments" DROP COLUMN "bodyshopid"; + type: run_sql diff --git a/hasura/migrations/1581533010996_alter_table_public_appointments_add_column_bodyshopid/up.yaml b/hasura/migrations/1581533010996_alter_table_public_appointments_add_column_bodyshopid/up.yaml new file mode 100644 index 000000000..3a62d703c --- /dev/null +++ b/hasura/migrations/1581533010996_alter_table_public_appointments_add_column_bodyshopid/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."appointments" ADD COLUMN "bodyshopid" uuid NOT NULL; + type: run_sql diff --git a/hasura/migrations/1581533025791_set_fk_public_appointments_bodyshopid/down.yaml b/hasura/migrations/1581533025791_set_fk_public_appointments_bodyshopid/down.yaml new file mode 100644 index 000000000..d2b5e6acf --- /dev/null +++ b/hasura/migrations/1581533025791_set_fk_public_appointments_bodyshopid/down.yaml @@ -0,0 +1,4 @@ +- args: + sql: "\n alter table \"public\".\"appointments\" drop constraint \"appointments_bodyshopid_fkey\"\n + \ " + type: run_sql diff --git a/hasura/migrations/1581533025791_set_fk_public_appointments_bodyshopid/up.yaml b/hasura/migrations/1581533025791_set_fk_public_appointments_bodyshopid/up.yaml new file mode 100644 index 000000000..1eddc1d61 --- /dev/null +++ b/hasura/migrations/1581533025791_set_fk_public_appointments_bodyshopid/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: "\n alter table \"public\".\"appointments\"\n add constraint + \"appointments_bodyshopid_fkey\"\n foreign key (\"bodyshopid\")\n + \ references \"public\".\"bodyshops\"\n (\"id\") on update + cascade on delete cascade;\n " + type: run_sql diff --git a/hasura/migrations/1581533035763_alter_table_public_appointments_alter_column_jobid/down.yaml b/hasura/migrations/1581533035763_alter_table_public_appointments_alter_column_jobid/down.yaml new file mode 100644 index 000000000..670a8a99f --- /dev/null +++ b/hasura/migrations/1581533035763_alter_table_public_appointments_alter_column_jobid/down.yaml @@ -0,0 +1,6 @@ +- args: + sql: ALTER TABLE "public"."appointments" ALTER COLUMN "jobid" SET NOT NULL; + type: run_sql +- args: + sql: COMMENT ON COLUMN "public"."appointments"."jobid" IS E'null' + type: run_sql diff --git a/hasura/migrations/1581533035763_alter_table_public_appointments_alter_column_jobid/up.yaml b/hasura/migrations/1581533035763_alter_table_public_appointments_alter_column_jobid/up.yaml new file mode 100644 index 000000000..2b5118988 --- /dev/null +++ b/hasura/migrations/1581533035763_alter_table_public_appointments_alter_column_jobid/up.yaml @@ -0,0 +1,6 @@ +- args: + sql: ALTER TABLE "public"."appointments" ALTER COLUMN "jobid" DROP NOT NULL; + type: run_sql +- args: + sql: COMMENT ON COLUMN "public"."appointments"."jobid" IS E'' + type: run_sql diff --git a/hasura/migrations/1581533044908_track_all_relationships/down.yaml b/hasura/migrations/1581533044908_track_all_relationships/down.yaml new file mode 100644 index 000000000..9e9c5e1f4 --- /dev/null +++ b/hasura/migrations/1581533044908_track_all_relationships/down.yaml @@ -0,0 +1,12 @@ +- args: + relationship: bodyshop + table: + name: appointments + schema: public + type: drop_relationship +- args: + relationship: appointments + table: + name: bodyshops + schema: public + type: drop_relationship diff --git a/hasura/migrations/1581533044908_track_all_relationships/up.yaml b/hasura/migrations/1581533044908_track_all_relationships/up.yaml new file mode 100644 index 000000000..4489d60cd --- /dev/null +++ b/hasura/migrations/1581533044908_track_all_relationships/up.yaml @@ -0,0 +1,20 @@ +- args: + name: bodyshop + table: + name: appointments + schema: public + using: + foreign_key_constraint_on: bodyshopid + type: create_object_relationship +- args: + name: appointments + table: + name: bodyshops + schema: public + using: + foreign_key_constraint_on: + column: bodyshopid + table: + name: appointments + schema: public + type: create_array_relationship diff --git a/hasura/migrations/1581533078439_update_permission_user_public_table_appointments/down.yaml b/hasura/migrations/1581533078439_update_permission_user_public_table_appointments/down.yaml new file mode 100644 index 000000000..2d7c6806a --- /dev/null +++ b/hasura/migrations/1581533078439_update_permission_user_public_table_appointments/down.yaml @@ -0,0 +1,37 @@ +- args: + role: user + table: + name: appointments + 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 + - start + - end + - canceled + - arrived + - isintake + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: appointments + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1581533078439_update_permission_user_public_table_appointments/up.yaml b/hasura/migrations/1581533078439_update_permission_user_public_table_appointments/up.yaml new file mode 100644 index 000000000..80392f155 --- /dev/null +++ b/hasura/migrations/1581533078439_update_permission_user_public_table_appointments/up.yaml @@ -0,0 +1,36 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - jobid + - start + - end + - canceled + - arrived + - isintake + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: appointments + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1581533085254_update_permission_user_public_table_appointments/down.yaml b/hasura/migrations/1581533085254_update_permission_user_public_table_appointments/down.yaml new file mode 100644 index 000000000..80392f155 --- /dev/null +++ b/hasura/migrations/1581533085254_update_permission_user_public_table_appointments/down.yaml @@ -0,0 +1,36 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - jobid + - start + - end + - canceled + - arrived + - isintake + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: appointments + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1581533085254_update_permission_user_public_table_appointments/up.yaml b/hasura/migrations/1581533085254_update_permission_user_public_table_appointments/up.yaml new file mode 100644 index 000000000..b6a96cd37 --- /dev/null +++ b/hasura/migrations/1581533085254_update_permission_user_public_table_appointments/up.yaml @@ -0,0 +1,37 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - arrived + - canceled + - isintake + - created_at + - end + - start + - updated_at + - bodyshopid + - id + - jobid + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: appointments + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1581533092537_update_permission_user_public_table_appointments/down.yaml b/hasura/migrations/1581533092537_update_permission_user_public_table_appointments/down.yaml new file mode 100644 index 000000000..9b8f53a5b --- /dev/null +++ b/hasura/migrations/1581533092537_update_permission_user_public_table_appointments/down.yaml @@ -0,0 +1,35 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: true + columns: + - arrived + - canceled + - isintake + - created_at + - end + - start + - 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: appointments + schema: public + type: create_select_permission diff --git a/hasura/migrations/1581533092537_update_permission_user_public_table_appointments/up.yaml b/hasura/migrations/1581533092537_update_permission_user_public_table_appointments/up.yaml new file mode 100644 index 000000000..ea389149c --- /dev/null +++ b/hasura/migrations/1581533092537_update_permission_user_public_table_appointments/up.yaml @@ -0,0 +1,35 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: true + columns: + - arrived + - canceled + - isintake + - created_at + - end + - start + - updated_at + - bodyshopid + - id + - jobid + computed_fields: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: appointments + schema: public + type: create_select_permission diff --git a/hasura/migrations/1581533100559_update_permission_user_public_table_appointments/down.yaml b/hasura/migrations/1581533100559_update_permission_user_public_table_appointments/down.yaml new file mode 100644 index 000000000..bd68314eb --- /dev/null +++ b/hasura/migrations/1581533100559_update_permission_user_public_table_appointments/down.yaml @@ -0,0 +1,37 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_update_permission +- args: + permission: + columns: + - arrived + - canceled + - isintake + - created_at + - end + - start + - 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: appointments + schema: public + type: create_update_permission diff --git a/hasura/migrations/1581533100559_update_permission_user_public_table_appointments/up.yaml b/hasura/migrations/1581533100559_update_permission_user_public_table_appointments/up.yaml new file mode 100644 index 000000000..eed14f2a7 --- /dev/null +++ b/hasura/migrations/1581533100559_update_permission_user_public_table_appointments/up.yaml @@ -0,0 +1,37 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_update_permission +- args: + permission: + columns: + - arrived + - canceled + - isintake + - created_at + - end + - start + - updated_at + - bodyshopid + - id + - jobid + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: appointments + schema: public + type: create_update_permission diff --git a/hasura/migrations/1581533106127_update_permission_user_public_table_appointments/down.yaml b/hasura/migrations/1581533106127_update_permission_user_public_table_appointments/down.yaml new file mode 100644 index 000000000..e40aecd89 --- /dev/null +++ b/hasura/migrations/1581533106127_update_permission_user_public_table_appointments/down.yaml @@ -0,0 +1,23 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_delete_permission +- args: + permission: + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: appointments + schema: public + type: create_delete_permission diff --git a/hasura/migrations/1581533106127_update_permission_user_public_table_appointments/up.yaml b/hasura/migrations/1581533106127_update_permission_user_public_table_appointments/up.yaml new file mode 100644 index 000000000..c70956bf0 --- /dev/null +++ b/hasura/migrations/1581533106127_update_permission_user_public_table_appointments/up.yaml @@ -0,0 +1,22 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_delete_permission +- args: + permission: + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: appointments + schema: public + type: create_delete_permission diff --git a/hasura/migrations/1581536337667_alter_table_public_appointments_add_column_title/down.yaml b/hasura/migrations/1581536337667_alter_table_public_appointments_add_column_title/down.yaml new file mode 100644 index 000000000..7dcc18afa --- /dev/null +++ b/hasura/migrations/1581536337667_alter_table_public_appointments_add_column_title/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."appointments" DROP COLUMN "title"; + type: run_sql diff --git a/hasura/migrations/1581536337667_alter_table_public_appointments_add_column_title/up.yaml b/hasura/migrations/1581536337667_alter_table_public_appointments_add_column_title/up.yaml new file mode 100644 index 000000000..e12992c92 --- /dev/null +++ b/hasura/migrations/1581536337667_alter_table_public_appointments_add_column_title/up.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."appointments" ADD COLUMN "title" text NULL; + type: run_sql diff --git a/hasura/migrations/1581536568049_update_permission_user_public_table_appointments/down.yaml b/hasura/migrations/1581536568049_update_permission_user_public_table_appointments/down.yaml new file mode 100644 index 000000000..b6a96cd37 --- /dev/null +++ b/hasura/migrations/1581536568049_update_permission_user_public_table_appointments/down.yaml @@ -0,0 +1,37 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - arrived + - canceled + - isintake + - created_at + - end + - start + - updated_at + - bodyshopid + - id + - jobid + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: appointments + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1581536568049_update_permission_user_public_table_appointments/up.yaml b/hasura/migrations/1581536568049_update_permission_user_public_table_appointments/up.yaml new file mode 100644 index 000000000..116c67c2d --- /dev/null +++ b/hasura/migrations/1581536568049_update_permission_user_public_table_appointments/up.yaml @@ -0,0 +1,38 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - jobid + - start + - end + - canceled + - arrived + - isintake + - bodyshopid + - title + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: appointments + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1581536573614_update_permission_user_public_table_appointments/down.yaml b/hasura/migrations/1581536573614_update_permission_user_public_table_appointments/down.yaml new file mode 100644 index 000000000..ea389149c --- /dev/null +++ b/hasura/migrations/1581536573614_update_permission_user_public_table_appointments/down.yaml @@ -0,0 +1,35 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: true + columns: + - arrived + - canceled + - isintake + - created_at + - end + - start + - updated_at + - bodyshopid + - id + - jobid + computed_fields: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: appointments + schema: public + type: create_select_permission diff --git a/hasura/migrations/1581536573614_update_permission_user_public_table_appointments/up.yaml b/hasura/migrations/1581536573614_update_permission_user_public_table_appointments/up.yaml new file mode 100644 index 000000000..1c74631cf --- /dev/null +++ b/hasura/migrations/1581536573614_update_permission_user_public_table_appointments/up.yaml @@ -0,0 +1,36 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: true + columns: + - arrived + - canceled + - isintake + - title + - created_at + - end + - start + - updated_at + - bodyshopid + - id + - jobid + computed_fields: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: appointments + schema: public + type: create_select_permission diff --git a/hasura/migrations/1581536577315_update_permission_user_public_table_appointments/down.yaml b/hasura/migrations/1581536577315_update_permission_user_public_table_appointments/down.yaml new file mode 100644 index 000000000..eed14f2a7 --- /dev/null +++ b/hasura/migrations/1581536577315_update_permission_user_public_table_appointments/down.yaml @@ -0,0 +1,37 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_update_permission +- args: + permission: + columns: + - arrived + - canceled + - isintake + - created_at + - end + - start + - updated_at + - bodyshopid + - id + - jobid + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: appointments + schema: public + type: create_update_permission diff --git a/hasura/migrations/1581536577315_update_permission_user_public_table_appointments/up.yaml b/hasura/migrations/1581536577315_update_permission_user_public_table_appointments/up.yaml new file mode 100644 index 000000000..264408ea3 --- /dev/null +++ b/hasura/migrations/1581536577315_update_permission_user_public_table_appointments/up.yaml @@ -0,0 +1,38 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_update_permission +- args: + permission: + columns: + - arrived + - canceled + - isintake + - title + - created_at + - end + - start + - updated_at + - bodyshopid + - id + - jobid + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: appointments + schema: public + type: create_update_permission