chat WIP
This commit is contained in:
23
server/routes/chat.ts
Normal file
23
server/routes/chat.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { FastifyInstance } from 'fastify'
|
||||
import prisma from '../prisma/client.ts'
|
||||
|
||||
export default function (fastify: FastifyInstance) {
|
||||
fastify.get('/chats', async (req, reply) => {
|
||||
if (req.user) {
|
||||
return prisma.chatChannel.findMany()
|
||||
}
|
||||
|
||||
reply.code(401).send(false)
|
||||
})
|
||||
|
||||
fastify.get('/chats/:id', async (req, reply) => {
|
||||
if (req.user) {
|
||||
console.log('Trying to fetch chat with id', req.body.id)
|
||||
|
||||
// return prisma.userPreferences.findFirst({ where: { userId: req.user.id } })
|
||||
return true
|
||||
}
|
||||
|
||||
reply.code(401).send(false)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user