Skip to content
Discussion options

You must be logged in to vote

Here you go!

export default resolver.pipe(
  resolver.zod(CreateCollection),
  resolver.authorize(),
  async (input, ctx) => {
    // TODO: in multi-tenant app, you must add validation to ensure correct tenant
    const collection = await db.collection.create({ data: {...input, userId: ctx.session.userId} })

    return collection
  }
)

As I write this markdown file, I realize that my schema does not allow each individual user to have a progress (how many completed/ learned cards).

I think this schema will support this. Do a query like db.card.count({where: {userId: ###, completed: true}})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Mozart409
Comment options

Answer selected by Mozart409
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants