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:
parent
d03df529d3
commit
e991f4f185
1 changed files with 2 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ import { cookies } from 'next/headers'
|
||||||
import { getIronSession } from 'iron-session'
|
import { getIronSession } from 'iron-session'
|
||||||
import { SessionData, sessionOptions } from '@/lib/session'
|
import { SessionData, sessionOptions } from '@/lib/session'
|
||||||
import { prisma } from '@/lib/prisma'
|
import { prisma } from '@/lib/prisma'
|
||||||
|
import { productAccessFilter } from '@/lib/product-access'
|
||||||
import { TodoList } from '@/components/todos/todo-list'
|
import { TodoList } from '@/components/todos/todo-list'
|
||||||
|
|
||||||
export default async function TodosPage() {
|
export default async function TodosPage() {
|
||||||
|
|
@ -14,7 +15,7 @@ export default async function TodosPage() {
|
||||||
})
|
})
|
||||||
|
|
||||||
const products = await prisma.product.findMany({
|
const products = await prisma.product.findMany({
|
||||||
where: { user_id: session.userId, archived: false },
|
where: { ...productAccessFilter(session.userId), archived: false },
|
||||||
orderBy: { name: 'asc' },
|
orderBy: { name: 'asc' },
|
||||||
include: {
|
include: {
|
||||||
pbis: { orderBy: [{ priority: 'asc' }, { sort_order: 'asc' }], select: { id: true, title: true } },
|
pbis: { orderBy: [{ priority: 'asc' }, { sort_order: 'asc' }], select: { id: true, title: true } },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue