feat(tasks): add code field to BacklogTask type and all task selects

Adds `code: string | null` to BacklogTask interface and includes it in
all Prisma task.findMany selects (backlog API, stories tasks API, page
hydration routes). Updates coerceTaskPayload and test fixtures to match.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scrum4Me Agent 2026-05-14 15:55:00 +02:00
parent 9d3235bcd8
commit 5085fac31d
9 changed files with 10 additions and 3 deletions

View file

@ -71,7 +71,7 @@ const STORIES: BacklogStory[] = [
{ id: STORY_ID, code: 'ST-1', title: 'Eerste story', description: null, acceptance_criteria: null, priority: 2, sort_order: 1, status: 'OPEN', pbi_id: PBI_ID, sprint_id: null, created_at: new Date() }, { id: STORY_ID, code: 'ST-1', title: 'Eerste story', description: null, acceptance_criteria: null, priority: 2, sort_order: 1, status: 'OPEN', pbi_id: PBI_ID, sprint_id: null, created_at: new Date() },
] ]
const TASKS: BacklogTask[] = [ const TASKS: BacklogTask[] = [
{ id: 'task-1', title: 'Eerste taak', description: null, priority: 2, status: 'TO_DO', sort_order: 1, story_id: STORY_ID, created_at: new Date() }, { id: 'task-1', code: null, title: 'Eerste taak', description: null, priority: 2, status: 'TO_DO', sort_order: 1, story_id: STORY_ID, created_at: new Date() },
] ]
function resetStores() { function resetStores() {

View file

@ -71,8 +71,8 @@ const STORY_ID = 'story-1'
const CLOSE_PATH = `/products/${PRODUCT_ID}` const CLOSE_PATH = `/products/${PRODUCT_ID}`
const TASKS = [ const TASKS = [
{ id: 'task-1', title: 'Eerste taak', description: null, priority: 2, status: 'TO_DO', sort_order: 1, story_id: STORY_ID, created_at: new Date() }, { id: 'task-1', code: null, title: 'Eerste taak', description: null, priority: 2, status: 'TO_DO', sort_order: 1, story_id: STORY_ID, created_at: new Date() },
{ id: 'task-2', title: 'Tweede taak', description: null, priority: 3, status: 'IN_PROGRESS', sort_order: 2, story_id: STORY_ID, created_at: new Date() }, { id: 'task-2', code: null, title: 'Tweede taak', description: null, priority: 3, status: 'IN_PROGRESS', sort_order: 2, story_id: STORY_ID, created_at: new Date() },
] ]
function renderPanel(isDemo = false) { function renderPanel(isDemo = false) {

View file

@ -106,6 +106,7 @@ function makeStory(overrides: Partial<BacklogStory> & { id: string; pbi_id: stri
function makeTask(overrides: Partial<BacklogTask> & { id: string; story_id: string }): BacklogTask { function makeTask(overrides: Partial<BacklogTask> & { id: string; story_id: string }): BacklogTask {
return { return {
id: overrides.id, id: overrides.id,
code: overrides.code ?? null,
title: overrides.title ?? `Task ${overrides.id}`, title: overrides.title ?? `Task ${overrides.id}`,
description: overrides.description ?? null, description: overrides.description ?? null,
priority: overrides.priority ?? 2, priority: overrides.priority ?? 2,

View file

@ -75,6 +75,7 @@ export default async function ProductBacklogPage({ params, searchParams }: Props
where: { story: { pbi: { product_id: id } } }, where: { story: { pbi: { product_id: id } } },
select: { select: {
id: true, id: true,
code: true,
title: true, title: true,
description: true, description: true,
priority: true, priority: true,

View file

@ -61,6 +61,7 @@ export default async function MobileProductBacklogPage({ params, searchParams }:
where: { story: { pbi: { product_id: id } } }, where: { story: { pbi: { product_id: id } } },
select: { select: {
id: true, id: true,
code: true,
title: true, title: true,
description: true, description: true,
priority: true, priority: true,

View file

@ -66,6 +66,7 @@ export async function GET(
orderBy: [{ sort_order: 'asc' }, { created_at: 'asc' }], orderBy: [{ sort_order: 'asc' }, { created_at: 'asc' }],
select: { select: {
id: true, id: true,
code: true,
title: true, title: true,
description: true, description: true,
priority: true, priority: true,

View file

@ -33,6 +33,7 @@ export async function GET(
orderBy: [{ sort_order: 'asc' }, { created_at: 'asc' }], orderBy: [{ sort_order: 'asc' }, { created_at: 'asc' }],
select: { select: {
id: true, id: true,
code: true,
title: true, title: true,
description: true, description: true,
priority: true, priority: true,

View file

@ -1039,6 +1039,7 @@ function coerceTaskPayload(id: string, p: Record<string, unknown>): BacklogTask
const title = p.title ?? p.task_title ?? '' const title = p.title ?? p.task_title ?? ''
return { return {
id, id,
code: (p.code as string | null | undefined) ?? null,
title: String(title), title: String(title),
description: (p.description as string | null | undefined) ?? null, description: (p.description as string | null | undefined) ?? null,
priority: Number(p.priority ?? 4), priority: Number(p.priority ?? 4),

View file

@ -27,6 +27,7 @@ export interface BacklogStory {
export interface BacklogTask { export interface BacklogTask {
id: string id: string
code: string | null
title: string title: string
description: string | null description: string | null
priority: number priority: number