Skip to content

Instantly share code, notes, and snippets.

View SupremeDeity's full-sized avatar
🎯
Focusing

SupremeDeity

🎯
Focusing
View GitHub Profile
import {randomBytes} from "crypto"
async createChat(userId: string, body: CreateChatDTO) {
const key = randomBytes(32).toString('base64');
const iv = randomBytes(16).toString('base64');
const chat = await prisma.chat.create({
data: {
id: `ch_${createId()}`,
name: body.name,
topic: body.topic,