Cleaning code

So, just building a basic scoreboard side project, which I need teams and scores for it. Is there any ways to clean up these models? They just seem kinda clunky to me, dunno if I'm the problem here.
model Team {
id String @id @default(uuid()) @map("team_id")
slug String @unique @default(nanoid())
name String

LeftGame Game[] @relation("left_team")
RightGame Game[] @relation("right_team")

@@map("teams")
}

model Game {
id String @id @default(uuid()) @map("game_id")

leftTeamId String
leftTeam Team @relation("left_team", fields: [leftTeamId], references: [id])
leftScore Int @default(0)

rightTeamId String
rightTeam Team @relation("right_team", fields: [rightTeamId], references: [id])
rightScore Int @default(0)

@@map("games")
}
model Team {
id String @id @default(uuid()) @map("team_id")
slug String @unique @default(nanoid())
name String

LeftGame Game[] @relation("left_team")
RightGame Game[] @relation("right_team")

@@map("teams")
}

model Game {
id String @id @default(uuid()) @map("game_id")

leftTeamId String
leftTeam Team @relation("left_team", fields: [leftTeamId], references: [id])
leftScore Int @default(0)

rightTeamId String
rightTeam Team @relation("right_team", fields: [rightTeamId], references: [id])
rightScore Int @default(0)

@@map("games")
}
1 Reply
Sun「無用」
Sun「無用」OP7mo ago
the model looks right... but also doesn't? it's kinda hard to explain
Want results from more Discord servers?
Add your server