docs: add Common Pitfall #21 for CreateTradeParams interface sync
This commit is contained in:
7
.github/copilot-instructions.md
vendored
7
.github/copilot-instructions.md
vendored
@@ -674,6 +674,13 @@ trade.realizedPnL += actualRealizedPnL // NOT: result.realizedPnL from SDK
|
|||||||
- **ActiveTrade interface:** Must include `atrAtEntry?: number` field for calculation
|
- **ActiveTrade interface:** Must include `atrAtEntry?: number` field for calculation
|
||||||
- See `ATR_TRAILING_STOP_FIX.md` for full details and database analysis
|
- 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
|
## File Conventions
|
||||||
|
|
||||||
- **API routes:** `app/api/[feature]/[action]/route.ts` (Next.js 15 App Router)
|
- **API routes:** `app/api/[feature]/[action]/route.ts` (Next.js 15 App Router)
|
||||||
|
|||||||
Reference in New Issue
Block a user