43 lines
1.4 KiB
Markdown
43 lines
1.4 KiB
Markdown
|
|
# Task ID: 41
|
||
|
|
|
||
|
|
**Title:** Update PromptRequest API to handle priority
|
||
|
|
|
||
|
|
**Status:** done
|
||
|
|
|
||
|
|
**Dependencies:** 38 ✓
|
||
|
|
|
||
|
|
**Priority:** high
|
||
|
|
|
||
|
|
**Description:** Modify prompt request API endpoints to accept, validate, and return the priority field for proposed prompts.
|
||
|
|
|
||
|
|
**Details:**
|
||
|
|
|
||
|
|
1. Update validation in `/src/mcpd/src/validation/prompt.schema.ts`:
|
||
|
|
```typescript
|
||
|
|
export const CreatePromptRequestSchema = z.object({
|
||
|
|
name: z.string().min(1).max(100).regex(/^[a-z0-9-]+$/),
|
||
|
|
content: z.string().min(1).max(50000),
|
||
|
|
projectId: z.string().optional(),
|
||
|
|
createdBySession: z.string().optional(),
|
||
|
|
createdByUserId: z.string().optional(),
|
||
|
|
priority: z.number().int().min(1).max(10).default(5).optional(),
|
||
|
|
});
|
||
|
|
```
|
||
|
|
|
||
|
|
2. Update `/src/mcpd/src/routes/prompts.ts` for PromptRequest endpoints:
|
||
|
|
- POST /api/v1/promptrequests: Accept priority
|
||
|
|
- GET /api/v1/promptrequests: Return priority
|
||
|
|
- POST /api/v1/promptrequests/:id/approve: Preserve priority when creating Prompt
|
||
|
|
|
||
|
|
3. Update PromptService.approve() to copy priority from request to prompt
|
||
|
|
|
||
|
|
4. Update repository layer
|
||
|
|
|
||
|
|
**Test Strategy:**
|
||
|
|
|
||
|
|
- Unit test: POST /api/v1/promptrequests with priority creates request with correct priority
|
||
|
|
- Unit test: POST /api/v1/promptrequests uses default priority 5 when not specified
|
||
|
|
- Unit test: GET /api/v1/promptrequests returns priority field
|
||
|
|
- Unit test: Approve preserves priority from request to created prompt
|
||
|
|
- Unit test: Priority validation (1-10 range)
|