const { PrismaClient } = require("@prisma/client")
const prisma = new PrismaClient()

async function findUser(where, options = {}) {
  return prisma.user.findUnique({
    where,
    include: options.include || undefined,
    select: options.select || undefined,
  })
}

async function updateUser(where, data, options = {}) {
  return prisma.user.update({
    where,
    data,
    include: options.include || undefined,
    select: options.select || undefined,
  })
}

module.exports = {
  findUser,
  updateUser,
}
