text: 
  // GET - /repos/{owner}/{repo}/issues - Get all repos issues
  // POST - /repos/{owner}/{repo}/issues - Create an issue
  
  import prisma from '../../../../../../util/prisma'
  import { getSession } from 'next-auth/client'
  
  import { issueSchema } from '../../../../../../util/schemas'
  
  export default async (req, res) => {
  
      const { username, repositoryName } = req.query
  
      // GET - /repos/{owner}/{repo}/issues - Get all repos issues
      if (req.method === "GET") {
          
          // TODO: Paginate - Might have 1000's of issues, don't want to fetch all of them all the time
  
          const allIssues = await prisma.issue.findMany({
              where: {
                  repository: {
                      name: repositoryName,
                      ownerUser: {
                          name: username
                      }
                  }
              },
  
              include: {
                  labels: true,
              }
          })
  
          // TODO: Check if project/user is null
          // TODO: Select certain data
  
          return res.status(200).json(allIssues)
  
      // POST - /repos/{owner}/{repo}/issues - Create an issue
      } else if (req.method === "POST") {
  
          const { title, description, labels } = req.body
          try {
  
              const { error } = issueSchema.tailor("create").validate({ title: title, description: description, labels: labels })
              if(error) {
                  return res.status(404).json({error: "Invalid data"})
              }
  
              const session = await getSession({req})
              if(!session) {
                  return res.status(404).json({error: "No session data"})
              }
      
              const sessionID = await prisma.session.findFirst({
                  where: {
                      accessToken: session.accessToken,
                  },
  
                  select: {
                      userId: true
                  }
              })
      
              if(!sessionID) {
                  return res.status(404).json({error: "No session data found"})
              }
  
              const labelNamesToIDs = await prisma.label.findMany({
                  where: {
                      repository: {
                          name: repositoryName,
                          ownerUser: {
                              name: username
                          }
                      },
                      
                      name: {
                          in: labels
                      }
                      
                  },
  
                  select: {
                      id: true
                  }
              })
  
              const foundProjectId = await prisma.repository.findFirst({
                  where: {
                      name: repositoryName,
                      ownerUser: {
                          name: username
                      }
                  },
  
                  select: {
                      id: true
                  }
              })
  
              if(!foundProjectId)
                  return res.status(404).json({error: "Not found"})
            
              const mapIdToLabelID = labelNamesToIDs.map(id => {
                  return { label: { connect: id } }
              })
  
              const createIssue = await prisma.issue.create({
                  data: {
                      title: title,
                      description: description,
                      labels: {
                          create: mapIdToLabelID
                      },  
  
  
                      // labels: {
                      //     create: [
                      //         {
                      //             label: {
                      //                 connect: {
                      //                     id: 15
                      //                 }
                      //             }
                      //         }
                      //     ]
                      // },  
  
                      // THIS ONE
                      // labels: {
                      //     create: [
                      //         {
                      //             labelID: 154
                      //         }
                      //     ]
                      // },     
  
                      // labels: {
                      //     create: [
                      //         {
                      //             label: {
                      //                 connect: {
                      //                     id: 1
                      //                 }
                      //             }
                      //         }
                      //     ]
                      // },
     
                      repository: {
                          connect: {
                              id: foundProjectId.id
                          }
                      },
  
                      author: {
                          connect: {
                              id: sessionID.userId
                          }
                      }
                  }
              })
  
              res.status(200).json(createIssue)
  
          } catch(e) {
              console.error('Exception - POST - /repos/{owner}/{repo}/issue', e)
              return res.status(500).json({error: "Unhandled Exception Error"})
          }
  
      }  else {
          res.status(500).json({ error: `${req.method} is not supported` })
      }
  }
  
  export const config = {
      api: {
          bodyParser: {
              sizeLimit: '500kb',
          },
      },
  }