Ignore:
Timestamp:
02/27/25 00:42:38 (6 weeks ago)
Author:
Naum Shapkarovski <naumshapkarovski@…>
Branches:
main
Children:
32e9876
Parents:
3c5302a
Message:

update the seed script. update the prisma schema, use mapping

Location:
src/app/api/invoices
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/app/api/invoices/[id]/route.ts

    r3c5302a r87c9f1e  
    100100        data: {
    101101          invoiceNumber: validation.data.invoiceNumber,
    102           createDate: validation.data.createDate,
     102          issueDate: validation.data.issueDate,
    103103          dueDate: validation.data.dueDate,
    104104          status: validation.data.status,
  • src/app/api/invoices/route.ts

    r3c5302a r87c9f1e  
    4545          ? { equals: validatedFilters.status as InvoiceStatus }
    4646          : undefined,
    47         createDate: {
     47        issueDate: {
    4848          ...(validatedFilters.startDate && { gte: validatedFilters.startDate }),
    4949          ...(validatedFilters.endDate && { lte: validatedFilters.endDate }),
     
    108108        quantityType: validatedData.quantityType,
    109109        subTotal: validatedData.subTotal,
    110         createDate: validatedData.createDate,
     110        issueDate: validatedData.issueDate,
    111111        month: validatedData.month,
    112112        discount: validatedData.discount,
  • src/app/api/invoices/totals/route.ts

    r3c5302a r87c9f1e  
    2020    const searchParams = request.nextUrl.searchParams;
    2121    const startDate = searchParams.get('startDate')
    22       ? new Date(searchParams.get('startDate')!)
     22      ? new Date(searchParams.get('issueDate')!)
    2323      : null;
    2424
     
    3232        status,
    3333        currency,
    34         SUM("totalAmount") as total
     34        SUM("total_amount") as total
    3535      FROM "Invoice"
    36       WHERE "createDate" >= ${startDate}
    37         AND "invoiceFromId" = ${tenantId}
     36      WHERE "issue_date" >= ${startDate}
     37        AND "tenant_id" = ${tenantId}
    3838      GROUP BY status, currency
    3939    `;
Note: See TracChangeset for help on using the changeset viewer.