Skip to content

Commit

Permalink
chore: updates deps
Browse files Browse the repository at this point in the history
  • Loading branch information
ixahmedxi committed Jun 1, 2024
1 parent 4c0ac92 commit 0c76776
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 31 deletions.
Binary file modified bun.lockb
Binary file not shown.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"@upstash/redis": "^1.31.3",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"drizzle-orm": "^0.30.10",
"drizzle-orm": "^0.31.0",
"drizzle-zod": "^0.5.1",
"geist": "^1.3.0",
"jiti": "^1.21.0",
Expand All @@ -99,7 +99,7 @@
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
"@eslint/compat": "^1.0.3",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.3.0",
"@eslint/js": "^9.4.0",
"@happy-dom/global-registrator": "^14.12.0",
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
"@next/eslint-plugin-next": "^14.2.3",
Expand All @@ -113,13 +113,13 @@
"@types/bun": "^1.1.3",
"@types/eslint": "^8.56.10",
"@types/eslint-config-prettier": "^6.11.3",
"@types/node": "^20.12.13",
"@types/node": "^20.13.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"commitizen": "^4.3.0",
"cspell": "^8.8.3",
"drizzle-kit": "^0.21.4",
"eslint": "^9.3.0",
"drizzle-kit": "^0.22.1",
"eslint": "^9.4.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsdoc": "^48.2.7",
"eslint-plugin-jsx-a11y": "^6.8.0",
Expand Down
55 changes: 29 additions & 26 deletions src/server/routers/early-access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,50 @@ export const earlyAccessRouter = createRouter({
const { email, name, reason } = input;
const { db, resend } = ctx;

try {
await db.insert(earlyAccessTable).values({
await db
.insert(earlyAccessTable)
.values({
email,
name,
reason,
});
})
.catch((err: unknown) => {
if (err instanceof Error) {
if (
err.message.includes(
'duplicate key value violates unique constraint',
)
) {
throw new TRPCError({
code: 'BAD_REQUEST',
cause: err,
message: 'This email is already on the early access list.',
});
}

await resend.emails.send({
from: 'Noodle <[email protected]>',
to: email,
subject: "You are on Noodle's early access list!",
react: EarlyAccessJoinedEmail({ name, email }),
});
} catch (err) {
if (err instanceof Error) {
if (
err.message.includes(
'duplicate key value violates unique constraint',
)
) {
throw new TRPCError({
code: 'BAD_REQUEST',
code: 'INTERNAL_SERVER_ERROR',
cause: err,
message: 'This email is already on the early access list.',
message:
'An error occurred while adding you to the early access list. Please try again later.',
});
}
});

await resend.emails
.send({
from: 'Noodle <[email protected]>',
to: email,
subject: "You are on Noodle's early access list!",
react: EarlyAccessJoinedEmail({ name, email }),
})
.catch((err: unknown) => {
throw new TRPCError({
code: 'INTERNAL_SERVER_ERROR',
cause: err,
message:
'An error occurred while adding you to the early access list. Please try again later.',
});
}

throw new TRPCError({
code: 'INTERNAL_SERVER_ERROR',
cause: err,
message:
'An error occurred while adding you to the early access list. Please try again later.',
});
}
}),
});

0 comments on commit 0c76776

Please sign in to comment.