Ignore:
Timestamp:
02/26/25 10:05:32 (5 weeks ago)
Author:
Naum Shapkarovski <naumshapkarovski@…>
Branches:
main
Children:
299af01
Parents:
5d6f37a
Message:

feat: implement employees

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/app/api/customers/route.ts

    r5d6f37a r057453c  
    11import { NextRequest, NextResponse } from 'next/server';
    2 import { customerTableFiltersSchema, newCustomerSchema } from 'mvpmasters-shared';
     2import { customerTableFiltersSchema, newCustomerSchema } from 'src/schemas';
    33import prisma from 'src/lib/prisma';
    44import { authenticateRequest } from 'src/lib/auth-middleware';
     5import { CustomerStatus } from '@prisma/client';
    56
    67export async function GET(request: NextRequest) {
     
    2324    const validatedFilters = customerTableFiltersSchema.parse(filters);
    2425
    25     const customers = await prisma.customer.findMany({
     26    const customers = await prisma.client.findMany({
    2627      where: {
    2728        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,
    2932      },
    3033    });
     
    5053    console.log('validatedData', validatedData);
    5154
    52     const customer = await prisma.customer.create({
     55    const customer = await prisma.client.create({
    5356      data: {
    5457        ...validatedData,
Note: See TracChangeset for help on using the changeset viewer.