Victor Tr
12/22/2021, 2:12 PMmodel User {
id String @id @default(uuid())
Squads UserSquadMap[] // I would like this to be an implicit maping of the actual mapped Squad. => Squad[]
OwnedSquads Squad[]
}
model Squad {
id String
owner_id String
Owner User @relation(fields: [owner_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
Members UserSquadMap[] // And this obviously => Users[]
}
// The Join Table
model UserSquadMap {
userId String
squadId String
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
Squad Squad @relation(fields: [squadId], references: [id], onDelete: Cascade)
@@id([userId, squadId])
@@index([squadId])
@@index([userId])
}
I want to directly reference the JoinTable relation entity so that I don't have nested includes {} and nested responses with irrelevant data. Right now I'm just transforming the object in the actual response, but surely there's a better way to directly reference it somehow? Is this possible? (I have been looking at @@map but no no avail, yet)Maciek K
12/22/2021, 2:20 PMVictor Tr
12/22/2021, 2:38 PMVictor Tr
12/22/2021, 2:47 PMincludes kinda make sense. And this feels more like the API's task, not the ORMs, Especially since I will probably need addtional data (such as createdAt) on the map row itselves which can't be done ImplicitlyVictor Tr
12/22/2021, 2:47 PMMaciek K
12/22/2021, 2:51 PMVictor Tr
12/22/2021, 2:52 PM