chore: feedback from pull request
This commit is contained in:
@@ -80,7 +80,10 @@ export class LocalJobProvider extends BaseJobProvider {
|
|||||||
|
|
||||||
public getApiHandler() {
|
public getApiHandler() {
|
||||||
return async (req: NextApiRequest, res: NextApiResponse) => {
|
return async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
if (req.method === 'POST') {
|
if (req.method !== 'POST') {
|
||||||
|
res.status(405).send('Method not allowed');
|
||||||
|
}
|
||||||
|
|
||||||
const jobId = req.headers['x-job-id'];
|
const jobId = req.headers['x-job-id'];
|
||||||
const signature = req.headers['x-job-signature'];
|
const signature = req.headers['x-job-signature'];
|
||||||
const isRetry = req.headers['x-job-retry'] !== undefined;
|
const isRetry = req.headers['x-job-retry'] !== undefined;
|
||||||
@@ -215,9 +218,6 @@ export class LocalJobProvider extends BaseJobProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
res.status(200).send('OK');
|
res.status(200).send('OK');
|
||||||
} else {
|
|
||||||
res.status(405).send('Method not allowed');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import { sendConfirmationToken } from '../../server-only/user/send-confirmation-
|
|||||||
import type { JobDefinition } from '../client/_internal/job';
|
import type { JobDefinition } from '../client/_internal/job';
|
||||||
|
|
||||||
export const SEND_CONFIRMATION_EMAIL_JOB_DEFINITION = {
|
export const SEND_CONFIRMATION_EMAIL_JOB_DEFINITION = {
|
||||||
id: 'send.confirmation.email',
|
id: 'send.signup.confirmation.email',
|
||||||
name: 'Send Confirmation Email',
|
name: 'Send Confirmation Email',
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
trigger: {
|
trigger: {
|
||||||
name: 'send.confirmation.email',
|
name: 'send.signup.confirmation.email',
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
email: z.string().email(),
|
email: z.string().email(),
|
||||||
force: z.boolean().optional(),
|
force: z.boolean().optional(),
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ import { renderCustomEmailTemplate } from '../../utils/render-custom-email-templ
|
|||||||
import type { JobDefinition } from '../client/_internal/job';
|
import type { JobDefinition } from '../client/_internal/job';
|
||||||
|
|
||||||
export const SEND_SIGNING_EMAIL_JOB_DEFINITION = {
|
export const SEND_SIGNING_EMAIL_JOB_DEFINITION = {
|
||||||
id: 'send.signing.email',
|
id: 'send.signing.requested.email',
|
||||||
name: 'Send Signing Email',
|
name: 'Send Signing Email',
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
trigger: {
|
trigger: {
|
||||||
name: 'send.signing.email',
|
name: 'send.signing.requested.email',
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
userId: z.number(),
|
userId: z.number(),
|
||||||
documentId: z.number(),
|
documentId: z.number(),
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ export const NEXT_AUTH_OPTIONS: AuthOptions = {
|
|||||||
DateTime.fromJSDate(mostRecentToken.createdAt).diffNow('minutes').minutes > -5
|
DateTime.fromJSDate(mostRecentToken.createdAt).diffNow('minutes').minutes > -5
|
||||||
) {
|
) {
|
||||||
await jobsClient.triggerJob({
|
await jobsClient.triggerJob({
|
||||||
name: 'send.confirmation.email',
|
name: 'send.signup.confirmation.email',
|
||||||
payload: {
|
payload: {
|
||||||
email: user.email,
|
email: user.email,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ export const sendDocument = async ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
await jobsClient.triggerJob({
|
await jobsClient.triggerJob({
|
||||||
name: 'send.signing.email',
|
name: 'send.signing.requested.email',
|
||||||
payload: {
|
payload: {
|
||||||
userId,
|
userId,
|
||||||
documentId,
|
documentId,
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export const verifyEmail = async ({ token }: VerifyEmailProps) => {
|
|||||||
DateTime.now().minus({ hours: 1 }).toJSDate() > mostRecentToken.createdAt
|
DateTime.now().minus({ hours: 1 }).toJSDate() > mostRecentToken.createdAt
|
||||||
) {
|
) {
|
||||||
await jobsClient.triggerJob({
|
await jobsClient.triggerJob({
|
||||||
name: 'send.confirmation.email',
|
name: 'send.signup.confirmation.email',
|
||||||
payload: {
|
payload: {
|
||||||
email: verificationToken.user.email,
|
email: verificationToken.user.email,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export const authRouter = router({
|
|||||||
const user = await createUser({ name, email, password, signature, url });
|
const user = await createUser({ name, email, password, signature, url });
|
||||||
|
|
||||||
await jobsClient.triggerJob({
|
await jobsClient.triggerJob({
|
||||||
name: 'send.confirmation.email',
|
name: 'send.signup.confirmation.email',
|
||||||
payload: {
|
payload: {
|
||||||
email: user.email,
|
email: user.email,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ export const profileRouter = router({
|
|||||||
const { email } = input;
|
const { email } = input;
|
||||||
|
|
||||||
await jobsClient.triggerJob({
|
await jobsClient.triggerJob({
|
||||||
name: 'send.confirmation.email',
|
name: 'send.signup.confirmation.email',
|
||||||
payload: {
|
payload: {
|
||||||
email,
|
email,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user