218 lines
8.5 KiB
Plaintext
218 lines
8.5 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlserver"
|
|
}
|
|
|
|
model Campus {
|
|
id Int @id @default(autoincrement())
|
|
nom String
|
|
adresse String
|
|
ville String
|
|
codePostal String @map("code_postal")
|
|
actif Boolean @default(true)
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
utilisateurs Utilisateur[]
|
|
sallesPret SallePret[]
|
|
materiels Materiel[]
|
|
emprunts Emprunt[]
|
|
|
|
@@map("campus")
|
|
}
|
|
|
|
model Role {
|
|
id Int @id @default(autoincrement())
|
|
code String @unique
|
|
libelle String
|
|
description String
|
|
utilisateurs Utilisateur[]
|
|
|
|
@@map("role")
|
|
}
|
|
|
|
model Utilisateur {
|
|
id Int @id @default(autoincrement())
|
|
microsoftId String @unique @map("microsoft_id")
|
|
nom String
|
|
prenom String
|
|
email String @unique
|
|
classe String?
|
|
roleId Int @map("role_id")
|
|
campusId Int @map("campus_id")
|
|
actif Boolean @default(true)
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
campus Campus @relation(fields: [campusId], references: [id])
|
|
role Role @relation(fields: [roleId], references: [id])
|
|
cartes CarteEtudiante[]
|
|
emprunts Emprunt[]
|
|
checklists Checklist[]
|
|
|
|
@@map("utilisateur")
|
|
}
|
|
|
|
model CategorieMateriel {
|
|
id Int @id @default(autoincrement())
|
|
nom String
|
|
description String
|
|
actif Boolean @default(true)
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
materiels Materiel[]
|
|
|
|
@@map("categorie_materiel")
|
|
}
|
|
|
|
model SallePret {
|
|
id Int @id @default(autoincrement())
|
|
nom String
|
|
localisation String
|
|
campusId Int @map("campus_id")
|
|
actif Boolean @default(true)
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
campus Campus @relation(fields: [campusId], references: [id])
|
|
postes PosteEmprunt[]
|
|
emprunts Emprunt[]
|
|
|
|
@@map("salle_pret")
|
|
}
|
|
|
|
model PosteEmprunt {
|
|
id Int @id @default(autoincrement())
|
|
nom String
|
|
identifiantPoste String @map("identifiant_poste")
|
|
sallePretId Int @map("salle_pret_id")
|
|
actif Boolean @default(true)
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
sallePret SallePret @relation(fields: [sallePretId], references: [id])
|
|
emprunts Emprunt[]
|
|
|
|
@@map("poste_emprunt")
|
|
}
|
|
|
|
model CarteEtudiante {
|
|
id Int @id @default(autoincrement())
|
|
utilisateurId Int @map("utilisateur_id")
|
|
qrCode String @map("qr_code")
|
|
dateActivation DateTime @map("date_activation")
|
|
dateExpiration DateTime @map("date_expiration")
|
|
actif Boolean @default(true)
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
utilisateur Utilisateur @relation(fields: [utilisateurId], references: [id])
|
|
|
|
@@map("carte_etudiante")
|
|
}
|
|
|
|
model Materiel {
|
|
id Int @id @default(autoincrement())
|
|
nom String
|
|
marque String
|
|
modele String
|
|
reference String
|
|
numeroInventaire String @map("numero_inventaire")
|
|
numeroSerie String @map("numero_serie")
|
|
statut String
|
|
etatGeneral String @map("etat_general")
|
|
categorieId Int @map("categorie_id")
|
|
campusId Int @map("campus_id")
|
|
actif Boolean @default(true)
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
categorie CategorieMateriel @relation(fields: [categorieId], references: [id])
|
|
campus Campus @relation(fields: [campusId], references: [id])
|
|
accessoires MaterielAccessoire[]
|
|
emprunts Emprunt[]
|
|
|
|
@@map("materiel")
|
|
}
|
|
|
|
model Accessoire {
|
|
id Int @id @default(autoincrement())
|
|
nom String
|
|
description String
|
|
actif Boolean @default(true)
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
materiels MaterielAccessoire[]
|
|
checklistElements ChecklistElement[]
|
|
|
|
@@map("accessoire")
|
|
}
|
|
|
|
model MaterielAccessoire {
|
|
id Int @id @default(autoincrement())
|
|
materielId Int @map("materiel_id")
|
|
accessoireId Int @map("accessoire_id")
|
|
quantiteAttendue Int @map("quantite_attendue")
|
|
obligatoire Boolean
|
|
materiel Materiel @relation(fields: [materielId], references: [id])
|
|
accessoire Accessoire @relation(fields: [accessoireId], references: [id])
|
|
|
|
@@map("materiel_accessoire")
|
|
}
|
|
|
|
model Emprunt {
|
|
id Int @id @default(autoincrement())
|
|
utilisateurId Int @map("utilisateur_id")
|
|
materielId Int @map("materiel_id")
|
|
campusId Int @map("campus_id")
|
|
sallePretId Int @map("salle_pret_id")
|
|
posteEmpruntId Int @map("poste_emprunt_id")
|
|
dateEmprunt DateTime @map("date_emprunt")
|
|
dateRetourPrevue DateTime @map("date_retour_prevue")
|
|
dateRetourReelle DateTime? @map("date_retour_reelle")
|
|
statut String
|
|
modeIdentificationEmprunt String @map("mode_identification_emprunt")
|
|
modeIdentificationRetour String? @map("mode_identification_retour")
|
|
commentaireDepart String? @map("commentaire_depart")
|
|
commentaireRetour String? @map("commentaire_retour")
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
utilisateur Utilisateur @relation(fields: [utilisateurId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
materiel Materiel @relation(fields: [materielId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
campus Campus @relation(fields: [campusId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
sallePret SallePret @relation(fields: [sallePretId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
posteEmprunt PosteEmprunt @relation(fields: [posteEmpruntId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
checklists Checklist[]
|
|
|
|
@@map("emprunt")
|
|
}
|
|
|
|
model Checklist {
|
|
id Int @id @default(autoincrement())
|
|
empruntId Int @map("emprunt_id")
|
|
utilisateurId Int @map("utilisateur_id")
|
|
type String
|
|
dateVerification DateTime @map("date_verification")
|
|
commentaire String?
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
emprunt Emprunt @relation(fields: [empruntId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
utilisateur Utilisateur @relation(fields: [utilisateurId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
elements ChecklistElement[]
|
|
|
|
@@map("checklist")
|
|
}
|
|
|
|
model ChecklistElement {
|
|
id Int @id @default(autoincrement())
|
|
checklistId Int @map("checklist_id")
|
|
accessoireId Int? @map("accessoire_id")
|
|
nomElement String @map("nom_element")
|
|
etat String
|
|
quantiteConstatee Int @map("quantite_constatee")
|
|
commentaire String?
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
checklist Checklist @relation(fields: [checklistId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
accessoire Accessoire? @relation(fields: [accessoireId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
|
|
@@map("checklist_element")
|
|
}
|