From fae1e8cdeb700925d93e5e35d99fb56f6594d339 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Thu, 6 Feb 2020 13:39:39 -0800 Subject: [PATCH] Table updates for new appointments fields. Schedule modal baseline functionality. Refactor schedule components to be more reusable. --- bodyshop_translations.babel | 193 ++++++++++++++++++ client/src/App/App.container.jsx | 2 - .../jobs-detail-header.component.jsx | 2 +- .../loading-skeleton.component.jsx | 2 +- .../scheduler-calendar-wrapper.component.jsx | 33 +++ .../schedule-calendar.component.jsx | 24 +-- .../schedule-calendar.container.jsx | 11 +- .../schedule-datecellwrapper.component.jsx | 10 +- .../schedule-day-view.component.jsx | 20 ++ .../schedule-day-view.container.jsx | 36 ++++ ...ponent.js => schedule-event.component.jsx} | 30 ++- .../schedule-event.container.jsx | 16 ++ .../schedule-job-modal.component.jsx | 58 ++++-- .../schedule-job-modal.container.jsx | 29 ++- client/src/graphql/appointments.queries.js | 45 +++- client/src/redux/user/user.sagas.js | 3 + client/src/translations/en_us/common.json | 18 ++ client/src/translations/es/common.json | 18 ++ client/src/translations/fr/common.json | 18 ++ .../down.yaml | 17 ++ .../up.yaml | 6 + .../down.yaml | 17 ++ .../up.yaml | 6 + .../down.yaml | 12 ++ .../up.yaml | 6 + .../down.yaml | 3 + .../up.yaml | 4 + .../down.yaml | 3 + .../up.yaml | 4 + .../down.yaml | 34 +++ .../up.yaml | 36 ++++ .../down.yaml | 32 +++ .../up.yaml | 34 +++ .../down.yaml | 34 +++ .../up.yaml | 36 ++++ 35 files changed, 785 insertions(+), 67 deletions(-) create mode 100644 client/src/components/schedule-calendar-wrapper/scheduler-calendar-wrapper.component.jsx create mode 100644 client/src/components/schedule-day-view/schedule-day-view.component.jsx create mode 100644 client/src/components/schedule-day-view/schedule-day-view.container.jsx rename client/src/components/schedule-event/{schedule-event.component.js => schedule-event.component.jsx} (55%) create mode 100644 client/src/components/schedule-event/schedule-event.container.jsx create mode 100644 hasura/migrations/1581011347492_delete_permission_anonymous_public_table_users/down.yaml create mode 100644 hasura/migrations/1581011347492_delete_permission_anonymous_public_table_users/up.yaml create mode 100644 hasura/migrations/1581011354989_delete_permission_anonymous_public_table_users/down.yaml create mode 100644 hasura/migrations/1581011354989_delete_permission_anonymous_public_table_users/up.yaml create mode 100644 hasura/migrations/1581011359698_delete_permission_anonymous_public_table_users/down.yaml create mode 100644 hasura/migrations/1581011359698_delete_permission_anonymous_public_table_users/up.yaml create mode 100644 hasura/migrations/1581022739131_alter_table_public_appointments_add_column_canceled/down.yaml create mode 100644 hasura/migrations/1581022739131_alter_table_public_appointments_add_column_canceled/up.yaml create mode 100644 hasura/migrations/1581022751236_alter_table_public_appointments_add_column_arrived/down.yaml create mode 100644 hasura/migrations/1581022751236_alter_table_public_appointments_add_column_arrived/up.yaml create mode 100644 hasura/migrations/1581022758869_update_permission_user_public_table_appointments/down.yaml create mode 100644 hasura/migrations/1581022758869_update_permission_user_public_table_appointments/up.yaml create mode 100644 hasura/migrations/1581022764017_update_permission_user_public_table_appointments/down.yaml create mode 100644 hasura/migrations/1581022764017_update_permission_user_public_table_appointments/up.yaml create mode 100644 hasura/migrations/1581022771283_update_permission_user_public_table_appointments/down.yaml create mode 100644 hasura/migrations/1581022771283_update_permission_user_public_table_appointments/up.yaml diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 1351ea4bd..385c7c93f 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -18,6 +18,178 @@ translation + + appointments + + + actions + + + cancel + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + intake + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + reschedule + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + viewjob + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + errors + + + saving + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + labels + + + nodateselected + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + successes + + + created + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + associations @@ -3012,6 +3184,27 @@ labels + + appointmentconfirmation + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + available_new_jobs false diff --git a/client/src/App/App.container.jsx b/client/src/App/App.container.jsx index 27db52240..0c90e9c27 100644 --- a/client/src/App/App.container.jsx +++ b/client/src/App/App.container.jsx @@ -14,8 +14,6 @@ import SpinnerComponent from "../components/loading-spinner/loading-spinner.comp import errorLink from "../graphql/apollo-error-handling"; import App from "./App"; - - class AppContainer extends Component { state = { client: null, diff --git a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx index 6d1fd52f1..1c5c92d16 100644 --- a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx +++ b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx @@ -22,7 +22,7 @@ export default function JobsDetailHeader({ scheduleModalState }) { const { t } = useTranslation(); - const [scheduleModalVisible, setscheduleModalVisible] = scheduleModalState; + const setscheduleModalVisible = scheduleModalState[1]; const tombstoneTitle = (
diff --git a/client/src/components/loading-skeleton/loading-skeleton.component.jsx b/client/src/components/loading-skeleton/loading-skeleton.component.jsx index ecfdec0d2..b4c306d6b 100644 --- a/client/src/components/loading-skeleton/loading-skeleton.component.jsx +++ b/client/src/components/loading-skeleton/loading-skeleton.component.jsx @@ -4,5 +4,5 @@ import "./loading-skeleton.styles.scss"; import { Skeleton } from "antd"; export default function LoadingSkeleton(props) { - return ; + return ; } diff --git a/client/src/components/schedule-calendar-wrapper/scheduler-calendar-wrapper.component.jsx b/client/src/components/schedule-calendar-wrapper/scheduler-calendar-wrapper.component.jsx new file mode 100644 index 000000000..82bc81ffc --- /dev/null +++ b/client/src/components/schedule-calendar-wrapper/scheduler-calendar-wrapper.component.jsx @@ -0,0 +1,33 @@ +import moment from "moment"; +import React from "react"; +import { Calendar, momentLocalizer } from "react-big-calendar"; +import "react-big-calendar/lib/css/react-big-calendar.css"; +import DateCellWrapper from "../schedule-datecellwrapper/schedule-datecellwrapper.component"; +import Event from "../schedule-event/schedule-event.container"; +const localizer = momentLocalizer(moment); + +export default function ScheduleCalendarWrapperComponent({ + data, + refetch, + defaultView, + ...otherProps +}) { + return ( + { + return Event({ event: e.event, refetch: refetch }); + }, + dateCellWrapper: DateCellWrapper + }} + {...otherProps} + /> + ); +} diff --git a/client/src/components/schedule-calendar/schedule-calendar.component.jsx b/client/src/components/schedule-calendar/schedule-calendar.component.jsx index 90dcd1faa..96fabc028 100644 --- a/client/src/components/schedule-calendar/schedule-calendar.component.jsx +++ b/client/src/components/schedule-calendar/schedule-calendar.component.jsx @@ -1,27 +1,13 @@ -import moment from "moment"; import React from "react"; -import { Calendar, momentLocalizer } from "react-big-calendar"; import "react-big-calendar/lib/css/react-big-calendar.css"; -import DateCellWrapper from "../schedule-datecellwrapper/schedule-datecellwrapper.component"; -import Event from "../schedule-event/schedule-event.component"; -const localizer = momentLocalizer(moment); +import ScheduleCalendarWrapperComponent from "../schedule-calendar-wrapper/scheduler-calendar-wrapper.component"; -export default function ScheduleCalendarComponent({ data }) { +export default function ScheduleCalendarComponent({ data, refetch }) { return ( - console.log("event", event)} - components={{ - event: Event, - dateCellWrapper: DateCellWrapper - }} + refetch={refetch} /> ); } diff --git a/client/src/components/schedule-calendar/schedule-calendar.container.jsx b/client/src/components/schedule-calendar/schedule-calendar.container.jsx index b0e38bba6..22b2404d9 100644 --- a/client/src/components/schedule-calendar/schedule-calendar.container.jsx +++ b/client/src/components/schedule-calendar/schedule-calendar.container.jsx @@ -1,14 +1,17 @@ import React from "react"; import { useQuery } from "react-apollo"; import ScheduleCalendarComponent from "./schedule-calendar.component"; -import { QUERY_ALL_APPOINTMENTS } from "../../graphql/appointments.queries"; +import { QUERY_ALL_ACTIVE_APPOINTMENTS } from "../../graphql/appointments.queries"; import LoadingSpinner from "../loading-spinner/loading-spinner.component"; import AlertComponent from "../alert/alert.component"; export default function ScheduleCalendarContainer() { - const { loading, error, data, refetch } = useQuery(QUERY_ALL_APPOINTMENTS, { - fetchPolicy: "network-only" - }); + const { loading, error, data, refetch } = useQuery( + QUERY_ALL_ACTIVE_APPOINTMENTS, + { + fetchPolicy: "network-only" + } + ); if (loading) return ; if (error) return ; diff --git a/client/src/components/schedule-datecellwrapper/schedule-datecellwrapper.component.jsx b/client/src/components/schedule-datecellwrapper/schedule-datecellwrapper.component.jsx index 9cf39f1bf..69d9e2f5d 100644 --- a/client/src/components/schedule-datecellwrapper/schedule-datecellwrapper.component.jsx +++ b/client/src/components/schedule-datecellwrapper/schedule-datecellwrapper.component.jsx @@ -2,22 +2,16 @@ import React from "react"; export default function ScheduleDateCellWrapper(dateCellWrapperProps) { // Show 'click me' text in arbitrary places by using the range prop - const hasAlert = dateCellWrapperProps.range - ? dateCellWrapperProps.range.some(date => { - return date.getDate() % 12 === 0; - }) - : false; const style = { display: "flex", flex: 1, borderLeft: "1px solid #DDD", - backgroundColor: hasAlert ? "#f5f5dc" : "#fff" + backgroundColor: "#fff" }; return (
- DateCellWrapper - {hasAlert && } + PLACEHOLDER:DATA {dateCellWrapperProps.children}
); diff --git a/client/src/components/schedule-day-view/schedule-day-view.component.jsx b/client/src/components/schedule-day-view/schedule-day-view.component.jsx new file mode 100644 index 000000000..e12818a74 --- /dev/null +++ b/client/src/components/schedule-day-view/schedule-day-view.component.jsx @@ -0,0 +1,20 @@ +import React from "react"; +import "react-big-calendar/lib/css/react-big-calendar.css"; +import { useTranslation } from "react-i18next"; +import ScheduleCalendarWrapperComponent from "../schedule-calendar-wrapper/scheduler-calendar-wrapper.component"; + +export default function ScheduleDayViewComponent({ data, day }) { + const { t } = useTranslation(); + if (data) + //TODO Remove addtional calendar elements from day view. + return ( + console.log("e", e)} + /> + ); + else return
{t("appointments.labels.nodateselected")}
; +} diff --git a/client/src/components/schedule-day-view/schedule-day-view.container.jsx b/client/src/components/schedule-day-view/schedule-day-view.container.jsx new file mode 100644 index 000000000..e61b4c6f0 --- /dev/null +++ b/client/src/components/schedule-day-view/schedule-day-view.container.jsx @@ -0,0 +1,36 @@ +import React from "react"; +import ScheduleDayViewComponent from "./schedule-day-view.component"; +import { useQuery } from "react-apollo"; +import { QUERY_APPOINTMENT_BY_DATE } from "../../graphql/appointments.queries"; +import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component"; +import moment from "moment"; + +export default function ScheduleDayViewContainer({ day }) { + const { loading, error, data } = useQuery(QUERY_APPOINTMENT_BY_DATE, { + variables: { + start: moment(day).startOf("day"), + end: moment(day).endOf("day") + }, + skip: !day, + fetchPolicy: "network-only" + }); + + if (loading) return ; + if (error) return
{error.message}
; + let normalizedData; + if (data) { + normalizedData = data.appointments.map(e => { + //Required becuase Hasura returns a string instead of a date object. + return Object.assign( + {}, + e, + { start: new Date(e.start) }, + { end: new Date(e.end) } + ); + }); + } + + return ( + + ); +} diff --git a/client/src/components/schedule-event/schedule-event.component.js b/client/src/components/schedule-event/schedule-event.component.jsx similarity index 55% rename from client/src/components/schedule-event/schedule-event.component.js rename to client/src/components/schedule-event/schedule-event.component.jsx index 2544d1d0d..e9bcd1918 100644 --- a/client/src/components/schedule-event/schedule-event.component.js +++ b/client/src/components/schedule-event/schedule-event.component.jsx @@ -5,7 +5,7 @@ import PhoneFormatter from "../../utils/PhoneFormatter"; import { Link } from "react-router-dom"; import { useTranslation } from "react-i18next"; -export default function Event({ event }) { +export default function ScheduleEventComponent({ event, handleCancel }) { const { t } = useTranslation(); const popoverContent = (
@@ -23,19 +23,35 @@ export default function Event({ event }) { {event.job.ownr_ph1}
- + - - + + +
); 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.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 || ""}`} +
); diff --git a/client/src/components/schedule-event/schedule-event.container.jsx b/client/src/components/schedule-event/schedule-event.container.jsx new file mode 100644 index 000000000..dc31562af --- /dev/null +++ b/client/src/components/schedule-event/schedule-event.container.jsx @@ -0,0 +1,16 @@ +import React from "react"; +import { useMutation } from "react-apollo"; +import { CANCEL_APPOINTMENT_BY_ID } from "../../graphql/appointments.queries"; +import ScheduleEventComponent from "./schedule-event.component"; + +export default function ScheduleEventContainer({ event, refetch }) { + const [cancelAppointment] = useMutation(CANCEL_APPOINTMENT_BY_ID); + console.log("refetch", refetch); + const handleCancel = id => { + cancelAppointment({ variables: { appid: event.id } }).then(r => { + if (refetch) refetch(); + }); + }; + + return ; +} diff --git a/client/src/components/schedule-job-modal/schedule-job-modal.component.jsx b/client/src/components/schedule-job-modal/schedule-job-modal.component.jsx index 98a6bb1a7..782abc5ce 100644 --- a/client/src/components/schedule-job-modal/schedule-job-modal.component.jsx +++ b/client/src/components/schedule-job-modal/schedule-job-modal.component.jsx @@ -1,35 +1,57 @@ +import { Checkbox, DatePicker, Modal, Tabs, TimePicker, Col, Row } from "antd"; import React from "react"; -import { Modal, Tabs, DatePicker, TimePicker } from "antd"; -import moment from "moment"; +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(); return ( - + Automatic Job Selection. - Manual Job Selection Scheduled Time - { - setAppData({ ...appData, start: e }); - }} - /> - { - setAppData({ ...appData, start: e }); - }} - /> + + + Manual Job Selection Scheduled Time + { + 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-job-modal/schedule-job-modal.container.jsx b/client/src/components/schedule-job-modal/schedule-job-modal.container.jsx index 2a6f13681..89b47e8d7 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 @@ -3,7 +3,8 @@ import ScheduleJobModalComponent from "./schedule-job-modal.component"; import { useMutation } from "react-apollo"; import { INSERT_APPOINTMENT } from "../../graphql/appointments.queries"; import moment from "moment"; - +import { notification } from "antd"; +import { useTranslation } from "react-i18next"; export default function ScheduleJobModalContainer({ scheduleModalState, jobId @@ -11,11 +12,15 @@ export default function ScheduleJobModalContainer({ const [scheduleModalVisible, setscheduleModalVisible] = scheduleModalState; const [appData, setAppData] = useState({ jobid: jobId, start: null }); const [insertAppointment] = useMutation(INSERT_APPOINTMENT); + const [formData, setFormData] = useState({ notifyCustomer: false }); + const { t } = useTranslation(); return ( setscheduleModalVisible(false)} @@ -25,9 +30,25 @@ export default function ScheduleJobModalContainer({ variables: { app: { ...appData, end: moment(appData.start).add(60, "minutes") } } - }).then(r => { - setscheduleModalVisible(false); - }); + }) + .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); + }) + .catch(error => { + notification["error"]({ + message: t("appointments.errors.saving", { + message: error.message + }) + }); + }); }} /> ); diff --git a/client/src/graphql/appointments.queries.js b/client/src/graphql/appointments.queries.js index 0c530769d..99c55d265 100644 --- a/client/src/graphql/appointments.queries.js +++ b/client/src/graphql/appointments.queries.js @@ -1,8 +1,8 @@ import { gql } from "apollo-boost"; -export const QUERY_ALL_APPOINTMENTS = gql` - query QUERY_ALL_APPOINTMENTS { - appointments { +export const QUERY_ALL_ACTIVE_APPOINTMENTS = gql` + query QUERY_ALL_ACTIVE_APPOINTMENTS { + appointments(where: { canceled: { _eq: false } }) { start id end @@ -35,3 +35,42 @@ 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 } }) { + start + id + end + job { + ro_number + ownr_ln + ownr_fn + ownr_ph1 + ownr_ea + clm_total + id + clm_no + vehicle { + id + v_model_yr + v_make_desc + v_model_desc + } + } + } + } +`; + +export const CANCEL_APPOINTMENT_BY_ID = gql` + mutation CANCEL_APPOINTMENT_BY_ID($appid: uuid!) { + update_appointments( + where: { id: { _eq: $appid } } + _set: { canceled: true } + ) { + returning { + id + } + } + } +`; diff --git a/client/src/redux/user/user.sagas.js b/client/src/redux/user/user.sagas.js index 358105534..9d8d8ca08 100644 --- a/client/src/redux/user/user.sagas.js +++ b/client/src/redux/user/user.sagas.js @@ -26,6 +26,9 @@ import UserActionTypes from "./user.types"; export function* signInWithEmail({ payload: { email, password } }) { try { const { user } = yield auth.signInWithEmailAndPassword(email, password); + let token = yield user.getIdToken(); + localStorage.setItem("token", token); + window.sessionStorage.setItem(`lastTokenRefreshTime`, new Date()); yield put( signInSuccess({ uid: user.uid, diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index fa24befdc..bd7046ac9 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1,5 +1,22 @@ { "translation": { + "appointments": { + "actions": { + "cancel": "Cancel", + "intake": "Intake", + "reschedule": "Reschedule", + "viewjob": "View Job" + }, + "errors": { + "saving": "Error scheduling appointment. {{message}}" + }, + "labels": { + "nodateselected": "No date has been selected." + }, + "successes": { + "created": "Appointment scheduled successfully." + } + }, "associations": { "actions": { "activate": "Activate" @@ -176,6 +193,7 @@ "vehicle": "Vehicle" }, "labels": { + "appointmentconfirmation": "Send confirmation to customer?", "available_new_jobs": "", "cards": { "appraiser": "Appraiser", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 61243f5e3..6105a3bda 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1,5 +1,22 @@ { "translation": { + "appointments": { + "actions": { + "cancel": "Cancelar", + "intake": "Consumo", + "reschedule": "Reprogramar", + "viewjob": "Ver trabajo" + }, + "errors": { + "saving": "Error al programar la cita. {{message}}" + }, + "labels": { + "nodateselected": "No se ha seleccionado ninguna fecha." + }, + "successes": { + "created": "Cita programada con éxito." + } + }, "associations": { "actions": { "activate": "Activar" @@ -176,6 +193,7 @@ "vehicle": "Vehículo" }, "labels": { + "appointmentconfirmation": "¿Enviar confirmación al cliente?", "available_new_jobs": "", "cards": { "appraiser": "Tasador", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 9d1d59445..687277f2b 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1,5 +1,22 @@ { "translation": { + "appointments": { + "actions": { + "cancel": "annuler", + "intake": "Admission", + "reschedule": "Replanifier", + "viewjob": "Voir le travail" + }, + "errors": { + "saving": "Erreur lors de la planification du rendez-vous. {{message}}" + }, + "labels": { + "nodateselected": "Aucune date n'a été sélectionnée." + }, + "successes": { + "created": "Rendez-vous planifié avec succès." + } + }, "associations": { "actions": { "activate": "Activer" @@ -176,6 +193,7 @@ "vehicle": "Véhicule" }, "labels": { + "appointmentconfirmation": "Envoyer une confirmation au client?", "available_new_jobs": "", "cards": { "appraiser": "Expert", diff --git a/hasura/migrations/1581011347492_delete_permission_anonymous_public_table_users/down.yaml b/hasura/migrations/1581011347492_delete_permission_anonymous_public_table_users/down.yaml new file mode 100644 index 000000000..2ed833fbd --- /dev/null +++ b/hasura/migrations/1581011347492_delete_permission_anonymous_public_table_users/down.yaml @@ -0,0 +1,17 @@ +- args: + permission: + columns: + - authid + - email + - created_at + - updated_at + filter: {} + localPresets: + - key: "" + value: "" + set: {} + role: anonymous + table: + name: users + schema: public + type: create_update_permission diff --git a/hasura/migrations/1581011347492_delete_permission_anonymous_public_table_users/up.yaml b/hasura/migrations/1581011347492_delete_permission_anonymous_public_table_users/up.yaml new file mode 100644 index 000000000..adfb8ed02 --- /dev/null +++ b/hasura/migrations/1581011347492_delete_permission_anonymous_public_table_users/up.yaml @@ -0,0 +1,6 @@ +- args: + role: anonymous + table: + name: users + schema: public + type: drop_update_permission diff --git a/hasura/migrations/1581011354989_delete_permission_anonymous_public_table_users/down.yaml b/hasura/migrations/1581011354989_delete_permission_anonymous_public_table_users/down.yaml new file mode 100644 index 000000000..5b6a124be --- /dev/null +++ b/hasura/migrations/1581011354989_delete_permission_anonymous_public_table_users/down.yaml @@ -0,0 +1,17 @@ +- args: + permission: + check: {} + columns: + - authid + - created_at + - email + - updated_at + localPresets: + - key: "" + value: "" + set: {} + role: anonymous + table: + name: users + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1581011354989_delete_permission_anonymous_public_table_users/up.yaml b/hasura/migrations/1581011354989_delete_permission_anonymous_public_table_users/up.yaml new file mode 100644 index 000000000..8d7fedcea --- /dev/null +++ b/hasura/migrations/1581011354989_delete_permission_anonymous_public_table_users/up.yaml @@ -0,0 +1,6 @@ +- args: + role: anonymous + table: + name: users + schema: public + type: drop_insert_permission diff --git a/hasura/migrations/1581011359698_delete_permission_anonymous_public_table_users/down.yaml b/hasura/migrations/1581011359698_delete_permission_anonymous_public_table_users/down.yaml new file mode 100644 index 000000000..6da8f77e4 --- /dev/null +++ b/hasura/migrations/1581011359698_delete_permission_anonymous_public_table_users/down.yaml @@ -0,0 +1,12 @@ +- args: + permission: + allow_aggregations: false + columns: + - authid + computed_fields: [] + filter: {} + role: anonymous + table: + name: users + schema: public + type: create_select_permission diff --git a/hasura/migrations/1581011359698_delete_permission_anonymous_public_table_users/up.yaml b/hasura/migrations/1581011359698_delete_permission_anonymous_public_table_users/up.yaml new file mode 100644 index 000000000..56426a31b --- /dev/null +++ b/hasura/migrations/1581011359698_delete_permission_anonymous_public_table_users/up.yaml @@ -0,0 +1,6 @@ +- args: + role: anonymous + table: + name: users + schema: public + type: drop_select_permission diff --git a/hasura/migrations/1581022739131_alter_table_public_appointments_add_column_canceled/down.yaml b/hasura/migrations/1581022739131_alter_table_public_appointments_add_column_canceled/down.yaml new file mode 100644 index 000000000..dfcf08d41 --- /dev/null +++ b/hasura/migrations/1581022739131_alter_table_public_appointments_add_column_canceled/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."appointments" DROP COLUMN "canceled"; + type: run_sql diff --git a/hasura/migrations/1581022739131_alter_table_public_appointments_add_column_canceled/up.yaml b/hasura/migrations/1581022739131_alter_table_public_appointments_add_column_canceled/up.yaml new file mode 100644 index 000000000..04e88be2f --- /dev/null +++ b/hasura/migrations/1581022739131_alter_table_public_appointments_add_column_canceled/up.yaml @@ -0,0 +1,4 @@ +- args: + sql: ALTER TABLE "public"."appointments" ADD COLUMN "canceled" boolean NOT NULL + DEFAULT false; + type: run_sql diff --git a/hasura/migrations/1581022751236_alter_table_public_appointments_add_column_arrived/down.yaml b/hasura/migrations/1581022751236_alter_table_public_appointments_add_column_arrived/down.yaml new file mode 100644 index 000000000..fe4587381 --- /dev/null +++ b/hasura/migrations/1581022751236_alter_table_public_appointments_add_column_arrived/down.yaml @@ -0,0 +1,3 @@ +- args: + sql: ALTER TABLE "public"."appointments" DROP COLUMN "arrived"; + type: run_sql diff --git a/hasura/migrations/1581022751236_alter_table_public_appointments_add_column_arrived/up.yaml b/hasura/migrations/1581022751236_alter_table_public_appointments_add_column_arrived/up.yaml new file mode 100644 index 000000000..b3d4fe679 --- /dev/null +++ b/hasura/migrations/1581022751236_alter_table_public_appointments_add_column_arrived/up.yaml @@ -0,0 +1,4 @@ +- args: + sql: ALTER TABLE "public"."appointments" ADD COLUMN "arrived" boolean NOT NULL + DEFAULT false; + type: run_sql diff --git a/hasura/migrations/1581022758869_update_permission_user_public_table_appointments/down.yaml b/hasura/migrations/1581022758869_update_permission_user_public_table_appointments/down.yaml new file mode 100644 index 000000000..b56eb5bbf --- /dev/null +++ b/hasura/migrations/1581022758869_update_permission_user_public_table_appointments/down.yaml @@ -0,0 +1,34 @@ +- 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: + - 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/1581022758869_update_permission_user_public_table_appointments/up.yaml b/hasura/migrations/1581022758869_update_permission_user_public_table_appointments/up.yaml new file mode 100644 index 000000000..34cf4841b --- /dev/null +++ b/hasura/migrations/1581022758869_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: + 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/1581022764017_update_permission_user_public_table_appointments/down.yaml b/hasura/migrations/1581022764017_update_permission_user_public_table_appointments/down.yaml new file mode 100644 index 000000000..69c1cdc57 --- /dev/null +++ b/hasura/migrations/1581022764017_update_permission_user_public_table_appointments/down.yaml @@ -0,0 +1,32 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - 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/1581022764017_update_permission_user_public_table_appointments/up.yaml b/hasura/migrations/1581022764017_update_permission_user_public_table_appointments/up.yaml new file mode 100644 index 000000000..d71784d2e --- /dev/null +++ b/hasura/migrations/1581022764017_update_permission_user_public_table_appointments/up.yaml @@ -0,0 +1,34 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + 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/1581022771283_update_permission_user_public_table_appointments/down.yaml b/hasura/migrations/1581022771283_update_permission_user_public_table_appointments/down.yaml new file mode 100644 index 000000000..c44b9394c --- /dev/null +++ b/hasura/migrations/1581022771283_update_permission_user_public_table_appointments/down.yaml @@ -0,0 +1,34 @@ +- args: + role: user + table: + name: appointments + schema: public + type: drop_update_permission +- args: + permission: + columns: + - 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/1581022771283_update_permission_user_public_table_appointments/up.yaml b/hasura/migrations/1581022771283_update_permission_user_public_table_appointments/up.yaml new file mode 100644 index 000000000..1644cd131 --- /dev/null +++ b/hasura/migrations/1581022771283_update_permission_user_public_table_appointments/up.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