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