chore: sync schema with scrum4me@43a4294 + write metadata in log tools
PR #2 merged, so the StoryLog.metadata JSONB column is live. Sync the vendored schema and wire `metadata` through to prisma.create in log_implementation, log_test_result and log_commit. Cast via Prisma.InputJsonValue because Zod parses the input as a generic record while Prisma's JSON input type is invariant. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ea1c94b05b
commit
008fda1019
5 changed files with 11 additions and 6 deletions
|
|
@ -167,6 +167,7 @@ model StoryLog {
|
|||
status TestStatus?
|
||||
commit_hash String?
|
||||
commit_message String?
|
||||
metadata Json?
|
||||
created_at DateTime @default(now())
|
||||
|
||||
@@index([story_id, created_at])
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { z } from 'zod'
|
||||
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
||||
import type { Prisma } from '@prisma/client'
|
||||
import { prisma } from '../prisma.js'
|
||||
import { requireWriteAccess } from '../auth.js'
|
||||
import { userCanAccessStory } from '../access.js'
|
||||
|
|
@ -23,7 +24,7 @@ export function registerLogCommitTool(server: McpServer) {
|
|||
'Forbidden for demo accounts.',
|
||||
inputSchema,
|
||||
},
|
||||
async ({ story_id, content, commit_hash, commit_message }) =>
|
||||
async ({ story_id, content, commit_hash, commit_message, metadata }) =>
|
||||
withToolErrors(async () => {
|
||||
const auth = await requireWriteAccess()
|
||||
if (!(await userCanAccessStory(story_id, auth.userId))) {
|
||||
|
|
@ -36,6 +37,7 @@ export function registerLogCommitTool(server: McpServer) {
|
|||
content,
|
||||
commit_hash,
|
||||
commit_message,
|
||||
metadata: (metadata ?? undefined) as Prisma.InputJsonValue | undefined,
|
||||
},
|
||||
select: { id: true, created_at: true },
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
import { z } from 'zod'
|
||||
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
||||
import type { Prisma } from '@prisma/client'
|
||||
import { prisma } from '../prisma.js'
|
||||
import { requireWriteAccess } from '../auth.js'
|
||||
import { userCanAccessStory } from '../access.js'
|
||||
import { toolError, toolJson, withToolErrors } from '../errors.js'
|
||||
|
||||
// metadata is accepted on input but not yet written — schema sync after
|
||||
// Scrum4Me PR #2 lands adds the StoryLog.metadata JSONB column.
|
||||
const inputSchema = z.object({
|
||||
story_id: z.string().min(1),
|
||||
content: z.string().min(1),
|
||||
|
|
@ -23,7 +22,7 @@ export function registerLogImplementationTool(server: McpServer) {
|
|||
'Forbidden for demo accounts.',
|
||||
inputSchema,
|
||||
},
|
||||
async ({ story_id, content }) =>
|
||||
async ({ story_id, content, metadata }) =>
|
||||
withToolErrors(async () => {
|
||||
const auth = await requireWriteAccess()
|
||||
if (!(await userCanAccessStory(story_id, auth.userId))) {
|
||||
|
|
@ -34,6 +33,7 @@ export function registerLogImplementationTool(server: McpServer) {
|
|||
story_id,
|
||||
type: 'IMPLEMENTATION_PLAN',
|
||||
content,
|
||||
metadata: (metadata ?? undefined) as Prisma.InputJsonValue | undefined,
|
||||
},
|
||||
select: { id: true, created_at: true },
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { z } from 'zod'
|
||||
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
||||
import type { Prisma } from '@prisma/client'
|
||||
import { prisma } from '../prisma.js'
|
||||
import { requireWriteAccess } from '../auth.js'
|
||||
import { userCanAccessStory } from '../access.js'
|
||||
|
|
@ -22,7 +23,7 @@ export function registerLogTestResultTool(server: McpServer) {
|
|||
'Forbidden for demo accounts.',
|
||||
inputSchema,
|
||||
},
|
||||
async ({ story_id, content, status }) =>
|
||||
async ({ story_id, content, status, metadata }) =>
|
||||
withToolErrors(async () => {
|
||||
const auth = await requireWriteAccess()
|
||||
if (!(await userCanAccessStory(story_id, auth.userId))) {
|
||||
|
|
@ -34,6 +35,7 @@ export function registerLogTestResultTool(server: McpServer) {
|
|||
type: 'TEST_RESULT',
|
||||
content,
|
||||
status,
|
||||
metadata: (metadata ?? undefined) as Prisma.InputJsonValue | undefined,
|
||||
},
|
||||
select: { id: true, created_at: true },
|
||||
})
|
||||
|
|
|
|||
2
vendor/scrum4me
vendored
2
vendor/scrum4me
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit a8adac127fc09486d0b3e63544b5ddf8791f3c04
|
||||
Subproject commit 43a429442491c29148c921fa2943960f70dd9fb6
|
||||
Loading…
Add table
Add a link
Reference in a new issue