feat(todos): include team-member products in todos page query

Use productAccessFilter so users who are product members (not just
owners) see those products in the todo form and promote dialogs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Janpeter Visser 2026-04-25 19:17:05 +02:00
parent d03df529d3
commit e991f4f185

View file

@ -2,6 +2,7 @@ import { cookies } from 'next/headers'
import { getIronSession } from 'iron-session'
import { SessionData, sessionOptions } from '@/lib/session'
import { prisma } from '@/lib/prisma'
import { productAccessFilter } from '@/lib/product-access'
import { TodoList } from '@/components/todos/todo-list'
export default async function TodosPage() {
@ -14,7 +15,7 @@ export default async function TodosPage() {
})
const products = await prisma.product.findMany({
where: { user_id: session.userId, archived: false },
where: { ...productAccessFilter(session.userId), archived: false },
orderBy: { name: 'asc' },
include: {
pbis: { orderBy: [{ priority: 'asc' }, { sort_order: 'asc' }], select: { id: true, title: true } },