Resolve missing query paramters.
This commit is contained in:
@@ -166,15 +166,13 @@ const taskAssignedEmail = async (req, res) => {
|
||||
const dirty = req.body.event.data?.old && req.body.event.data?.old?.assigned_to;
|
||||
|
||||
//Query to get the employee assigned currently.
|
||||
const {
|
||||
employees_by_pk: { user_email }
|
||||
} = await client.request(queries.QUERY_EMPLOYEE_EMAIL_BY_ID, {
|
||||
id: newTask.assigned_to
|
||||
const { tasks_by_pk } = await client.request(queries.QUERY_TASK_BY_ID, {
|
||||
id: newTask.id
|
||||
});
|
||||
|
||||
sendMail(
|
||||
"assigned",
|
||||
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}`,
|
||||
generateEmailTemplate(
|
||||
generateTemplateArgs(
|
||||
@@ -182,8 +180,8 @@ const taskAssignedEmail = async (req, res) => {
|
||||
newTask.priority,
|
||||
newTask.description,
|
||||
newTask.due_date,
|
||||
newTask.bodyshop,
|
||||
newTask.job,
|
||||
tasks_by_pk.bodyshop,
|
||||
tasks_by_pk.job,
|
||||
newTask.id
|
||||
)
|
||||
)
|
||||
|
||||
@@ -2443,11 +2443,26 @@ exports.UPDATE_TASKS_REMIND_AT_SENT = `mutation UPDATE_TASK_REMIND_AT_SENT($task
|
||||
}
|
||||
}`;
|
||||
|
||||
exports.QUERY_EMPLOYEE_EMAIL_BY_ID = `
|
||||
query QUERY_EMPLOYEE_EMAIL_BY_ID($id: uuid!) {
|
||||
employees_by_pk(id: $id) {
|
||||
exports.QUERY_TASK_BY_ID = `
|
||||
query QUERY_TASK_BY_ID($id: uuid!) {
|
||||
tasks_by_pk(id: $id) {
|
||||
id
|
||||
user_email
|
||||
assigned_to_employee{
|
||||
id
|
||||
user_email
|
||||
}
|
||||
bodyshop{
|
||||
shopname
|
||||
}
|
||||
job{
|
||||
ro_number
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
ownr_co_nm
|
||||
v_make_desc
|
||||
v_model_desc
|
||||
v_model_yr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user