-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #956 from funmusicplace/various-fixes
Various fixes
- Loading branch information
Showing
9 changed files
with
64 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
doctype html | ||
html | ||
head | ||
block head | ||
meta(charset="utf-8") | ||
meta(name="viewport", content="width=device-width") | ||
meta(http-equiv="X-UA-Compatible", content="IE=edge") | ||
meta(name="x-apple-disable-message-reformatting") | ||
link(rel="stylesheet", href="style.css", data-inline) | ||
body.sans-serif | ||
.pa4 | ||
| There was an error in the application: | ||
| #{error} | ||
| Happened at #{time} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
= `Error in application` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
| Error | ||
| #{error} | ||
| time: #{time} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import sendgrid from "nodemailer-sendgrid"; | |
import Email from "email-templates"; | ||
import { logger } from "../logger"; | ||
import { Job } from "bullmq"; | ||
import Mail from "nodemailer/lib/mailer"; | ||
|
||
const viewsDir = path.join(__dirname, "../emails"); | ||
|
||
|
@@ -15,11 +16,25 @@ const transport: Transporter = !!process.env.SENDGRID_API_KEY | |
) | ||
: ({ jsonTransport: true } as unknown as Transporter); | ||
|
||
/** | ||
* Cleanup incoming folder and more (later) | ||
*/ | ||
export const sendErrorEmail = async (error: unknown) => { | ||
sendMail({ | ||
data: { | ||
template: "error-email", | ||
message: { | ||
to: "[email protected]", | ||
}, | ||
locals: { error: JSON.stringify(error), time: new Date().toDateString() }, | ||
}, | ||
}); | ||
}; | ||
|
||
export const sendMail = async (job: Job) => { | ||
export const sendMail = async (job: { | ||
data: { | ||
template: string; | ||
message: Mail.Options; | ||
locals: { [key: string]: any }; | ||
}; | ||
}) => { | ||
logger.info(`sendMail: sending: ${job.data.template}`); | ||
try { | ||
const email = new Email({ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters