chore: some refactor and cleaning

This commit is contained in:
2024-12-30 06:54:01 +01:00
parent 5c75e9390e
commit e39026c259
15 changed files with 5029 additions and 7233 deletions

View File

@@ -9,13 +9,12 @@ import {
} from '@utils/statusCodes';
import { ConfirmationSchema, ResponseType } from '@utils/validationSchemas';
import { NextRequest } from 'next/server';
import { Resend } from 'resend';
export const dynamic = 'force-dynamic'; // defaults to force-static
export async function POST(request: NextRequest) {
try {
if (!process.env.RESEND_KEY || !process.env.RESEND_AUDIENCE) {
if (!process.env.RESEND_KEY) {
throw new Error('Resend variables not set');
}
const body = await request.json();
@@ -31,14 +30,6 @@ export async function POST(request: NextRequest) {
});
if (user) {
const resend = new Resend(process.env.RESEND_KEY);
await resend.contacts.update({
id: user.resendId,
audienceId: process.env.RESEND_AUDIENCE,
unsubscribed: false
});
await prisma.user.update({
where: {
code: validation.data.code