@@ -207,6 +207,7 @@
|
|||||||
- default_prod_list_view
|
- default_prod_list_view
|
||||||
- id
|
- id
|
||||||
- kanban_settings
|
- kanban_settings
|
||||||
|
- notification_settings
|
||||||
- qbo_realmId
|
- qbo_realmId
|
||||||
- shopid
|
- shopid
|
||||||
- useremail
|
- useremail
|
||||||
@@ -222,6 +223,7 @@
|
|||||||
- authlevel
|
- authlevel
|
||||||
- default_prod_list_view
|
- default_prod_list_view
|
||||||
- kanban_settings
|
- kanban_settings
|
||||||
|
- notification_settings
|
||||||
- qbo_realmId
|
- qbo_realmId
|
||||||
filter:
|
filter:
|
||||||
user:
|
user:
|
||||||
@@ -681,6 +683,31 @@
|
|||||||
- exported:
|
- exported:
|
||||||
_eq: false
|
_eq: false
|
||||||
event_triggers:
|
event_triggers:
|
||||||
|
- name: notifications_bills
|
||||||
|
definition:
|
||||||
|
enable_manual: false
|
||||||
|
insert:
|
||||||
|
columns: '*'
|
||||||
|
retry_conf:
|
||||||
|
interval_sec: 10
|
||||||
|
num_retries: 0
|
||||||
|
timeout_sec: 60
|
||||||
|
webhook_from_env: HASURA_API_URL
|
||||||
|
headers:
|
||||||
|
- name: event-secret
|
||||||
|
value_from_env: EVENT_SECRET
|
||||||
|
request_transform:
|
||||||
|
body:
|
||||||
|
action: transform
|
||||||
|
template: |-
|
||||||
|
{
|
||||||
|
"success": true
|
||||||
|
}
|
||||||
|
method: POST
|
||||||
|
query_params: {}
|
||||||
|
template_engine: Kriti
|
||||||
|
url: '{{$base_url}}/job/events/handleBillsChange'
|
||||||
|
version: 2
|
||||||
- name: os_bills
|
- name: os_bills
|
||||||
definition:
|
definition:
|
||||||
delete:
|
delete:
|
||||||
@@ -2805,6 +2832,80 @@
|
|||||||
_eq: X-Hasura-User-Id
|
_eq: X-Hasura-User-Id
|
||||||
- active:
|
- active:
|
||||||
_eq: true
|
_eq: true
|
||||||
|
- table:
|
||||||
|
name: job_watchers
|
||||||
|
schema: public
|
||||||
|
object_relationships:
|
||||||
|
- name: job
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: jobid
|
||||||
|
- name: user
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: user_email
|
||||||
|
insert_permissions:
|
||||||
|
- role: user
|
||||||
|
permission:
|
||||||
|
check:
|
||||||
|
user:
|
||||||
|
_and:
|
||||||
|
- associations:
|
||||||
|
active:
|
||||||
|
_eq: true
|
||||||
|
- authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
columns:
|
||||||
|
- user_email
|
||||||
|
- created_at
|
||||||
|
- id
|
||||||
|
- jobid
|
||||||
|
comment: ""
|
||||||
|
select_permissions:
|
||||||
|
- role: user
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- user_email
|
||||||
|
- created_at
|
||||||
|
- id
|
||||||
|
- jobid
|
||||||
|
filter:
|
||||||
|
user:
|
||||||
|
_and:
|
||||||
|
- associations:
|
||||||
|
active:
|
||||||
|
_eq: true
|
||||||
|
- authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
comment: ""
|
||||||
|
update_permissions:
|
||||||
|
- role: user
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- user_email
|
||||||
|
- created_at
|
||||||
|
- id
|
||||||
|
- jobid
|
||||||
|
filter:
|
||||||
|
user:
|
||||||
|
_and:
|
||||||
|
- associations:
|
||||||
|
active:
|
||||||
|
_eq: true
|
||||||
|
- authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
check: null
|
||||||
|
comment: ""
|
||||||
|
delete_permissions:
|
||||||
|
- role: user
|
||||||
|
permission:
|
||||||
|
filter:
|
||||||
|
user:
|
||||||
|
_and:
|
||||||
|
- associations:
|
||||||
|
active:
|
||||||
|
_eq: true
|
||||||
|
- authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
comment: ""
|
||||||
- table:
|
- table:
|
||||||
name: joblines
|
name: joblines
|
||||||
schema: public
|
schema: public
|
||||||
@@ -4326,6 +4427,58 @@
|
|||||||
template_engine: Kriti
|
template_engine: Kriti
|
||||||
url: '{{$base_url}}/record-handler/arms'
|
url: '{{$base_url}}/record-handler/arms'
|
||||||
version: 2
|
version: 2
|
||||||
|
- name: notifications_jobs
|
||||||
|
definition:
|
||||||
|
enable_manual: false
|
||||||
|
insert:
|
||||||
|
columns: '*'
|
||||||
|
update:
|
||||||
|
columns:
|
||||||
|
- queued_for_parts
|
||||||
|
- employee_prep
|
||||||
|
- clm_total
|
||||||
|
- towin
|
||||||
|
- employee_body
|
||||||
|
- converted
|
||||||
|
- scheduled_in
|
||||||
|
- scheduled_completion
|
||||||
|
- scheduled_delivery
|
||||||
|
- actual_delivery
|
||||||
|
- actual_completion
|
||||||
|
- alt_transport
|
||||||
|
- date_exported
|
||||||
|
- status
|
||||||
|
- employee_csr
|
||||||
|
- actual_in
|
||||||
|
- deliverchecklist
|
||||||
|
- comment
|
||||||
|
- job_totals
|
||||||
|
- employee_refinish
|
||||||
|
- inproduction
|
||||||
|
- production_vars
|
||||||
|
- intakechecklist
|
||||||
|
- cieca_ttl
|
||||||
|
- date_invoiced
|
||||||
|
retry_conf:
|
||||||
|
interval_sec: 10
|
||||||
|
num_retries: 0
|
||||||
|
timeout_sec: 60
|
||||||
|
webhook_from_env: HASURA_API_URL
|
||||||
|
headers:
|
||||||
|
- name: event-secret
|
||||||
|
value_from_env: EVENT_SECRET
|
||||||
|
request_transform:
|
||||||
|
body:
|
||||||
|
action: transform
|
||||||
|
template: |-
|
||||||
|
{
|
||||||
|
"success": true
|
||||||
|
}
|
||||||
|
method: POST
|
||||||
|
query_params: {}
|
||||||
|
template_engine: Kriti
|
||||||
|
url: '{{$base_url}}/job/events/handleJobsChange'
|
||||||
|
version: 2
|
||||||
- name: os_jobs
|
- name: os_jobs
|
||||||
definition:
|
definition:
|
||||||
delete:
|
delete:
|
||||||
@@ -4669,6 +4822,57 @@
|
|||||||
_eq: X-Hasura-User-Id
|
_eq: X-Hasura-User-Id
|
||||||
- active:
|
- active:
|
||||||
_eq: true
|
_eq: true
|
||||||
|
- table:
|
||||||
|
name: notifications
|
||||||
|
schema: public
|
||||||
|
object_relationships:
|
||||||
|
- name: association
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: associationid
|
||||||
|
- name: job
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: jobid
|
||||||
|
select_permissions:
|
||||||
|
- role: user
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- associationid
|
||||||
|
- created_at
|
||||||
|
- fcm_data
|
||||||
|
- fcm_message
|
||||||
|
- fcm_title
|
||||||
|
- id
|
||||||
|
- jobid
|
||||||
|
- meta
|
||||||
|
- read
|
||||||
|
- ui_translation_meta
|
||||||
|
- ui_translation_string
|
||||||
|
- updated_at
|
||||||
|
filter:
|
||||||
|
association:
|
||||||
|
_and:
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
comment: ""
|
||||||
|
update_permissions:
|
||||||
|
- role: user
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- meta
|
||||||
|
- read
|
||||||
|
filter:
|
||||||
|
association:
|
||||||
|
_and:
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
check: null
|
||||||
|
comment: ""
|
||||||
- table:
|
- table:
|
||||||
name: owners
|
name: owners
|
||||||
schema: public
|
schema: public
|
||||||
@@ -4909,6 +5113,32 @@
|
|||||||
- active:
|
- active:
|
||||||
_eq: true
|
_eq: true
|
||||||
check: null
|
check: null
|
||||||
|
event_triggers:
|
||||||
|
- name: notifications_parts_dispatch
|
||||||
|
definition:
|
||||||
|
enable_manual: false
|
||||||
|
insert:
|
||||||
|
columns: '*'
|
||||||
|
retry_conf:
|
||||||
|
interval_sec: 10
|
||||||
|
num_retries: 0
|
||||||
|
timeout_sec: 60
|
||||||
|
webhook_from_env: HASURA_API_URL
|
||||||
|
headers:
|
||||||
|
- name: event-secret
|
||||||
|
value_from_env: EVENT_SECRET
|
||||||
|
request_transform:
|
||||||
|
body:
|
||||||
|
action: transform
|
||||||
|
template: |-
|
||||||
|
{
|
||||||
|
"success": true
|
||||||
|
}
|
||||||
|
method: POST
|
||||||
|
query_params: {}
|
||||||
|
template_engine: Kriti
|
||||||
|
url: '{{$base_url}}/job/events/handlePartsDispatchChange'
|
||||||
|
version: 2
|
||||||
- table:
|
- table:
|
||||||
name: parts_dispatch_lines
|
name: parts_dispatch_lines
|
||||||
schema: public
|
schema: public
|
||||||
@@ -5887,6 +6117,8 @@
|
|||||||
update:
|
update:
|
||||||
columns:
|
columns:
|
||||||
- assigned_to
|
- assigned_to
|
||||||
|
- completed
|
||||||
|
- description
|
||||||
retry_conf:
|
retry_conf:
|
||||||
interval_sec: 10
|
interval_sec: 10
|
||||||
num_retries: 3
|
num_retries: 3
|
||||||
@@ -6035,6 +6267,32 @@
|
|||||||
_eq: X-Hasura-User-Id
|
_eq: X-Hasura-User-Id
|
||||||
- active:
|
- active:
|
||||||
_eq: true
|
_eq: true
|
||||||
|
event_triggers:
|
||||||
|
- name: notifications_time_tickets
|
||||||
|
definition:
|
||||||
|
enable_manual: false
|
||||||
|
insert:
|
||||||
|
columns: '*'
|
||||||
|
retry_conf:
|
||||||
|
interval_sec: 10
|
||||||
|
num_retries: 0
|
||||||
|
timeout_sec: 60
|
||||||
|
webhook_from_env: HASURA_API_URL
|
||||||
|
headers:
|
||||||
|
- name: event-secret
|
||||||
|
value_from_env: EVENT_SECRET
|
||||||
|
request_transform:
|
||||||
|
body:
|
||||||
|
action: transform
|
||||||
|
template: |-
|
||||||
|
{
|
||||||
|
"success": true
|
||||||
|
}
|
||||||
|
method: POST
|
||||||
|
query_params: {}
|
||||||
|
template_engine: Kriti
|
||||||
|
url: '{{$base_url}}/job/events/handleTimeTicketsChange'
|
||||||
|
version: 2
|
||||||
- table:
|
- table:
|
||||||
name: transitions
|
name: transitions
|
||||||
schema: public
|
schema: public
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- alter table "public"."associations" add column "notification_settings" jsonb
|
||||||
|
-- null;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."associations" add column "notification_settings" jsonb
|
||||||
|
null;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
DROP TABLE "public"."notifications";
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
CREATE TABLE "public"."notifications" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "job_id" uuid NOT NULL, "association_id" uuid NOT NULL, "ui_translation_string" text NOT NULL, "ui_translation_meta" jsonb, "fcm_title" text NOT NULL, "fcm_message" text NOT NULL, "fcm_data" jsonb, "read" timestamptz, "meta" jsonb, "scenario" Integer NOT NULL, PRIMARY KEY ("id") , FOREIGN KEY ("job_id") REFERENCES "public"."jobs"("id") ON UPDATE restrict ON DELETE restrict, FOREIGN KEY ("association_id") REFERENCES "public"."associations"("id") ON UPDATE restrict ON DELETE restrict, UNIQUE ("id"));COMMENT ON TABLE "public"."notifications" IS E'Real Time Notifications System';
|
||||||
|
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
comment on column "public"."notifications"."scenario" is E'Real Time Notifications System';
|
||||||
|
alter table "public"."notifications" alter column "scenario" drop not null;
|
||||||
|
alter table "public"."notifications" add column "scenario" int4;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table "public"."notifications" drop column "scenario" cascade;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- alter table "public"."notifications" add column "scenario" text
|
||||||
|
-- not null;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."notifications" add column "scenario" text
|
||||||
|
not null;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
DROP TABLE "public"."job_watchers";
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
CREATE TABLE "public"."job_watchers" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "job_id" uuid NOT NULL, "user_email" text NOT NULL, "created_at" timestamptz NOT NULL DEFAULT now(), PRIMARY KEY ("id") , FOREIGN KEY ("user_email") REFERENCES "public"."users"("email") ON UPDATE restrict ON DELETE restrict, FOREIGN KEY ("job_id") REFERENCES "public"."jobs"("id") ON UPDATE restrict ON DELETE restrict, UNIQUE ("id"));COMMENT ON TABLE "public"."job_watchers" IS E'Job Watchers';
|
||||||
|
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
comment on column "public"."notifications"."scenario" is E'Real Time Notifications System';
|
||||||
|
alter table "public"."notifications" alter column "scenario" drop not null;
|
||||||
|
alter table "public"."notifications" add column "scenario" text;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table "public"."notifications" drop column "scenario" cascade;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- update associations set notification_settings = '{}';
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
update associations set notification_settings = '{}';
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table "public"."associations" alter column "notification_settings" drop not null;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table "public"."associations" alter column "notification_settings" set not null;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- update notifications set meta = '{}';
|
||||||
|
-- update notifications set fcm_data = '{}';
|
||||||
|
-- update notifications set ui_translation_meta = '{}';
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
update notifications set meta = '{}';
|
||||||
|
update notifications set fcm_data = '{}';
|
||||||
|
update notifications set ui_translation_meta = '{}';
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."notifications" alter column "meta" drop not null;
|
||||||
|
ALTER TABLE "public"."notifications" ALTER COLUMN "meta" drop default;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."notifications" alter column "meta" set default jsonb_build_object();
|
||||||
|
alter table "public"."notifications" alter column "meta" set not null;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."notifications" alter column "fcm_data" drop not null;
|
||||||
|
ALTER TABLE "public"."notifications" ALTER COLUMN "fcm_data" drop default;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."notifications" alter column "fcm_data" set default jsonb_build_object();
|
||||||
|
alter table "public"."notifications" alter column "fcm_data" set not null;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."notifications" alter column "ui_translation_meta" drop not null;
|
||||||
|
ALTER TABLE "public"."notifications" ALTER COLUMN "ui_translation_meta" drop default;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."notifications" alter column "ui_translation_meta" set default jsonb_build_object();
|
||||||
|
alter table "public"."notifications" alter column "ui_translation_meta" set not null;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table "public"."notifications" rename column "jobid" to "job_id";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table "public"."notifications" rename column "job_id" to "jobid";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table "public"."notifications" rename column "associationid" to "association_id";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table "public"."notifications" rename column "association_id" to "associationid";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table "public"."job_watchers" rename column "jobid" to "job_id";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table "public"."job_watchers" rename column "job_id" to "jobid";
|
||||||
@@ -142,27 +142,38 @@ const sendMail = (type, to, subject, html, taskIds, successCallback, requestInst
|
|||||||
* @returns {Promise<*>}
|
* @returns {Promise<*>}
|
||||||
*/
|
*/
|
||||||
const taskAssignedEmail = async (req, res) => {
|
const taskAssignedEmail = async (req, res) => {
|
||||||
// We have no event Data, bail
|
// 1. Check if we have new task data in the event body.
|
||||||
if (!req?.body?.event?.data?.new) {
|
if (!req?.body?.event?.data?.new) {
|
||||||
return res.status(400).json({ message: "No data in the event body" });
|
return res.status(400).json({ message: "No data in the event body" });
|
||||||
}
|
}
|
||||||
|
|
||||||
const { new: newTask } = req.body.event.data;
|
const { new: newTask, old: oldTask } = req.body.event.data;
|
||||||
|
|
||||||
// This is not a new task, but a reassignment.
|
// TODO: THIS IS HERE BECAUSE THE HANDLER NOW DOES 3 FIELDS, WILL NEED TO BE BUILT ON FOR NOTIFICATIONS
|
||||||
const dirty = req.body.event.data?.old && req.body.event.data?.old?.assigned_to;
|
if (oldTask && oldTask.assigned_to === newTask.assigned_to) {
|
||||||
|
return res.status(200).json({ success: true, message: "assigned_to not changed" });
|
||||||
|
}
|
||||||
|
|
||||||
//Query to get the employee assigned currently.
|
// 3. If we made it here, assigned_to changed (or oldTask is missing),
|
||||||
|
// so we continue with the rest of the logic.
|
||||||
|
|
||||||
|
// Query to get the task with bodyshop data, assigned employee data, etc.
|
||||||
const { tasks_by_pk } = await client.request(queries.QUERY_TASK_BY_ID, {
|
const { tasks_by_pk } = await client.request(queries.QUERY_TASK_BY_ID, {
|
||||||
id: newTask.id
|
id: newTask.id
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Format date/time with the correct timezone
|
||||||
const dateLine = moment().tz(tasks_by_pk.bodyshop.timezone).format("M/DD/YYYY @ hh:mm a");
|
const dateLine = moment().tz(tasks_by_pk.bodyshop.timezone).format("M/DD/YYYY @ hh:mm a");
|
||||||
|
|
||||||
|
// This determines if it was re-assigned (old task exists and had an assigned_to).
|
||||||
|
const dirty = oldTask && oldTask.assigned_to;
|
||||||
|
|
||||||
sendMail(
|
sendMail(
|
||||||
"assigned",
|
"assigned",
|
||||||
tasks_by_pk.assigned_to_employee.user_email,
|
tasks_by_pk.assigned_to_employee.user_email,
|
||||||
`A ${formatPriority(newTask.priority)} priority task has been ${dirty ? "reassigned to" : "created for"} you - ${newTask.title}`,
|
`A ${formatPriority(newTask.priority)} priority task has been ${
|
||||||
|
dirty ? "reassigned" : "created"
|
||||||
|
} for you - ${newTask.title}`,
|
||||||
generateEmailTemplate(
|
generateEmailTemplate(
|
||||||
generateTemplateArgs(
|
generateTemplateArgs(
|
||||||
newTask.title,
|
newTask.title,
|
||||||
@@ -181,8 +192,8 @@ const taskAssignedEmail = async (req, res) => {
|
|||||||
tasks_by_pk.bodyshop.convenient_company
|
tasks_by_pk.bodyshop.convenient_company
|
||||||
);
|
);
|
||||||
|
|
||||||
// We return success regardless because we don't want to block the event trigger.
|
// Return success so we don't block the event trigger.
|
||||||
res.status(200).json({ success: true });
|
return res.status(200).json({ success: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
5
server/notifications/eventHandlers/handeJobsChange.js
Normal file
5
server/notifications/eventHandlers/handeJobsChange.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
const handleJobsChange = (req, res) => {
|
||||||
|
return res.status(200).json({ message: "Jobs change handled." });
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = handleJobsChange;
|
||||||
5
server/notifications/eventHandlers/handleBillsChange.js
Normal file
5
server/notifications/eventHandlers/handleBillsChange.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
const handleBillsChange = (req, res) => {
|
||||||
|
return res.status(200).json({ message: "Bills change handled." });
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = handleBillsChange;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
const handlePartsDispatchChange = (req, res) => {
|
||||||
|
return res.status(200).json({ message: "Parts Dispatch change handled." });
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = handlePartsDispatchChange;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
const handlePartsOrderChange = (req, res) => {
|
||||||
|
return res.status(200).json({ message: "Parts Order change handled." });
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = handlePartsOrderChange;
|
||||||
5
server/notifications/eventHandlers/handleTasksChange.js
Normal file
5
server/notifications/eventHandlers/handleTasksChange.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
const handleTasksChange = (req, res) => {
|
||||||
|
return res.status(200).json({ message: "Tasks change handled." });
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = handleTasksChange;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
const handleTimeTicketsChange = (req, res) => {
|
||||||
|
return res.status(200).json({ message: "Time Tickets change handled." });
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = handleTimeTicketsChange;
|
||||||
@@ -1,12 +1,28 @@
|
|||||||
const express = require("express");
|
const express = require("express");
|
||||||
const validateFirebaseIdTokenMiddleware = require("../middleware/validateFirebaseIdTokenMiddleware");
|
const validateFirebaseIdTokenMiddleware = require("../middleware/validateFirebaseIdTokenMiddleware");
|
||||||
const { subscribe, unsubscribe, sendNotification } = require("../firebase/firebase-handler");
|
const { subscribe, unsubscribe, sendNotification } = require("../firebase/firebase-handler");
|
||||||
|
const eventAuthorizationMiddleware = require("../middleware/eventAuthorizationMIddleware");
|
||||||
|
|
||||||
|
const handlePartsOrderChange = require("../notifications/eventHandlers/handlePartsOrderChange");
|
||||||
|
const handlePartsDispatchChange = require("../notifications/eventHandlers/handlePartsDispatchChange");
|
||||||
|
const handleTasksChange = require("../notifications/eventHandlers/handleTasksChange");
|
||||||
|
const handleTimeTicketsChange = require("../notifications/eventHandlers/handleTimeTicketsChange");
|
||||||
|
const handleJobsChange = require("../notifications/eventHandlers/handeJobsChange");
|
||||||
|
const handleBillsChange = require("../notifications/eventHandlers/handleBillsChange");
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
router.use(validateFirebaseIdTokenMiddleware);
|
// These are FCM handlers
|
||||||
|
router.post("/subscribe", validateFirebaseIdTokenMiddleware, subscribe);
|
||||||
|
router.post("/unsubscribe", validateFirebaseIdTokenMiddleware, unsubscribe);
|
||||||
|
router.post("/sendtestnotification", validateFirebaseIdTokenMiddleware, sendNotification);
|
||||||
|
|
||||||
router.post("/subscribe", subscribe);
|
// Hasura Entry points for creating notifications
|
||||||
router.post("/unsubscribe", unsubscribe);
|
router.post("/events/handleJobsChange", eventAuthorizationMiddleware, handleJobsChange);
|
||||||
router.post("/sendtestnotification", sendNotification);
|
router.post("/events/handleBillsChange", eventAuthorizationMiddleware, handleBillsChange);
|
||||||
|
router.post("/events/handlePartsOrderChange", eventAuthorizationMiddleware, handlePartsOrderChange);
|
||||||
|
router.post("/events/handlePartsDispatchChange", eventAuthorizationMiddleware, handlePartsDispatchChange);
|
||||||
|
router.post("/events/handleTasksChange", eventAuthorizationMiddleware, handleTasksChange);
|
||||||
|
router.post("/events/handleTimeTicketsChange", eventAuthorizationMiddleware, handleTimeTicketsChange);
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
Reference in New Issue
Block a user