This commit is contained in:
Ivan Grachyov
2025-12-26 23:36:21 +03:00
parent 0f218c1519
commit ca773a56c6
18 changed files with 315 additions and 7 deletions

23
server/routes/chat.ts Normal file
View 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)
})
}