Added quizz, answers and security

This commit is contained in:
2025-02-23 10:25:27 +01:00
parent 4f3814bd7e
commit 001ff8b5cb
11 changed files with 216 additions and 22 deletions
+14 -14
View File
@@ -11,17 +11,17 @@ spring:
validate-on-migrate: true
default-schema: misael
# jpa:
# properties:
# javax:
# persistence:
# schema-generation:
# create-source: metadata
# scripts:
# action: update
# create-target: db-migration.sql
# database:
# action: none
# hibernate:
# ddl-auto: none
# generate-ddl: true
# jpa:
# properties:
# javax:
# persistence:
# schema-generation:
# create-source: metadata
# scripts:
# action: update
# create-target: db-migration.sql
# database:
# action: none
# hibernate:
# ddl-auto: none
# generate-ddl: true
@@ -0,0 +1,11 @@
create table answers (id bigint generated by default as identity, value oid, question bigint not null, primary key (id));
create table questions (id bigint generated by default as identity, index integer not null, value oid, quizz bigint not null, primary key (id));
create table quizz (id bigint generated by default as identity, is_public boolean default false not null, name varchar(255) not null, question_count integer default 0 not null, owner bigint, primary key (id));
create table quizzf (id bigint generated by default as identity, answer_step integer not null, current_question integer not null, done boolean not null, quizz bigint not null, answerer bigint not null, primary key (id));
alter table if exists quizz drop constraint if exists UKc1plspc0ecmwqqpfaf24avb4c;
alter table if exists quizz add constraint UKc1plspc0ecmwqqpfaf24avb4c unique (name);
alter table if exists answers add constraint FK54dobrdq2u51m4u8s7kg0as8v foreign key (question) references questions;
alter table if exists questions add constraint FKq12h25ynjok1m497gwos511te foreign key (quizz) references quizz;
alter table if exists quizz add constraint FKfeoogns8m4m4hvno1ttqb30wm foreign key (owner) references users;
alter table if exists quizzf add constraint FK4ukbg2yaa93gs5nx1s5d9rqu4 foreign key (quizz) references quizz;
alter table if exists quizzf add constraint FKuj3h8r3i4lnxukdqobapwbuq foreign key (answerer) references users;
+2 -4
View File
@@ -7,11 +7,9 @@
<body>
<div th:replace="~{header}"/>
<main>
<ul>
<li><a href="/questions/newform?q=132">Quizz numéro 1</a></li>
<li><a href="/questions/newform?q=177">Quizz numéro 2</a></li>
<li><a href="/questions/newform?q=16818">Quizz numéro 3</a></li>
<li>Premier item ?</li>
<li th:each="q : ${quizz}"><a th:href="@{/questions/newform/{id}(id=${q.id})}">Quizz <span th:text="${q.name}"/></a></li>
</ul>
</main>
</body>