I want to make a chat app with react, node, socket.io, and Prisma. I am unable to add direct message (dm) functionality but added group functionality.
My Schema
datasource db {
url = env("DATABASE_URL")
provider = "postgresql"
}
generator client {
provider = "prisma-client-js"
}
model User {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
email String @unique
username String
password String
sender Messages @relation("sender")
receiver Messages @relation("receiver")
}
model Group {
id Int @id @default(autoincrement())
messages Messages[]
user Users[]
}
model Messages {
id Int @id @default(autoincrement())
text String
group Group @relation(fields: [groupId], references: [id])
groupId Int
sender User @relation("sender", fields: [senderId], references: [id])
senderId Int
reciever User @relation("reciever", fields: [recieverId], references: [id])
recieverId Int
}
Top comments (3)
Have you considered implementing a separate DM table in your Prisma schema to track direct messages between users? This could streamline your messaging functionality further.
Professional Home Organizer in San Diego California
Smoking moonrocks is a unique experience that requires a bit of preparation. Start by breaking up a small amount of bud into small pieces and spreading it evenly on a rolling tray. You should know how to smoke moonrocks for more enjoyment of moonrocks. Next, take a small moonrock and place it in the center of the bud. Roll the bud around the moonrock until it's completely covered. Finally, light the joint and enjoy the potent high that comes with smoking moonrocks.
Doctors are the most trusted professionals in the world. They have a responsibility to their patients and to society. Doctors need to be able to communicate with their patients through online marketing in order for them to be able to provide safe and effective treatment. If you are a doctor then you should visit this online marketing for doctors for promotion of your hospital or clinic on digital platforms. Doctors should also have access to information regarding new treatments, drugs, and procedures so that they can make informed decisions regarding their care.