Add analytics and documentation updates
This commit is contained in:
parent
e0efb65efb
commit
b5e967d8d3
15 changed files with 414 additions and 37 deletions
|
|
@ -36,6 +36,7 @@ export async function authenticateApiRequest(request: Request) {
|
|||
// app/api/products/[id]/next-story/route.ts
|
||||
import { authenticateApiRequest } from '@/lib/api-auth'
|
||||
import { prisma } from '@/lib/prisma'
|
||||
import { productAccessFilter } from '@/lib/product-access'
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
|
|
@ -49,7 +50,7 @@ export async function GET(
|
|||
const { id } = await params
|
||||
|
||||
const sprint = await prisma.sprint.findFirst({
|
||||
where: { product_id: id, status: 'ACTIVE', product: { user_id: auth.userId } },
|
||||
where: { product_id: id, status: 'ACTIVE', product: productAccessFilter(auth.userId) },
|
||||
})
|
||||
if (!sprint) {
|
||||
return Response.json({ error: 'Geen actieve Sprint gevonden' }, { status: 404 })
|
||||
|
|
@ -88,3 +89,11 @@ export async function GET(
|
|||
| POST | `/api/stories/:id/log` | Plan / testresultaat / commit vastleggen |
|
||||
| PATCH | `/api/tasks/:id` | Taakstatus bijwerken |
|
||||
| POST | `/api/todos` | Todo aanmaken |
|
||||
|
||||
## Security-invarianten
|
||||
|
||||
- Elk endpoint start met `authenticateApiRequest`.
|
||||
- Schrijf-endpoints geven `403` voor demo-tokens.
|
||||
- Product-scoped reads en writes gebruiken `productAccessFilter(auth.userId)`, zodat eigenaar en gekoppeld teamlid hetzelfde toegangsmodel volgen.
|
||||
- Endpoints die geordende ID-lijsten ontvangen valideren dat elke ID bij de parent-resource hoort voordat er wordt geupdated.
|
||||
- JSON bodies worden met Zod gevalideerd; TypeScript types zijn geen runtime-beveiliging.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue