Added logic for quizz, need to connect everything

This commit is contained in:
2025-02-27 13:20:13 +01:00
parent 001ff8b5cb
commit be01c925a3
20 changed files with 500 additions and 23 deletions
+22 -15
View File
@@ -1,6 +1,6 @@
spring:
datasource:
url: jdbc:mysql://127.0.0.1:10051/misael
url: jdbc:postgres://127.0.0.1:10051/misael
username: misael
password: misael-dev
hikari:
@@ -10,18 +10,25 @@ spring:
locations: classpath:db/migration/structure, classpath:db/migration/data
validate-on-migrate: true
default-schema: misael
create-schemas: true
session:
jdbc:
initialize-schema: always
security:
user:
name: mysaa
# 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
@@ -1,11 +1,12 @@
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 answers (id bigint generated by default as identity, value varchar(255), form bigint not null, question bigint not null, primary key (id));
create table questions (id bigint generated by default as identity, index integer not null, type smallint not null check (type between 0 and 0), value varchar(255), 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 FKjtutlsv5n10071rq261lcjovm foreign key (form) references quizzf;
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;
alter table if exists quizzf add constraint FK7gvxodb5t2n68ot577ig9u3w6 foreign key (answerer) references users;
+13
View File
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="fr" dir="ltr">
<head>
<div th:replace="~{html-head}"/>
</head>
<body>
<div th:replace="~{header}"/>
<main>
Youhou ! (Y devrait y avoir le form ici ^^) <span th:text="${formid}"/>
</main>
</body>
</html>
+1 -1
View File
@@ -9,7 +9,7 @@
<main>
<ul>
<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>
<li th:each="q : ${quizz}"><a th:href="@{/questions/form/{id}(id=${q.id})}">Quizz <span th:text="${q.name}"/></a></li>
</ul>
</main>
</body>