Max Blancarte
07/17/2022, 9:55 PMconst persons = [
{
id: 'cblablabla',
name: 'John',
relatives: [
{ id: '1', name: 'Sara' },
{ id: '2', name: 'Bob' },
],
},
{
id: 'cblebleble',
name: 'Sara',
relatives: [
{ id: '1', name: 'John' },
{ id: '3', name: 'Bob' },
],
},
];
model People {
id String @id @default(cuid())
name String
relatives String[] or JSON ?
}
Yuval Datner
07/17/2022, 10:26 PMmodel Person {
id Int @id @default(autoincrement())
name String
friends Person[] @relation("Friends")
friendOf Person[] @relation("Friends")
}
friendship -> my circle of friends or something
model Person {
id Int @id @default(autoincrement())
name String
friendship Friendship @relation(fields: [friendshipId], references: [id])
friendshipId Int
// can also be m-n relation like for reasons
friendships Friendship[]
}
model Friendship {
id Int @id @default(autoincrement())
friends Person[]
}
friends -> the ID's of my friends
model Person {
id Int @id @default(autoincrement())
name String
friends Int[]
}
I wouldn't do the last one, but it's what you suggestedMax Blancarte
07/17/2022, 10:34 PMMax Blancarte
07/17/2022, 10:48 PM{
id: '1',
code : 'GLU',
description: 'Glu',
title: 'Test for Glu',
units: 'mg/dL',
resultType: 'Numeric',
textValue: '',
rangeValue: [
{
id: '1',
gender: "m",
minValue: "1",
maxValue: "100",
minAge: '1',
maxAge: '120'
},
{
id: '2',
gender: 'f',
minValue: '1',
maxValue: '90',
minAge: '1',
maxAge: '120'
}
],
}
Max Blancarte
07/17/2022, 10:51 PMmodel Test {
id String @id @default(cuid())
code String
description String
title String
units String
resutlType String
textValue String
RangeValue RangeValue[]
}
model RangeValue {
id String @id @default(cuid())
gender String
minValue Int
maxValue Int
minAge Int
maxAge Int
Test Test? @relation(fields: [testId], references: [id])
testId String?
}
Austin
07/18/2022, 9:40 PM