import { paginate, resolver } from "blitz" import db, { Prisma } from "db" interface GetItemPropsInput extends Pick {} export default resolver.pipe( resolver.authorize(), async ({ where, orderBy, skip = 0, take = 100 }: GetItemPropsInput) => { // TODO: in multi-tenant app, you must add validation to ensure correct tenant const { items: itemProps, hasMore, nextPage, count, } = await paginate({ skip, take, count: () => db.itemProp.count({ where }), query: (paginateArgs) => db.itemProp.findMany({ ...paginateArgs, where, orderBy }), }) return { itemProps, nextPage, hasMore, count, } } )