From 30e9e33814bdf80412f7631923f1a649cba98403 Mon Sep 17 00:00:00 2001 From: visoulier Date: Thu, 28 Mar 2024 09:51:16 +0100 Subject: [PATCH] ajout attribut estvalid sur reponse --- .../fr/iut/sciencequest/sae/entities/Reponse.java | 2 ++ SpringBootProject/src/main/resources/schema.sql | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/SpringBootProject/src/main/java/fr/iut/sciencequest/sae/entities/Reponse.java b/SpringBootProject/src/main/java/fr/iut/sciencequest/sae/entities/Reponse.java index d5e3d3e..fc56bb2 100644 --- a/SpringBootProject/src/main/java/fr/iut/sciencequest/sae/entities/Reponse.java +++ b/SpringBootProject/src/main/java/fr/iut/sciencequest/sae/entities/Reponse.java @@ -18,6 +18,8 @@ public class Reponse{ private String reponse; + private Boolean estValide; + @JsonBackReference @ManyToOne @JoinColumn(name = "idquestion", nullable = false) diff --git a/SpringBootProject/src/main/resources/schema.sql b/SpringBootProject/src/main/resources/schema.sql index 010c7b1..da4f218 100644 --- a/SpringBootProject/src/main/resources/schema.sql +++ b/SpringBootProject/src/main/resources/schema.sql @@ -69,6 +69,7 @@ CREATE TABLE Question( CREATE TABLE Reponse( id SERIAL PRIMARY KEY, reponse varchar(255) NOT NULL, + estValide boolean NOT NULL, idQuestion integer REFERENCES Question(id), idScientifique integer REFERENCES Scientifique(id) ); @@ -214,11 +215,15 @@ INSERT INTO Indice (libelle, idscientifique) VALUES ('S''appelle Marie', 1); -- Réponses -INSERT INTO Reponse(reponse, idQuestion, idScientifique) +INSERT INTO Reponse(reponse, estValide, idQuestion, idScientifique) VALUES - ('Marie Curie', 1, 1), - ('Albert Einstein', 2, 2), - ('Sophie Germain', 3, 3); + ('Marie Curie', true, 1, 1), + ('Albert Einstein', false, 1, 2), + + ('Marie Curie',true, 2, 1), + ('Albert Einstein',false, 2, 2), + + ('Sophie Germain', true, 3, 3); -- Partie