feat(PBI-59): Sprint.code (SP-N sequentieel per product) (#153)
Voegt een verplicht code-veld toe aan Sprint, sequentieel per product (consistent met PBI-N, ST-NNN, T-N). - **Schema** — `Sprint.code String @db.VarChar(30)` + `@@unique([product_id, code])` - **Migratie** — voegt kolom toe als nullable, backfillt bestaande sprints via `ROW_NUMBER() OVER (PARTITION BY product_id ORDER BY created_at)` als `SP-N`, en zet daarna NOT NULL + UNIQUE. - **Generator** — `generateNextSprintCode(productId)` in lib/code-server.ts volgt het patroon van story/pbi/task; createSprintAction gebruikt `createWithCodeRetry` voor race-bescherming. - **Seed** — sprint-counter per product (`SP-1`, `SP-2`, ...). Zichtbaar in: - Sprint-header (`Product › Sprint actief · SP-3`) - JobCard + JobDetailPane voor SPRINT_IMPLEMENTATION jobs - Insights: VelocityChart x-axis (compacter dan goal-truncated), AlignmentTrend tooltip, SprintInfoStrip - actions/jobs-page.ts: `sprintCode` is weer een echte code i.p.v. null Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
16f01283ef
commit
a268df3680
20 changed files with 97 additions and 29 deletions
|
|
@ -16,6 +16,7 @@ vi.mock('@/lib/prisma', () => ({
|
|||
prisma: {
|
||||
sprint: {
|
||||
findFirst: vi.fn(),
|
||||
findMany: vi.fn(),
|
||||
create: vi.fn(),
|
||||
update: vi.fn(),
|
||||
},
|
||||
|
|
@ -25,7 +26,7 @@ vi.mock('@/lib/prisma', () => ({
|
|||
import { prisma } from '@/lib/prisma'
|
||||
import { createSprintAction, updateSprintDatesAction } from '@/actions/sprints'
|
||||
|
||||
const mockSprint = prisma as unknown as { sprint: { findFirst: ReturnType<typeof vi.fn>; create: ReturnType<typeof vi.fn>; update: ReturnType<typeof vi.fn> } }
|
||||
const mockSprint = prisma as unknown as { sprint: { findFirst: ReturnType<typeof vi.fn>; findMany: ReturnType<typeof vi.fn>; create: ReturnType<typeof vi.fn>; update: ReturnType<typeof vi.fn> } }
|
||||
|
||||
function makeFormData(data: Record<string, string | null>) {
|
||||
const fd = new FormData()
|
||||
|
|
@ -39,6 +40,7 @@ describe('createSprintAction — date validation', () => {
|
|||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
mockSprint.sprint.findFirst.mockResolvedValue(null)
|
||||
mockSprint.sprint.findMany.mockResolvedValue([])
|
||||
mockSprint.sprint.create.mockResolvedValue({ id: 'sprint-1' })
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue