- Add additional field to tasks table

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-04-09 11:18:43 -04:00
parent 33c282051b
commit 26cb527d37
5 changed files with 22 additions and 28 deletions

View File

@@ -832,13 +832,6 @@
table:
name: ioevents
schema: public
- name: ioevents
using:
foreign_key_constraint_on:
column: bodyshopid
table:
name: ioevents
schema: public
- name: jobs
using:
foreign_key_constraint_on:
@@ -874,13 +867,6 @@
table:
name: tasks
schema: public
- name: tasks
using:
foreign_key_constraint_on:
column: bodyshopid
table:
name: tasks
schema: public
- name: timetickets
using:
foreign_key_constraint_on:
@@ -3369,13 +3355,6 @@
table:
name: tasks
schema: public
- name: tasks
using:
foreign_key_constraint_on:
column: jobid
table:
name: tasks
schema: public
- name: timetickets
using:
foreign_key_constraint_on:
@@ -5080,13 +5059,6 @@
table:
name: tasks
schema: public
- name: tasks
using:
foreign_key_constraint_on:
column: partsorderid
table:
name: tasks
schema: public
insert_permissions:
- role: user
permission:

View File

@@ -0,0 +1,4 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."tasks" add column "remind_at_sent" timestamptz
-- null;

View File

@@ -0,0 +1,2 @@
alter table "public"."tasks" add column "remind_at_sent" timestamptz
null;

View File

@@ -84,6 +84,18 @@ exports.sendTaskEmail = async function ({ to, subject, text, attachments }) {
}
};
// This will be called by a Hasura event trigger
exports.taskAssignedEmail = async function (req, res) {
console.dir(req, { depth: null });
return res.status(200).json(req);
};
// This will be called by a Hasura event trigger
exports.tasksRemindEmail = async function (req, res) {
console.dir(req, { depth: null });
return res.status(200).json(req);
};
exports.sendEmail = async (req, res) => {
logger.log("send-email", "DEBUG", req.user.email, null, {
from: `${req.body.from.name} <${req.body.from.address}>`,

View File

@@ -40,6 +40,10 @@ router.post("/ioevent", ioevent.default);
router.post("/sendemail", validateFirebaseIdTokenMiddleware, sendEmail.sendEmail);
router.post("/emailbounce", bodyParser.text(), sendEmail.emailBounce);
// Tasks Email Handler
router.post("/tasks-assigned-handler", eventAuthorizationMiddleware, sendEmail.taskAssignedEmail);
router.post("/tasks-remind-handler", eventAuthorizationMiddleware, sendEmail.tasksRemindEmail);
// Handlers
router.post("/record-handler/arms", data.arms);
router.post("/taskHandler", validateFirebaseIdTokenMiddleware, taskHandler.taskHandler);