Merge pull request #42 from madhura68/chore/sync-schema
chore: sync schema + adapt to ACTIVE→OPEN, COMPLETED→CLOSED, EXCLUDED-task
This commit is contained in:
commit
32929eee93
5 changed files with 31 additions and 9 deletions
|
|
@ -56,6 +56,7 @@ enum TaskStatus {
|
||||||
REVIEW
|
REVIEW
|
||||||
DONE
|
DONE
|
||||||
FAILED
|
FAILED
|
||||||
|
EXCLUDED
|
||||||
}
|
}
|
||||||
|
|
||||||
enum LogType {
|
enum LogType {
|
||||||
|
|
@ -70,8 +71,9 @@ enum TestStatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
enum SprintStatus {
|
enum SprintStatus {
|
||||||
ACTIVE
|
OPEN
|
||||||
COMPLETED
|
CLOSED
|
||||||
|
ARCHIVED
|
||||||
FAILED
|
FAILED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -159,6 +161,7 @@ model User {
|
||||||
claude_jobs ClaudeJob[]
|
claude_jobs ClaudeJob[]
|
||||||
claude_workers ClaudeWorker[]
|
claude_workers ClaudeWorker[]
|
||||||
started_sprint_runs SprintRun[] @relation("SprintRunStartedBy")
|
started_sprint_runs SprintRun[] @relation("SprintRunStartedBy")
|
||||||
|
push_subscriptions PushSubscription[]
|
||||||
|
|
||||||
@@index([active_product_id])
|
@@index([active_product_id])
|
||||||
@@map("users")
|
@@map("users")
|
||||||
|
|
@ -297,8 +300,9 @@ model Sprint {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
product Product @relation(fields: [product_id], references: [id], onDelete: Cascade)
|
product Product @relation(fields: [product_id], references: [id], onDelete: Cascade)
|
||||||
product_id String
|
product_id String
|
||||||
|
code String @db.VarChar(30)
|
||||||
sprint_goal String
|
sprint_goal String
|
||||||
status SprintStatus @default(ACTIVE)
|
status SprintStatus @default(OPEN)
|
||||||
start_date DateTime? @db.Date
|
start_date DateTime? @db.Date
|
||||||
end_date DateTime? @db.Date
|
end_date DateTime? @db.Date
|
||||||
created_at DateTime @default(now())
|
created_at DateTime @default(now())
|
||||||
|
|
@ -307,6 +311,7 @@ model Sprint {
|
||||||
tasks Task[]
|
tasks Task[]
|
||||||
sprint_runs SprintRun[]
|
sprint_runs SprintRun[]
|
||||||
|
|
||||||
|
@@unique([product_id, code])
|
||||||
@@index([product_id, status])
|
@@index([product_id, status])
|
||||||
@@map("sprints")
|
@@map("sprints")
|
||||||
}
|
}
|
||||||
|
|
@ -625,3 +630,18 @@ model ClaudeQuestion {
|
||||||
@@index([status, expires_at])
|
@@index([status, expires_at])
|
||||||
@@map("claude_questions")
|
@@map("claude_questions")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model PushSubscription {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
||||||
|
user_id String
|
||||||
|
endpoint String @unique
|
||||||
|
p256dh String
|
||||||
|
auth String
|
||||||
|
user_agent String?
|
||||||
|
created_at DateTime @default(now())
|
||||||
|
last_used_at DateTime @default(now())
|
||||||
|
|
||||||
|
@@index([user_id])
|
||||||
|
@@map("push_subscriptions")
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,15 +140,15 @@ export async function propagateStatusUpwards(
|
||||||
|
|
||||||
let nextStatus: SprintStatus
|
let nextStatus: SprintStatus
|
||||||
if (anyPbiFailed) nextStatus = 'FAILED'
|
if (anyPbiFailed) nextStatus = 'FAILED'
|
||||||
else if (allPbisDone) nextStatus = 'COMPLETED'
|
else if (allPbisDone) nextStatus = 'CLOSED'
|
||||||
else nextStatus = 'ACTIVE'
|
else nextStatus = 'OPEN'
|
||||||
|
|
||||||
if (nextStatus !== sprint.status) {
|
if (nextStatus !== sprint.status) {
|
||||||
await tx.sprint.update({
|
await tx.sprint.update({
|
||||||
where: { id: sprint.id },
|
where: { id: sprint.id },
|
||||||
data: {
|
data: {
|
||||||
status: nextStatus,
|
status: nextStatus,
|
||||||
...(nextStatus === 'COMPLETED' ? { completed_at: new Date() } : {}),
|
...(nextStatus === 'CLOSED' ? { completed_at: new Date() } : {}),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
sprintChanged = true
|
sprintChanged = true
|
||||||
|
|
@ -162,7 +162,7 @@ export async function propagateStatusUpwards(
|
||||||
// 3. Story → Sprint → SprintRun.findFirst({ status: active }) (geen
|
// 3. Story → Sprint → SprintRun.findFirst({ status: active }) (geen
|
||||||
// task-job, bv. handmatige task-statuswijziging via UI).
|
// task-job, bv. handmatige task-statuswijziging via UI).
|
||||||
let sprintRunChanged = false
|
let sprintRunChanged = false
|
||||||
if (nextSprintStatus === 'FAILED' || nextSprintStatus === 'COMPLETED') {
|
if (nextSprintStatus === 'FAILED' || nextSprintStatus === 'CLOSED') {
|
||||||
let resolvedRunId: string | null = sprintRunId ?? null
|
let resolvedRunId: string | null = sprintRunId ?? null
|
||||||
let cancelExceptJobId: string | null = null
|
let cancelExceptJobId: string | null = null
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ const TASK_DB_TO_API = {
|
||||||
REVIEW: 'review',
|
REVIEW: 'review',
|
||||||
DONE: 'done',
|
DONE: 'done',
|
||||||
FAILED: 'failed',
|
FAILED: 'failed',
|
||||||
|
EXCLUDED: 'excluded',
|
||||||
} as const satisfies Record<TaskStatus, string>
|
} as const satisfies Record<TaskStatus, string>
|
||||||
|
|
||||||
const TASK_API_TO_DB: Record<string, TaskStatus> = {
|
const TASK_API_TO_DB: Record<string, TaskStatus> = {
|
||||||
|
|
@ -14,6 +15,7 @@ const TASK_API_TO_DB: Record<string, TaskStatus> = {
|
||||||
review: 'REVIEW',
|
review: 'REVIEW',
|
||||||
done: 'DONE',
|
done: 'DONE',
|
||||||
failed: 'FAILED',
|
failed: 'FAILED',
|
||||||
|
excluded: 'EXCLUDED',
|
||||||
}
|
}
|
||||||
|
|
||||||
const STORY_DB_TO_API = {
|
const STORY_DB_TO_API = {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ export function registerGetClaudeContextTool(server: McpServer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const activeSprint = await prisma.sprint.findFirst({
|
const activeSprint = await prisma.sprint.findFirst({
|
||||||
where: { product_id, status: 'ACTIVE' },
|
where: { product_id, status: 'OPEN' },
|
||||||
orderBy: { created_at: 'desc' },
|
orderBy: { created_at: 'desc' },
|
||||||
select: { id: true, sprint_goal: true, status: true },
|
select: { id: true, sprint_goal: true, status: true },
|
||||||
})
|
})
|
||||||
|
|
|
||||||
2
vendor/scrum4me
vendored
2
vendor/scrum4me
vendored
|
|
@ -1 +1 @@
|
||||||
Subproject commit 77617e89ac830bc4a86fa7d41f16a5122a1d9689
|
Subproject commit 3c773421dacaf506bf35a8270249822cf509ccf3
|
||||||
Loading…
Add table
Add a link
Reference in a new issue