37 lines
1.3 KiB
Markdown
37 lines
1.3 KiB
Markdown
|
|
# Task ID: 37
|
||
|
|
|
||
|
|
**Title:** Add priority, summary, chapters, and linkTarget fields to Prompt schema
|
||
|
|
|
||
|
|
**Status:** done
|
||
|
|
|
||
|
|
**Dependencies:** None
|
||
|
|
|
||
|
|
**Priority:** high
|
||
|
|
|
||
|
|
**Description:** Extend the Prisma schema for the Prompt model to include priority (integer 1-10, default 5), summary (nullable string), chapters (nullable JSON array), and linkTarget (nullable string for prompt links).
|
||
|
|
|
||
|
|
**Details:**
|
||
|
|
|
||
|
|
1. Update `/src/db/prisma/schema.prisma` to add fields to the Prompt model:
|
||
|
|
- `priority Int @default(5)` with check constraint 1-10
|
||
|
|
- `summary String? @db.Text`
|
||
|
|
- `chapters Json?` (stored as JSON array of strings)
|
||
|
|
- `linkTarget String?` (format: `project/server:resource-uri`)
|
||
|
|
|
||
|
|
2. Create Prisma migration:
|
||
|
|
```bash
|
||
|
|
pnpm --filter db exec prisma migrate dev --name add-prompt-priority-summary-chapters-link
|
||
|
|
```
|
||
|
|
|
||
|
|
3. Update TypeScript types in shared package to reflect new fields
|
||
|
|
|
||
|
|
4. Add validation for priority range (1-10) at the database level if possible, otherwise enforce in application layer
|
||
|
|
|
||
|
|
**Test Strategy:**
|
||
|
|
|
||
|
|
- Unit test: Verify migration creates columns with correct types and defaults
|
||
|
|
- Unit test: Verify priority default is 5
|
||
|
|
- Unit test: Verify nullable fields accept null
|
||
|
|
- Unit test: Verify chapters stores/retrieves JSON arrays correctly
|
||
|
|
- Integration test: Create prompt with all new fields, retrieve and verify values
|