feat(ST-353): add assignee chip and claim/reassign dropdown to sprint story card
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
87eb4a420b
commit
358c88a9d9
4 changed files with 172 additions and 26 deletions
|
|
@ -5,7 +5,7 @@ import { SessionData, sessionOptions } from '@/lib/session'
|
|||
import { prisma } from '@/lib/prisma'
|
||||
import { SprintBoardClient } from '@/components/sprint/sprint-board-client'
|
||||
import { SprintHeader } from '@/components/sprint/sprint-header'
|
||||
import type { SprintStory, PbiWithStories } from '@/components/sprint/sprint-backlog'
|
||||
import type { SprintStory, PbiWithStories, ProductMember } from '@/components/sprint/sprint-backlog'
|
||||
import type { Task } from '@/components/sprint/task-list'
|
||||
import Link from 'next/link'
|
||||
|
||||
|
|
@ -27,16 +27,27 @@ export default async function SprintBoardPage({ params }: Props) {
|
|||
})
|
||||
if (!sprint) redirect(`/products/${id}`)
|
||||
|
||||
// Sprint stories with full task data
|
||||
const sprintStories = await prisma.story.findMany({
|
||||
where: { sprint_id: sprint.id },
|
||||
orderBy: { sort_order: 'asc' },
|
||||
include: {
|
||||
tasks: {
|
||||
orderBy: [{ priority: 'asc' }, { sort_order: 'asc' }],
|
||||
// Sprint stories with full task data and assignee
|
||||
const [sprintStories, productMembers] = await Promise.all([
|
||||
prisma.story.findMany({
|
||||
where: { sprint_id: sprint.id },
|
||||
orderBy: { sort_order: 'asc' },
|
||||
include: {
|
||||
tasks: { orderBy: [{ priority: 'asc' }, { sort_order: 'asc' }] },
|
||||
assignee: { select: { id: true, username: true } },
|
||||
},
|
||||
},
|
||||
})
|
||||
}),
|
||||
prisma.productMember.findMany({
|
||||
where: { product_id: id },
|
||||
include: { user: { select: { id: true, username: true } } },
|
||||
}),
|
||||
])
|
||||
|
||||
// All members who can be assigned: owner + product members
|
||||
const members: ProductMember[] = [
|
||||
{ userId: product.user_id, username: (await prisma.user.findUnique({ where: { id: product.user_id }, select: { username: true } }))?.username ?? 'Eigenaar' },
|
||||
...productMembers.map(m => ({ userId: m.user_id, username: m.user.username })),
|
||||
]
|
||||
|
||||
const sprintStoryItems: SprintStory[] = sprintStories.map(s => ({
|
||||
id: s.id,
|
||||
|
|
@ -45,6 +56,8 @@ export default async function SprintBoardPage({ params }: Props) {
|
|||
status: s.status,
|
||||
taskCount: s.tasks.length,
|
||||
doneCount: s.tasks.filter(t => t.status === 'DONE').length,
|
||||
assignee_id: s.assignee_id,
|
||||
assignee_username: s.assignee?.username ?? null,
|
||||
}))
|
||||
|
||||
const tasksByStory: Record<string, Task[]> = {}
|
||||
|
|
@ -83,6 +96,8 @@ export default async function SprintBoardPage({ params }: Props) {
|
|||
status: s.status,
|
||||
taskCount: 0,
|
||||
doneCount: 0,
|
||||
assignee_id: null,
|
||||
assignee_username: null,
|
||||
})),
|
||||
}))
|
||||
|
||||
|
|
@ -108,6 +123,8 @@ export default async function SprintBoardPage({ params }: Props) {
|
|||
sprintStoryIdList={sprintStoryIdList}
|
||||
tasksByStory={tasksByStory}
|
||||
isDemo={isDemo}
|
||||
currentUserId={session.userId}
|
||||
members={members}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue