15 lines
405 B
TypeScript
15 lines
405 B
TypeScript
import { resolver } from "blitz"
|
|
import db from "db"
|
|
import { z } from "zod"
|
|
|
|
const DeleteItemProp = z.object({
|
|
id: z.number(),
|
|
})
|
|
|
|
export default resolver.pipe(resolver.zod(DeleteItemProp), resolver.authorize(), async ({ id }) => {
|
|
// TODO: in multi-tenant app, you must add validation to ensure correct tenant
|
|
const itemProp = await db.itemProp.deleteMany({ where: { id } })
|
|
|
|
return itemProp
|
|
})
|