From 6b7082eef39f43e73d730bcf42c0d6dd438285af Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Wed, 12 Nov 2025 10:02:05 +0100 Subject: [PATCH] docs: add Common Pitfall #21 for CreateTradeParams interface sync --- .github/copilot-instructions.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 63d5d8d..934af5b 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -674,6 +674,13 @@ trade.realizedPnL += actualRealizedPnL // NOT: result.realizedPnL from SDK - **ActiveTrade interface:** Must include `atrAtEntry?: number` field for calculation - See `ATR_TRAILING_STOP_FIX.md` for full details and database analysis +21. **CreateTradeParams interface sync:** When adding new database fields to Trade model, MUST update `CreateTradeParams` interface in `lib/database/trades.ts`: + - Interface defines what parameters `createTrade()` accepts + - Must add new field to interface (e.g., `indicatorVersion?: string`) + - Must add field to Prisma create data object in `createTrade()` function + - TypeScript build will fail if endpoint passes field not in interface + - Example: indicatorVersion tracking required 3-file update (execute route.ts, CreateTradeParams interface, createTrade function) + ## File Conventions - **API routes:** `app/api/[feature]/[action]/route.ts` (Next.js 15 App Router)