Add scouthub-magazzino-be
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
enum StatoMateriale {
|
||||
proposto
|
||||
approvato
|
||||
rifiutato
|
||||
|
||||
@@map("stato_materiale")
|
||||
}
|
||||
|
||||
enum StatoMagazzinoVoce {
|
||||
buono
|
||||
da_riparare
|
||||
mancante
|
||||
|
||||
@@map("stato_magazzino_voce")
|
||||
}
|
||||
|
||||
model Materiale {
|
||||
id String @id @default(uuid())
|
||||
nome String
|
||||
categoria String
|
||||
unitaMisura String @map("unita_misura")
|
||||
stato StatoMateriale @default(proposto)
|
||||
propostoDaOrgId String @map("proposto_da_org_id")
|
||||
creatoIl DateTime @default(now()) @map("creato_il")
|
||||
|
||||
listaModelloVoci ListaModelloVoce[]
|
||||
listaVoci ListaVoce[]
|
||||
magazzinoVoci MagazzinoVoce[]
|
||||
eventoCheck EventoCheck[]
|
||||
|
||||
@@map("materiale")
|
||||
}
|
||||
|
||||
model TipoEvento {
|
||||
id String @id @default(uuid())
|
||||
nome String
|
||||
|
||||
listeModello ListaModello[]
|
||||
|
||||
@@map("tipo_evento")
|
||||
}
|
||||
|
||||
model ListaModello {
|
||||
id String @id @default(uuid())
|
||||
nome String
|
||||
tipoEventoId String @map("tipo_evento_id")
|
||||
pubblica Boolean @default(true)
|
||||
|
||||
tipoEvento TipoEvento @relation(fields: [tipoEventoId], references: [id])
|
||||
voci ListaModelloVoce[]
|
||||
|
||||
@@map("lista_modello")
|
||||
}
|
||||
|
||||
model ListaModelloVoce {
|
||||
listaModelloId String @map("lista_modello_id")
|
||||
materialeId String @map("materiale_id")
|
||||
quantita Int
|
||||
|
||||
listaModello ListaModello @relation(fields: [listaModelloId], references: [id])
|
||||
materiale Materiale @relation(fields: [materialeId], references: [id])
|
||||
|
||||
@@id([listaModelloId, materialeId])
|
||||
@@map("lista_modello_voce")
|
||||
}
|
||||
|
||||
model Lista {
|
||||
id String @id @default(uuid())
|
||||
nome String
|
||||
orgId String @map("org_id")
|
||||
creataIl DateTime @default(now()) @map("creata_il")
|
||||
|
||||
voci ListaVoce[]
|
||||
eventi Evento[]
|
||||
|
||||
@@map("lista")
|
||||
}
|
||||
|
||||
model ListaVoce {
|
||||
listaId String @map("lista_id")
|
||||
materialeId String @map("materiale_id")
|
||||
quantita Int
|
||||
|
||||
lista Lista @relation(fields: [listaId], references: [id])
|
||||
materiale Materiale @relation(fields: [materialeId], references: [id])
|
||||
|
||||
@@id([listaId, materialeId])
|
||||
@@map("lista_voce")
|
||||
}
|
||||
|
||||
model MagazzinoVoce {
|
||||
id String @id @default(uuid())
|
||||
orgId String @map("org_id")
|
||||
materialeId String @map("materiale_id")
|
||||
quantitaPosseduta Int @map("quantita_posseduta")
|
||||
stato StatoMagazzinoVoce
|
||||
posizione String?
|
||||
note String?
|
||||
|
||||
materiale Materiale @relation(fields: [materialeId], references: [id])
|
||||
|
||||
@@map("magazzino_voce")
|
||||
}
|
||||
|
||||
model Evento {
|
||||
id String @id @default(uuid())
|
||||
orgId String @map("org_id")
|
||||
nome String
|
||||
listaId String @map("lista_id")
|
||||
data DateTime
|
||||
|
||||
lista Lista @relation(fields: [listaId], references: [id])
|
||||
check EventoCheck[]
|
||||
|
||||
@@map("evento")
|
||||
}
|
||||
|
||||
model EventoCheck {
|
||||
eventoId String @map("evento_id")
|
||||
materialeId String @map("materiale_id")
|
||||
portato Boolean @default(false)
|
||||
note String?
|
||||
|
||||
evento Evento @relation(fields: [eventoId], references: [id])
|
||||
materiale Materiale @relation(fields: [materialeId], references: [id])
|
||||
|
||||
@@id([eventoId, materialeId])
|
||||
@@map("evento_check")
|
||||
}
|
||||
Reference in New Issue
Block a user