I am wondering how to model friendships between users in my models.
This only thing I could come up with is a followed/follower model but I am thinking there must be a better way
model User {
name String @id
password String
discussions Discussion[]
friendList User[] @relation("friendList")
friendOfList User[] @relation("friendList")
incomingFriendInvitation User[] @relation("friendInvitation")
outcomingFriendInvitation User[] @relation("friendInvitation")
blockedUserList User[] @relation("blockedUser")
blockedByUserList User[] @relation("blockedUser")
}
model Discussion {
id Int @id @default(autoincrement())
title String?
users User[]
messages Message[]
}
I was thinking maybe this could work like that :
If I follow you but you don't follow me it's like I've sent you an invitation but you have not yet accepted it. A friendship being a mutual followance. But I am thinking this might become non trivial to retrieve.