- Add MerchantCorrection model: upsert by merchantName, Category enum - Check corrections DB first in suggestCategoryForMerchant (source: "learned", no confirmation required); falls through to rules then Ollama if no match - Inject recent corrections as few-shot examples in the Ollama prompt so the model improves even for merchants not yet explicitly corrected - Add POST /categories/correct route to persist corrections - Detect category override on form save (suggestedCategory !== chosen category) and silently fire a correction — no extra UX required - Fix test isolation: beforeEach re-applies vi.fn() defaults after restoreAllMocks Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
62 lines
1.2 KiB
Plaintext
62 lines
1.2 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
enum Category {
|
|
RENT
|
|
FOOD
|
|
TRANSPORT
|
|
BILLS
|
|
SHOPPING
|
|
HEALTH
|
|
ENTERTAINMENT
|
|
MISC
|
|
}
|
|
|
|
model Expense {
|
|
id String @id @default(cuid())
|
|
date String
|
|
title String
|
|
amountCents Int
|
|
category Category
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model Paycheck {
|
|
id String @id @default(cuid())
|
|
payDate String
|
|
amountCents Int
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model PaySchedule {
|
|
id String @id @default(cuid())
|
|
amountCents Int
|
|
anchorDate String
|
|
active Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model MerchantCorrection {
|
|
id String @id @default(cuid())
|
|
merchantName String @unique
|
|
category Category
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model MonthlyInsight {
|
|
id String @id @default(cuid())
|
|
month String @unique
|
|
year Int
|
|
generatedAt DateTime @default(now())
|
|
summary String
|
|
recommendations String
|
|
inputSnapshot String
|
|
}
|