Summary
The API route handlers for invoices and quotes use `any` for the `formatInvoice` and `formatQuote` helper functions, as well as for line item mapping. These should use proper Prisma-generated types.
Current code
In `apps/web/app/api/v1/invoices/from-quote/[quoteId]/route.ts` (line 12):
```typescript
function formatInvoice(inv: any) {
```
In `apps/web/app/api/v1/quotes/[id]/route.ts` (line 11):
```typescript
function formatQuote(q: Record<string, any>) {
```
In `apps/web/app/api/v1/invoices/[id]/route.ts` (line 11):
```typescript
function formatInvoice(inv: Record<string, any>) {
```
Line items in all three files also use `(li: any)`.
What to do
- Import the relevant Prisma types (e.g., `Invoice`, `Quote`, `InvoiceLineItem`, `QuoteLineItem`) from `@quotecraft/database`
- Use Prisma's generated types with the `include` relations (e.g., `Prisma.InvoiceGetPayload<{ include: { client: true; lineItems: true } }>`)
- Replace the `any` casts on line item maps
Files
- `apps/web/app/api/v1/invoices/[id]/route.ts`
- `apps/web/app/api/v1/invoices/from-quote/[quoteId]/route.ts`
- `apps/web/app/api/v1/quotes/[id]/route.ts`
Acceptance criteria
Summary
The API route handlers for invoices and quotes use `any` for the `formatInvoice` and `formatQuote` helper functions, as well as for line item mapping. These should use proper Prisma-generated types.
Current code
In `apps/web/app/api/v1/invoices/from-quote/[quoteId]/route.ts` (line 12):
```typescript
function formatInvoice(inv: any) {
```
In `apps/web/app/api/v1/quotes/[id]/route.ts` (line 11):
```typescript
function formatQuote(q: Record<string, any>) {
```
In `apps/web/app/api/v1/invoices/[id]/route.ts` (line 11):
```typescript
function formatInvoice(inv: Record<string, any>) {
```
Line items in all three files also use `(li: any)`.
What to do
Files
Acceptance criteria