Changeset 057453c for src/app/api/customers/route.ts
- Timestamp:
- 02/26/25 10:05:32 (5 weeks ago)
- Branches:
- main
- Children:
- 299af01
- Parents:
- 5d6f37a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/app/api/customers/route.ts
r5d6f37a r057453c 1 1 import { NextRequest, NextResponse } from 'next/server'; 2 import { customerTableFiltersSchema, newCustomerSchema } from ' mvpmasters-shared';2 import { customerTableFiltersSchema, newCustomerSchema } from 'src/schemas'; 3 3 import prisma from 'src/lib/prisma'; 4 4 import { authenticateRequest } from 'src/lib/auth-middleware'; 5 import { CustomerStatus } from '@prisma/client'; 5 6 6 7 export async function GET(request: NextRequest) { … … 23 24 const validatedFilters = customerTableFiltersSchema.parse(filters); 24 25 25 const customers = await prisma.c ustomer.findMany({26 const customers = await prisma.client.findMany({ 26 27 where: { 27 28 name: { contains: validatedFilters.name, mode: 'insensitive' }, 28 status: validatedFilters.status ? { equals: validatedFilters.status } : undefined, 29 status: validatedFilters.status 30 ? { equals: validatedFilters.status as CustomerStatus } 31 : undefined, 29 32 }, 30 33 }); … … 50 53 console.log('validatedData', validatedData); 51 54 52 const customer = await prisma.c ustomer.create({55 const customer = await prisma.client.create({ 53 56 data: { 54 57 ...validatedData,
Note:
See TracChangeset
for help on using the changeset viewer.