feat(backend): enforce unique names and surface duplicate errors
This commit is contained in:
@@ -53,7 +53,7 @@ model TypeMachine {
|
||||
|
||||
model Machine {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
name String @unique
|
||||
reference String?
|
||||
prix Decimal? @db.Decimal(10, 2)
|
||||
createdAt DateTime @default(now())
|
||||
@@ -79,7 +79,7 @@ model Machine {
|
||||
|
||||
model Composant {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
name String @unique
|
||||
reference String?
|
||||
prix Decimal? @db.Decimal(10, 2)
|
||||
createdAt DateTime @default(now())
|
||||
@@ -101,7 +101,7 @@ model Composant {
|
||||
|
||||
model Piece {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
name String @unique
|
||||
reference String?
|
||||
prix Decimal? @db.Decimal(10, 2)
|
||||
createdAt DateTime @default(now())
|
||||
@@ -186,7 +186,7 @@ model ModelType {
|
||||
pieces Piece[] @relation("ModelTypePieceAssignments")
|
||||
pieceCustomFields CustomField[] @relation("ModelTypePieceCustomFields")
|
||||
|
||||
@@index([category, name])
|
||||
@@unique([category, name])
|
||||
}
|
||||
|
||||
model Constructeur {
|
||||
|
||||
Reference in New Issue
Block a user