ci: trigger vercel

This commit is contained in:
Riccardo
2024-07-07 17:51:49 +02:00
parent 637520dbf2
commit be3bd7993f
3 changed files with 24 additions and 122 deletions

View File

@@ -1,4 +1,5 @@
import { getSession, withApiAuthRequired } from '@auth0/nextjs-auth0';
import { CustomerForm } from '@prisma/client';
import prisma from '@prisma/prisma';
import { randomUUID } from 'crypto';
import { NextResponse } from 'next/server';
@@ -6,20 +7,25 @@ import { NextResponse } from 'next/server';
export const GET = withApiAuthRequired(async () => {
const session = await getSession();
console.log('GET', session?.user);
try {
const userModules = await prisma.user.findUniqueOrThrow({
where: {
email: session?.user.email
},
include: {
CustomerForm: true
}
});
// const userModules = await prisma.user.findUniqueOrThrow({
// where: {
// email: session?.user.email
// },
// include: {
// CustomerForm: true
// }
// });
const customerForms: CustomerForm[] = userModules.CustomerForm;
// const customerForms: CustomerForm[] = userModules.CustomerForm;
return NextResponse.json([]);
return NextResponse.json({ success: true, data: customerForms });
} catch (error) {
return NextResponse.json(
{ success: false, message: 'Something went wrong.' },
{ status: 500 }
);
}
});
export const POST = withApiAuthRequired(async request => {
@@ -28,8 +34,6 @@ export const POST = withApiAuthRequired(async request => {
const body = await request.json();
console.log('POST', session?.user);
const newCustomerForm = await prisma.customerForm.create({
data: {
type: body.type,