text: import { requireAuth } from 'src/lib/auth'
  import { db } from 'src/lib/db'
  
  export const posts = () => {
    return db.post.findMany()
  }
  
  export const post = ({ id }) => {
    return db.post.findUnique({
      where: { id },
    })
  }
  
  export const createPost = ({ input }) => {
    requireAuth()
    return db.post.create({
      data: input,
    })
  }
  
  export const updatePost = ({ id, input }) => {
    requireAuth()
    return db.post.update({
      data: input,
      where: { id },
    })
  }
  
  export const deletePost = ({ id }) => {
    requireAuth()
    return db.post.delete({
      where: { id },
    })
  }
  