feat: implement list ownership and access control

- Modified createList to assign ownerId to authenticated user
- Updated getLists to filter by user access (owner or collaborator)
- Added ownership checks to updateList (owner or editor can update)
- Added ownership checks to deleteList (only owner can delete)
- Implemented access control for all item operations (create, update, delete, toggle)
- Updated getItem, searchItems, and getItemsByFilter to enforce access control
- Added dynamic rendering to pages that use authentication
- Cascade deletion already handled by database schema (onDelete: Cascade)

Requirements: 4.1, 4.2, 4.3, 4.5
This commit is contained in:
2025-12-02 00:48:47 +00:00
parent 2ebda95207
commit 0bb293e101
6 changed files with 408 additions and 29 deletions

View File

@@ -4,6 +4,8 @@ import ItemForm from '@/components/ItemForm'
import Link from 'next/link'
import { ArrowLeft } from 'lucide-react'
export const dynamic = 'force-dynamic'
interface PageProps {
params: {
id: string

View File

@@ -6,6 +6,8 @@ import { ArrowLeft, Edit } from 'lucide-react'
import DeleteItemButton from '@/components/DeleteItemButton'
import ToggleItemButton from '@/components/ToggleItemButton'
export const dynamic = 'force-dynamic'
interface PageProps {
params: {
id: string

View File

@@ -5,6 +5,8 @@ import { ArrowLeft } from 'lucide-react'
import InlineItemCreate from '@/components/InlineItemCreate'
import ListDetailView from '@/components/ListDetailView'
export const dynamic = 'force-dynamic'
export default async function ListDetailPage({ params }: { params: { id: string } }) {
const list = await getListWithItems(params.id)