Files
chad/server/routes/chat.ts
Ivan Grachyov ca773a56c6 chat WIP
2025-12-26 23:36:21 +03:00

24 lines
583 B
TypeScript

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)
})
}