15 lines
400 B
TypeScript
15 lines
400 B
TypeScript
import { resolver } from "blitz"
|
|
import db from "db"
|
|
import { z } from "zod"
|
|
|
|
const CreateItemProp = z.object({
|
|
name: z.string(),
|
|
})
|
|
|
|
export default resolver.pipe(resolver.zod(CreateItemProp), resolver.authorize(), async (input) => {
|
|
// TODO: in multi-tenant app, you must add validation to ensure correct tenant
|
|
const itemProp = await db.itemProp.create({ data: input })
|
|
|
|
return itemProp
|
|
})
|