Modification schema base pour ajouter un status et une date de création sur les parties + ajout fonction création uid pour codeInvitation + création controller Invite + Jeu + création nouveau DTO + 3 exceptions + InviteService

Springboot
Alix JEUDI--LEMOINE 1 year ago
parent aa61035391
commit e0ca2c700c

@ -0,0 +1,2 @@
package fr.iut.sciencequest.sae.controllers;public class InviteController {
}

@ -0,0 +1,2 @@
package fr.iut.sciencequest.sae.controllers;public class JeuController {
}

@ -0,0 +1,2 @@
package fr.iut.sciencequest.sae.controllers.request;public class PartieRequest {
}

@ -0,0 +1,2 @@
package fr.iut.sciencequest.sae.dto.partie;public class PartieNewDTO {
}

@ -0,0 +1,2 @@
package fr.iut.sciencequest.sae.exceptions;public class PartyAlreadyStartedException {
}

@ -0,0 +1,2 @@
package fr.iut.sciencequest.sae.exceptions.notFound;public class InviteNotFoundException {
}

@ -0,0 +1,7 @@
package fr.iut.sciencequest.sae.exceptions.notFound;
public class DifficulteNotFoundException extends EntityNotFoundException{
public DifficulteNotFoundException(int id) {
super("Difficulté", id);
}
}

@ -0,0 +1,2 @@
package fr.iut.sciencequest.sae.services;public class InviteService {
}

@ -92,10 +92,29 @@ CREATE TABLE Jeu(
-- Partie -- Partie
CREATE OR REPLACE FUNCTION make_uid() RETURNS text AS
'
DECLARE
new_uid text;
done bool;
BEGIN
done := false;
WHILE NOT done LOOP
new_uid := UPPER(SUBSTRING(md5(''''||now()::text||random()::text) FOR 5));
done := NOT exists(SELECT 1 FROM partie WHERE codeinvitation=new_uid);
END LOOP;
RETURN new_uid;
END;
' LANGUAGE PLPGSQL VOLATILE;
CREATE TABLE Partie( CREATE TABLE Partie(
id SERIAL PRIMARY KEY, id SERIAL PRIMARY KEY,
codeInvitation varchar(5) NOT NULL UNIQUE, codeInvitation varchar(5) NOT NULL UNIQUE,
idJeu integer REFERENCES Jeu(id) idJeu integer REFERENCES Jeu(id),
status varchar(128) NOT NULL DEFAULT 'pending',
dateCreation timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
); );
-- JOUEUR -- JOUEUR

Loading…
Cancel
Save