diff --git a/microservices/auth/dockerfile b/microservices/auth/dockerfile index 548d915111f6770e9b7065ddd55035d4c6c97bd2..5ecf6a1dd5313d3ea89f871f700813ae6356ac21 100644 --- a/microservices/auth/dockerfile +++ b/microservices/auth/dockerfile @@ -1,25 +1,39 @@ # Étape 1 : Construction de l'application FROM node:18 AS builder +# Définir le répertoire de travail WORKDIR /app -# Copier tout le projet depuis ta machine (y compris tsconfig.json) -COPY . . +# Copier les fichiers package +COPY package.json package-lock.json ./ # Installer les dépendances RUN npm install -# Compiler TypeScript +# Copier les fichiers sources +COPY . . + +# Compiler le projet TypeScript RUN npm run build # Étape 2 : Image de production FROM node:18 +# Définir le répertoire de travail WORKDIR /app -# Copier les fichiers de production depuis le builder -COPY --from=builder /app . +# Copier les fichiers nécessaires depuis le builder +COPY --from=builder /app/dist ./dist +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/prisma ./prisma +COPY package.json ./ +COPY .env .env +COPY entrypoint.sh ./entrypoint.sh + +# Donner les permissions nécessaires +RUN chmod +x entrypoint.sh EXPOSE 30992 -CMD ["npm", "run", "start:dev"] \ No newline at end of file +# Utilisation du script d'entrée +ENTRYPOINT ["sh", "./entrypoint.sh"] diff --git a/microservices/helloworld/entrypoint.sh b/microservices/auth/entrypoint.sh similarity index 100% rename from microservices/helloworld/entrypoint.sh rename to microservices/auth/entrypoint.sh diff --git a/microservices/auth/prisma/database.db b/microservices/auth/prisma/database.db deleted file mode 100644 index d43cbe19ddee87ab6f09e2644d0559a1d0a36e4f..0000000000000000000000000000000000000000 Binary files a/microservices/auth/prisma/database.db and /dev/null differ diff --git a/microservices/auth/prisma/migrations/20240417125028_database_creation/migration.sql b/microservices/auth/prisma/migrations/20240417125028_database_creation/migration.sql deleted file mode 100644 index af5102c8ba20cc6051c01d3ca06b2e7f8d7e14d9..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240417125028_database_creation/migration.sql +++ /dev/null @@ -1 +0,0 @@ --- This is an empty migration. \ No newline at end of file diff --git a/microservices/auth/prisma/migrations/20240417125048_add_user_schema/migration.sql b/microservices/auth/prisma/migrations/20240417125048_add_user_schema/migration.sql deleted file mode 100644 index d8030354425fc9fc27d096fb567bcf6de66a85a2..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240417125048_add_user_schema/migration.sql +++ /dev/null @@ -1,14 +0,0 @@ --- CreateTable -CREATE TABLE "User" ( - "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "name" TEXT, - "mail" TEXT, - "gitlabUsername" TEXT NOT NULL, - "deleted" BOOLEAN NOT NULL DEFAULT false -); - --- CreateIndex -CREATE UNIQUE INDEX "User_mail_key" ON "User"("mail"); - --- CreateIndex -CREATE UNIQUE INDEX "User_gitlabUsername_key" ON "User"("gitlabUsername"); diff --git a/microservices/auth/prisma/migrations/20240523145021_create_complete_database/migration.sql b/microservices/auth/prisma/migrations/20240523145021_create_complete_database/migration.sql deleted file mode 100644 index b6a8b802e05baff59c9845d34305d7782806b55e..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240523145021_create_complete_database/migration.sql +++ /dev/null @@ -1,48 +0,0 @@ --- CreateTable -CREATE TABLE "QCM" ( - "idQCM" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "nomQCM" TEXT NOT NULL, - "temps" TEXT NOT NULL, - "randomOrder" BOOLEAN NOT NULL -); - --- CreateTable -CREATE TABLE "Type" ( - "idType" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "nomType" TEXT NOT NULL -); - --- CreateTable -CREATE TABLE "Choix" ( - "idChoix" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "isCorrect" BOOLEAN NOT NULL, - "idQuestion" INTEGER NOT NULL, - CONSTRAINT "Choix_idQuestion_fkey" FOREIGN KEY ("idQuestion") REFERENCES "Question" ("idQuestion") ON DELETE RESTRICT ON UPDATE CASCADE -); - --- CreateTable -CREATE TABLE "Question" ( - "idQuestion" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "question" TEXT NOT NULL, - "position" INTEGER NOT NULL, - "nbPtsPositif" INTEGER NOT NULL, - "nbPtsNegatif" INTEGER NOT NULL, - "numeric" BOOLEAN, - "idQCM" INTEGER NOT NULL, - "idType" INTEGER NOT NULL, - CONSTRAINT "Question_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "QCM" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Question_idType_fkey" FOREIGN KEY ("idType") REFERENCES "Type" ("idType") ON DELETE RESTRICT ON UPDATE CASCADE -); - --- CreateTable -CREATE TABLE "Reponse" ( - "idQuestion" INTEGER NOT NULL, - "idChoix" INTEGER NOT NULL, - "idUser" INTEGER NOT NULL, - "numeric" REAL, - - PRIMARY KEY ("idQuestion", "idChoix", "idUser"), - CONSTRAINT "Reponse_idQuestion_fkey" FOREIGN KEY ("idQuestion") REFERENCES "Question" ("idQuestion") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Reponse_idChoix_fkey" FOREIGN KEY ("idChoix") REFERENCES "Choix" ("idChoix") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Reponse_idUser_fkey" FOREIGN KEY ("idUser") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE -); diff --git a/microservices/auth/prisma/migrations/20240530082347_update_db/migration.sql b/microservices/auth/prisma/migrations/20240530082347_update_db/migration.sql deleted file mode 100644 index 60c86e8c93bf3e342bed7b5cc39c4a7e653d4b67..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240530082347_update_db/migration.sql +++ /dev/null @@ -1,30 +0,0 @@ -/* - Warnings: - - - Added the required column `codeAcces` to the `QCM` table without a default value. This is not possible if the table is not empty. - -*/ --- CreateTable -CREATE TABLE "Participer" ( - "idUser" INTEGER NOT NULL, - "idQCM" INTEGER NOT NULL, - - PRIMARY KEY ("idUser", "idQCM"), - CONSTRAINT "Participer_idUser_fkey" FOREIGN KEY ("idUser") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Participer_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "QCM" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE -); - --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_QCM" ( - "idQCM" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "nomQCM" TEXT NOT NULL, - "temps" TEXT NOT NULL, - "randomOrder" BOOLEAN NOT NULL, - "codeAcces" INTEGER NOT NULL -); -INSERT INTO "new_QCM" ("idQCM", "nomQCM", "randomOrder", "temps") SELECT "idQCM", "nomQCM", "randomOrder", "temps" FROM "QCM"; -DROP TABLE "QCM"; -ALTER TABLE "new_QCM" RENAME TO "QCM"; -PRAGMA foreign_key_check("QCM"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240530082946_add_champs/migration.sql b/microservices/auth/prisma/migrations/20240530082946_add_champs/migration.sql deleted file mode 100644 index 2eb101b85823f301ea420072cfb0e4bdeae54b4d..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240530082946_add_champs/migration.sql +++ /dev/null @@ -1,24 +0,0 @@ -/* - Warnings: - - - Added the required column `feedback` to the `Participer` table without a default value. This is not possible if the table is not empty. - - Added the required column `note` to the `Participer` table without a default value. This is not possible if the table is not empty. - -*/ --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Participer" ( - "idUser" INTEGER NOT NULL, - "idQCM" INTEGER NOT NULL, - "feedback" TEXT NOT NULL, - "note" REAL NOT NULL, - - PRIMARY KEY ("idUser", "idQCM"), - CONSTRAINT "Participer_idUser_fkey" FOREIGN KEY ("idUser") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Participer_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "QCM" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Participer" ("idQCM", "idUser") SELECT "idQCM", "idUser" FROM "Participer"; -DROP TABLE "Participer"; -ALTER TABLE "new_Participer" RENAME TO "Participer"; -PRAGMA foreign_key_check("Participer"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240530151620_update/migration.sql b/microservices/auth/prisma/migrations/20240530151620_update/migration.sql deleted file mode 100644 index cd6e8980aed9710df93d3c881ea7ee0e687034ec..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240530151620_update/migration.sql +++ /dev/null @@ -1,20 +0,0 @@ -/* - Warnings: - - - Added the required column `nomChoix` to the `Choix` table without a default value. This is not possible if the table is not empty. - -*/ --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Choix" ( - "idChoix" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "isCorrect" BOOLEAN NOT NULL, - "idQuestion" INTEGER NOT NULL, - "nomChoix" TEXT NOT NULL, - CONSTRAINT "Choix_idQuestion_fkey" FOREIGN KEY ("idQuestion") REFERENCES "Question" ("idQuestion") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Choix" ("idChoix", "idQuestion", "isCorrect") SELECT "idChoix", "idQuestion", "isCorrect" FROM "Choix"; -DROP TABLE "Choix"; -ALTER TABLE "new_Choix" RENAME TO "Choix"; -PRAGMA foreign_key_check("Choix"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240530161440_/migration.sql b/microservices/auth/prisma/migrations/20240530161440_/migration.sql deleted file mode 100644 index ac44a9b444eac993806e94a4d9857f907108d419..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240530161440_/migration.sql +++ /dev/null @@ -1,53 +0,0 @@ -/* - Warnings: - - - You are about to drop the `QCM` table. If the table is not empty, all the data it contains will be lost. - -*/ --- DropTable -PRAGMA foreign_keys=off; -DROP TABLE "QCM"; -PRAGMA foreign_keys=on; - --- CreateTable -CREATE TABLE "Qcm" ( - "idQCM" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "nomQCM" TEXT NOT NULL, - "temps" TEXT NOT NULL, - "randomOrder" BOOLEAN NOT NULL, - "codeAcces" INTEGER NOT NULL -); - --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Question" ( - "idQuestion" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "question" TEXT NOT NULL, - "position" INTEGER NOT NULL, - "nbPtsPositif" INTEGER NOT NULL, - "nbPtsNegatif" INTEGER NOT NULL, - "numeric" BOOLEAN, - "idQCM" INTEGER NOT NULL, - "idType" INTEGER NOT NULL, - CONSTRAINT "Question_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "Qcm" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Question_idType_fkey" FOREIGN KEY ("idType") REFERENCES "Type" ("idType") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Question" ("idQCM", "idQuestion", "idType", "nbPtsNegatif", "nbPtsPositif", "numeric", "position", "question") SELECT "idQCM", "idQuestion", "idType", "nbPtsNegatif", "nbPtsPositif", "numeric", "position", "question" FROM "Question"; -DROP TABLE "Question"; -ALTER TABLE "new_Question" RENAME TO "Question"; -CREATE TABLE "new_Participer" ( - "idUser" INTEGER NOT NULL, - "idQCM" INTEGER NOT NULL, - "feedback" TEXT NOT NULL, - "note" REAL NOT NULL, - - PRIMARY KEY ("idUser", "idQCM"), - CONSTRAINT "Participer_idUser_fkey" FOREIGN KEY ("idUser") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Participer_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "Qcm" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Participer" ("feedback", "idQCM", "idUser", "note") SELECT "feedback", "idQCM", "idUser", "note" FROM "Participer"; -DROP TABLE "Participer"; -ALTER TABLE "new_Participer" RENAME TO "Participer"; -PRAGMA foreign_key_check("Question"); -PRAGMA foreign_key_check("Participer"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240530162619_test/migration.sql b/microservices/auth/prisma/migrations/20240530162619_test/migration.sql deleted file mode 100644 index aa822b847d196e0ae648747c4467cb178a7b66ed..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240530162619_test/migration.sql +++ /dev/null @@ -1,53 +0,0 @@ -/* - Warnings: - - - You are about to drop the `Qcm` table. If the table is not empty, all the data it contains will be lost. - -*/ --- DropTable -PRAGMA foreign_keys=off; -DROP TABLE "Qcm"; -PRAGMA foreign_keys=on; - --- CreateTable -CREATE TABLE "QcmTable" ( - "idQCM" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "nomQCM" TEXT NOT NULL, - "temps" TEXT NOT NULL, - "randomOrder" BOOLEAN NOT NULL, - "codeAcces" INTEGER NOT NULL -); - --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Question" ( - "idQuestion" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "question" TEXT NOT NULL, - "position" INTEGER NOT NULL, - "nbPtsPositif" INTEGER NOT NULL, - "nbPtsNegatif" INTEGER NOT NULL, - "numeric" BOOLEAN, - "idQCM" INTEGER NOT NULL, - "idType" INTEGER NOT NULL, - CONSTRAINT "Question_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "QcmTable" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Question_idType_fkey" FOREIGN KEY ("idType") REFERENCES "Type" ("idType") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Question" ("idQCM", "idQuestion", "idType", "nbPtsNegatif", "nbPtsPositif", "numeric", "position", "question") SELECT "idQCM", "idQuestion", "idType", "nbPtsNegatif", "nbPtsPositif", "numeric", "position", "question" FROM "Question"; -DROP TABLE "Question"; -ALTER TABLE "new_Question" RENAME TO "Question"; -CREATE TABLE "new_Participer" ( - "idUser" INTEGER NOT NULL, - "idQCM" INTEGER NOT NULL, - "feedback" TEXT NOT NULL, - "note" REAL NOT NULL, - - PRIMARY KEY ("idUser", "idQCM"), - CONSTRAINT "Participer_idUser_fkey" FOREIGN KEY ("idUser") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Participer_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "QcmTable" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Participer" ("feedback", "idQCM", "idUser", "note") SELECT "feedback", "idQCM", "idUser", "note" FROM "Participer"; -DROP TABLE "Participer"; -ALTER TABLE "new_Participer" RENAME TO "Participer"; -PRAGMA foreign_key_check("Question"); -PRAGMA foreign_key_check("Participer"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240606084017_c/migration.sql b/microservices/auth/prisma/migrations/20240606084017_c/migration.sql deleted file mode 100644 index dfcc3f5411436d2f59e98a1642390bc2d091f8dc..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240606084017_c/migration.sql +++ /dev/null @@ -1,37 +0,0 @@ -/* - Warnings: - - - Added the required column `heureDebut` to the `Participer` table without a default value. This is not possible if the table is not empty. - - Added the required column `position` to the `Choix` table without a default value. This is not possible if the table is not empty. - -*/ --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Participer" ( - "idUser" INTEGER NOT NULL, - "idQCM" INTEGER NOT NULL, - "feedback" TEXT NOT NULL, - "note" REAL NOT NULL, - "heureDebut" TEXT NOT NULL, - - PRIMARY KEY ("idUser", "idQCM"), - CONSTRAINT "Participer_idUser_fkey" FOREIGN KEY ("idUser") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Participer_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "QcmTable" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Participer" ("feedback", "idQCM", "idUser", "note") SELECT "feedback", "idQCM", "idUser", "note" FROM "Participer"; -DROP TABLE "Participer"; -ALTER TABLE "new_Participer" RENAME TO "Participer"; -CREATE TABLE "new_Choix" ( - "idChoix" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "isCorrect" BOOLEAN NOT NULL, - "idQuestion" INTEGER NOT NULL, - "nomChoix" TEXT NOT NULL, - "position" INTEGER NOT NULL, - CONSTRAINT "Choix_idQuestion_fkey" FOREIGN KEY ("idQuestion") REFERENCES "Question" ("idQuestion") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Choix" ("idChoix", "idQuestion", "isCorrect", "nomChoix") SELECT "idChoix", "idQuestion", "isCorrect", "nomChoix" FROM "Choix"; -DROP TABLE "Choix"; -ALTER TABLE "new_Choix" RENAME TO "Choix"; -PRAGMA foreign_key_check("Participer"); -PRAGMA foreign_key_check("Choix"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240606093824_relation_added/migration.sql b/microservices/auth/prisma/migrations/20240606093824_relation_added/migration.sql deleted file mode 100644 index 3419aa373f73c34a0ae0436d3fcbb56cd522840c..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240606093824_relation_added/migration.sql +++ /dev/null @@ -1,40 +0,0 @@ -/* - Warnings: - - - Added the required column `isMultiple` to the `Question` table without a default value. This is not possible if the table is not empty. - - Added the required column `idUserCreator` to the `QcmTable` table without a default value. This is not possible if the table is not empty. - -*/ --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Question" ( - "idQuestion" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "question" TEXT NOT NULL, - "position" INTEGER NOT NULL, - "nbPtsPositif" INTEGER NOT NULL, - "nbPtsNegatif" INTEGER NOT NULL, - "numeric" BOOLEAN, - "idQCM" INTEGER NOT NULL, - "idType" INTEGER NOT NULL, - "isMultiple" BOOLEAN NOT NULL, - CONSTRAINT "Question_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "QcmTable" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Question_idType_fkey" FOREIGN KEY ("idType") REFERENCES "Type" ("idType") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Question" ("idQCM", "idQuestion", "idType", "nbPtsNegatif", "nbPtsPositif", "numeric", "position", "question") SELECT "idQCM", "idQuestion", "idType", "nbPtsNegatif", "nbPtsPositif", "numeric", "position", "question" FROM "Question"; -DROP TABLE "Question"; -ALTER TABLE "new_Question" RENAME TO "Question"; -CREATE TABLE "new_QcmTable" ( - "idQCM" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "nomQCM" TEXT NOT NULL, - "temps" TEXT NOT NULL, - "randomOrder" BOOLEAN NOT NULL, - "codeAcces" INTEGER NOT NULL, - "idUserCreator" INTEGER NOT NULL, - CONSTRAINT "QcmTable_idUserCreator_fkey" FOREIGN KEY ("idUserCreator") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_QcmTable" ("codeAcces", "idQCM", "nomQCM", "randomOrder", "temps") SELECT "codeAcces", "idQCM", "nomQCM", "randomOrder", "temps" FROM "QcmTable"; -DROP TABLE "QcmTable"; -ALTER TABLE "new_QcmTable" RENAME TO "QcmTable"; -PRAGMA foreign_key_check("Question"); -PRAGMA foreign_key_check("QcmTable"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240606094407_v/migration.sql b/microservices/auth/prisma/migrations/20240606094407_v/migration.sql deleted file mode 100644 index af5102c8ba20cc6051c01d3ca06b2e7f8d7e14d9..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240606094407_v/migration.sql +++ /dev/null @@ -1 +0,0 @@ --- This is an empty migration. \ No newline at end of file diff --git a/microservices/auth/prisma/migrations/20240612164927_change_date_type/migration.sql b/microservices/auth/prisma/migrations/20240612164927_change_date_type/migration.sql deleted file mode 100644 index fa2acb9a6d9b15515be9fbda10eef0f74d217884..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240612164927_change_date_type/migration.sql +++ /dev/null @@ -1,24 +0,0 @@ -/* - Warnings: - - - You are about to alter the column `heureDebut` on the `Participer` table. The data in that column could be lost. The data in that column will be cast from `String` to `Int`. - -*/ --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Participer" ( - "idUser" INTEGER NOT NULL, - "idQCM" INTEGER NOT NULL, - "feedback" TEXT NOT NULL, - "note" REAL NOT NULL, - "heureDebut" INTEGER NOT NULL, - - PRIMARY KEY ("idUser", "idQCM"), - CONSTRAINT "Participer_idUser_fkey" FOREIGN KEY ("idUser") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Participer_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "QcmTable" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Participer" ("feedback", "heureDebut", "idQCM", "idUser", "note") SELECT "feedback", "heureDebut", "idQCM", "idUser", "note" FROM "Participer"; -DROP TABLE "Participer"; -ALTER TABLE "new_Participer" RENAME TO "Participer"; -PRAGMA foreign_key_check("Participer"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240612180153_change_temps_type/migration.sql b/microservices/auth/prisma/migrations/20240612180153_change_temps_type/migration.sql deleted file mode 100644 index 5e75a88d2d19a89b61a23bf1d15522f8157c83f8..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240612180153_change_temps_type/migration.sql +++ /dev/null @@ -1,22 +0,0 @@ -/* - Warnings: - - - You are about to alter the column `temps` on the `QcmTable` table. The data in that column could be lost. The data in that column will be cast from `String` to `Int`. - -*/ --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_QcmTable" ( - "idQCM" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "nomQCM" TEXT NOT NULL, - "temps" INTEGER NOT NULL, - "randomOrder" BOOLEAN NOT NULL, - "codeAcces" INTEGER NOT NULL, - "idUserCreator" INTEGER NOT NULL, - CONSTRAINT "QcmTable_idUserCreator_fkey" FOREIGN KEY ("idUserCreator") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_QcmTable" ("codeAcces", "idQCM", "idUserCreator", "nomQCM", "randomOrder", "temps") SELECT "codeAcces", "idQCM", "idUserCreator", "nomQCM", "randomOrder", "temps" FROM "QcmTable"; -DROP TABLE "QcmTable"; -ALTER TABLE "new_QcmTable" RENAME TO "QcmTable"; -PRAGMA foreign_key_check("QcmTable"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240613090400_add_has_finished/migration.sql b/microservices/auth/prisma/migrations/20240613090400_add_has_finished/migration.sql deleted file mode 100644 index 192dde7424ce7e356bf0f97cc7a7d6ce1bdcc32b..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240613090400_add_has_finished/migration.sql +++ /dev/null @@ -1,19 +0,0 @@ --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Participer" ( - "idUser" INTEGER NOT NULL, - "idQCM" INTEGER NOT NULL, - "feedback" TEXT NOT NULL, - "note" REAL NOT NULL, - "heureDebut" INTEGER NOT NULL, - "hasFinished" BOOLEAN NOT NULL DEFAULT false, - - PRIMARY KEY ("idUser", "idQCM"), - CONSTRAINT "Participer_idUser_fkey" FOREIGN KEY ("idUser") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Participer_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "QcmTable" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Participer" ("feedback", "heureDebut", "idQCM", "idUser", "note") SELECT "feedback", "heureDebut", "idQCM", "idUser", "note" FROM "Participer"; -DROP TABLE "Participer"; -ALTER TABLE "new_Participer" RENAME TO "Participer"; -PRAGMA foreign_key_check("Participer"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240613125037_change_numeric_type/migration.sql b/microservices/auth/prisma/migrations/20240613125037_change_numeric_type/migration.sql deleted file mode 100644 index db70c6b03e8f19f850bb3adfa4ec4cd8e659f5fd..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240613125037_change_numeric_type/migration.sql +++ /dev/null @@ -1,26 +0,0 @@ -/* - Warnings: - - - You are about to alter the column `numeric` on the `Question` table. The data in that column could be lost. The data in that column will be cast from `Boolean` to `Int`. - -*/ --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Question" ( - "idQuestion" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "question" TEXT NOT NULL, - "position" INTEGER NOT NULL, - "nbPtsPositif" INTEGER NOT NULL, - "nbPtsNegatif" INTEGER NOT NULL, - "numeric" INTEGER, - "idQCM" INTEGER NOT NULL, - "idType" INTEGER NOT NULL, - "isMultiple" BOOLEAN NOT NULL, - CONSTRAINT "Question_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "QcmTable" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Question_idType_fkey" FOREIGN KEY ("idType") REFERENCES "Type" ("idType") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Question" ("idQCM", "idQuestion", "idType", "isMultiple", "nbPtsNegatif", "nbPtsPositif", "numeric", "position", "question") SELECT "idQCM", "idQuestion", "idType", "isMultiple", "nbPtsNegatif", "nbPtsPositif", "numeric", "position", "question" FROM "Question"; -DROP TABLE "Question"; -ALTER TABLE "new_Question" RENAME TO "Question"; -PRAGMA foreign_key_check("Question"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240613130357_test/migration.sql b/microservices/auth/prisma/migrations/20240613130357_test/migration.sql deleted file mode 100644 index af5102c8ba20cc6051c01d3ca06b2e7f8d7e14d9..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240613130357_test/migration.sql +++ /dev/null @@ -1 +0,0 @@ --- This is an empty migration. \ No newline at end of file diff --git a/microservices/auth/prisma/migrations/20240613135314_/migration.sql b/microservices/auth/prisma/migrations/20240613135314_/migration.sql deleted file mode 100644 index f0ced18d1814307ba106a14d93c665c214a38188..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240613135314_/migration.sql +++ /dev/null @@ -1,25 +0,0 @@ -/* - Warnings: - - - The primary key for the `Reponse` table will be changed. If it partially fails, the table could be left without primary key constraint. - -*/ --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Reponse" ( - "idQuestion" INTEGER NOT NULL, - "idChoix" INTEGER, - "idUser" INTEGER NOT NULL, - "numeric" REAL, - - PRIMARY KEY ("idQuestion", "idUser"), - CONSTRAINT "Reponse_idQuestion_fkey" FOREIGN KEY ("idQuestion") REFERENCES "Question" ("idQuestion") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Reponse_idChoix_fkey" FOREIGN KEY ("idChoix") REFERENCES "Choix" ("idChoix") ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT "Reponse_idUser_fkey" FOREIGN KEY ("idUser") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Reponse" ("idChoix", "idQuestion", "idUser", "numeric") SELECT "idChoix", "idQuestion", "idUser", "numeric" FROM "Reponse"; -DROP TABLE "Reponse"; -ALTER TABLE "new_Reponse" RENAME TO "Reponse"; -CREATE UNIQUE INDEX "Reponse_idQuestion_idUser_idChoix_key" ON "Reponse"("idQuestion", "idUser", "idChoix"); -PRAGMA foreign_key_check("Reponse"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240613135344_test2/migration.sql b/microservices/auth/prisma/migrations/20240613135344_test2/migration.sql deleted file mode 100644 index af5102c8ba20cc6051c01d3ca06b2e7f8d7e14d9..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240613135344_test2/migration.sql +++ /dev/null @@ -1 +0,0 @@ --- This is an empty migration. \ No newline at end of file diff --git a/microservices/auth/prisma/migrations/20240613145516_test3/migration.sql b/microservices/auth/prisma/migrations/20240613145516_test3/migration.sql deleted file mode 100644 index 1ed20e0ed62fa1741a19c806a5200a85d2a31155..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240613145516_test3/migration.sql +++ /dev/null @@ -1,25 +0,0 @@ -/* - Warnings: - - - The primary key for the `Reponse` table will be changed. If it partially fails, the table could be left without primary key constraint. - - Added the required column `idReponse` to the `Reponse` table without a default value. This is not possible if the table is not empty. - -*/ --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Reponse" ( - "idReponse" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "idQuestion" INTEGER NOT NULL, - "idChoix" INTEGER, - "idUser" INTEGER NOT NULL, - "numeric" REAL, - CONSTRAINT "Reponse_idQuestion_fkey" FOREIGN KEY ("idQuestion") REFERENCES "Question" ("idQuestion") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Reponse_idChoix_fkey" FOREIGN KEY ("idChoix") REFERENCES "Choix" ("idChoix") ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT "Reponse_idUser_fkey" FOREIGN KEY ("idUser") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Reponse" ("idChoix", "idQuestion", "idUser", "numeric") SELECT "idChoix", "idQuestion", "idUser", "numeric" FROM "Reponse"; -DROP TABLE "Reponse"; -ALTER TABLE "new_Reponse" RENAME TO "Reponse"; -CREATE UNIQUE INDEX "Reponse_idQuestion_idUser_idChoix_key" ON "Reponse"("idQuestion", "idUser", "idChoix"); -PRAGMA foreign_key_check("Reponse"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240613150814_es/migration.sql b/microservices/auth/prisma/migrations/20240613150814_es/migration.sql deleted file mode 100644 index af5102c8ba20cc6051c01d3ca06b2e7f8d7e14d9..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240613150814_es/migration.sql +++ /dev/null @@ -1 +0,0 @@ --- This is an empty migration. \ No newline at end of file diff --git a/microservices/auth/prisma/migrations/20240613154612_add_some_action/migration.sql b/microservices/auth/prisma/migrations/20240613154612_add_some_action/migration.sql deleted file mode 100644 index 1e72d45c59d5f3f7861d60a7687b13854297f001..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240613154612_add_some_action/migration.sql +++ /dev/null @@ -1,30 +0,0 @@ --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Choix" ( - "idChoix" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "isCorrect" BOOLEAN NOT NULL, - "idQuestion" INTEGER NOT NULL, - "nomChoix" TEXT NOT NULL, - "position" INTEGER NOT NULL, - CONSTRAINT "Choix_idQuestion_fkey" FOREIGN KEY ("idQuestion") REFERENCES "Question" ("idQuestion") ON DELETE CASCADE ON UPDATE CASCADE -); -INSERT INTO "new_Choix" ("idChoix", "idQuestion", "isCorrect", "nomChoix", "position") SELECT "idChoix", "idQuestion", "isCorrect", "nomChoix", "position" FROM "Choix"; -DROP TABLE "Choix"; -ALTER TABLE "new_Choix" RENAME TO "Choix"; -CREATE TABLE "new_Reponse" ( - "idReponse" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "idQuestion" INTEGER NOT NULL, - "idChoix" INTEGER, - "idUser" INTEGER NOT NULL, - "numeric" REAL, - CONSTRAINT "Reponse_idQuestion_fkey" FOREIGN KEY ("idQuestion") REFERENCES "Question" ("idQuestion") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Reponse_idChoix_fkey" FOREIGN KEY ("idChoix") REFERENCES "Choix" ("idChoix") ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT "Reponse_idUser_fkey" FOREIGN KEY ("idUser") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Reponse" ("idChoix", "idQuestion", "idReponse", "idUser", "numeric") SELECT "idChoix", "idQuestion", "idReponse", "idUser", "numeric" FROM "Reponse"; -DROP TABLE "Reponse"; -ALTER TABLE "new_Reponse" RENAME TO "Reponse"; -CREATE UNIQUE INDEX "Reponse_idQuestion_idUser_idChoix_key" ON "Reponse"("idQuestion", "idUser", "idChoix"); -PRAGMA foreign_key_check("Choix"); -PRAGMA foreign_key_check("Reponse"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240613195132_database/migration.sql b/microservices/auth/prisma/migrations/20240613195132_database/migration.sql deleted file mode 100644 index af5102c8ba20cc6051c01d3ca06b2e7f8d7e14d9..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240613195132_database/migration.sql +++ /dev/null @@ -1 +0,0 @@ --- This is an empty migration. \ No newline at end of file diff --git a/microservices/auth/prisma/migrations/20240615191543_/migration.sql b/microservices/auth/prisma/migrations/20240615191543_/migration.sql deleted file mode 100644 index 83a47a170d186acdff08f8a62732daca9101b38c..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240615191543_/migration.sql +++ /dev/null @@ -1,26 +0,0 @@ -/* - Warnings: - - - Added the required column `score` to the `Participer` table without a default value. This is not possible if the table is not empty. - -*/ --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Participer" ( - "idUser" INTEGER NOT NULL, - "idQCM" INTEGER NOT NULL, - "feedback" TEXT NOT NULL, - "note" REAL NOT NULL, - "score" INTEGER NOT NULL, - "heureDebut" INTEGER NOT NULL, - "hasFinished" BOOLEAN NOT NULL DEFAULT false, - - PRIMARY KEY ("idUser", "idQCM"), - CONSTRAINT "Participer_idUser_fkey" FOREIGN KEY ("idUser") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Participer_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "QcmTable" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Participer" ("feedback", "hasFinished", "heureDebut", "idQCM", "idUser", "note") SELECT "feedback", "hasFinished", "heureDebut", "idQCM", "idUser", "note" FROM "Participer"; -DROP TABLE "Participer"; -ALTER TABLE "new_Participer" RENAME TO "Participer"; -PRAGMA foreign_key_check("Participer"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240615192133_/migration.sql b/microservices/auth/prisma/migrations/20240615192133_/migration.sql deleted file mode 100644 index 9be8341dc8496f232a0d47197d53a2e9cee9a1ba..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240615192133_/migration.sql +++ /dev/null @@ -1,20 +0,0 @@ --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Participer" ( - "idUser" INTEGER NOT NULL, - "idQCM" INTEGER NOT NULL, - "feedback" TEXT NOT NULL, - "note" REAL NOT NULL, - "score" INTEGER, - "heureDebut" INTEGER NOT NULL, - "hasFinished" BOOLEAN NOT NULL DEFAULT false, - - PRIMARY KEY ("idUser", "idQCM"), - CONSTRAINT "Participer_idUser_fkey" FOREIGN KEY ("idUser") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Participer_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "QcmTable" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Participer" ("feedback", "hasFinished", "heureDebut", "idQCM", "idUser", "note", "score") SELECT "feedback", "hasFinished", "heureDebut", "idQCM", "idUser", "note", "score" FROM "Participer"; -DROP TABLE "Participer"; -ALTER TABLE "new_Participer" RENAME TO "Participer"; -PRAGMA foreign_key_check("Participer"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240615194339_/migration.sql b/microservices/auth/prisma/migrations/20240615194339_/migration.sql deleted file mode 100644 index a1699f146a0ab8677b7898217e393da9462b81f5..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240615194339_/migration.sql +++ /dev/null @@ -1,26 +0,0 @@ -/* - Warnings: - - - Made the column `score` on table `Participer` required. This step will fail if there are existing NULL values in that column. - -*/ --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Participer" ( - "idUser" INTEGER NOT NULL, - "idQCM" INTEGER NOT NULL, - "feedback" TEXT NOT NULL, - "note" REAL NOT NULL, - "score" INTEGER NOT NULL, - "heureDebut" INTEGER NOT NULL, - "hasFinished" BOOLEAN NOT NULL DEFAULT false, - - PRIMARY KEY ("idUser", "idQCM"), - CONSTRAINT "Participer_idUser_fkey" FOREIGN KEY ("idUser") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Participer_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "QcmTable" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Participer" ("feedback", "hasFinished", "heureDebut", "idQCM", "idUser", "note", "score") SELECT "feedback", "hasFinished", "heureDebut", "idQCM", "idUser", "note", "score" FROM "Participer"; -DROP TABLE "Participer"; -ALTER TABLE "new_Participer" RENAME TO "Participer"; -PRAGMA foreign_key_check("Participer"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240615194422_add_score/migration.sql b/microservices/auth/prisma/migrations/20240615194422_add_score/migration.sql deleted file mode 100644 index af5102c8ba20cc6051c01d3ca06b2e7f8d7e14d9..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240615194422_add_score/migration.sql +++ /dev/null @@ -1 +0,0 @@ --- This is an empty migration. \ No newline at end of file diff --git a/microservices/auth/prisma/migrations/20240615195336_regle_erreur/migration.sql b/microservices/auth/prisma/migrations/20240615195336_regle_erreur/migration.sql deleted file mode 100644 index af5102c8ba20cc6051c01d3ca06b2e7f8d7e14d9..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240615195336_regle_erreur/migration.sql +++ /dev/null @@ -1 +0,0 @@ --- This is an empty migration. \ No newline at end of file diff --git a/microservices/auth/prisma/migrations/20240615235649_add_random_order_choix/migration.sql b/microservices/auth/prisma/migrations/20240615235649_add_random_order_choix/migration.sql deleted file mode 100644 index 4e5fbeeaabab3ab0b1062ed02df8884c4893fe69..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240615235649_add_random_order_choix/migration.sql +++ /dev/null @@ -1,27 +0,0 @@ -/* - Warnings: - - - Added the required column `randomOrder` to the `Question` table without a default value. This is not possible if the table is not empty. - -*/ --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Question" ( - "idQuestion" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "question" TEXT NOT NULL, - "position" INTEGER NOT NULL, - "randomOrder" BOOLEAN NOT NULL, - "nbPtsPositif" INTEGER NOT NULL, - "nbPtsNegatif" INTEGER NOT NULL, - "numeric" INTEGER, - "idQCM" INTEGER NOT NULL, - "idType" INTEGER NOT NULL, - "isMultiple" BOOLEAN NOT NULL, - CONSTRAINT "Question_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "QcmTable" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Question_idType_fkey" FOREIGN KEY ("idType") REFERENCES "Type" ("idType") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Question" ("idQCM", "idQuestion", "idType", "isMultiple", "nbPtsNegatif", "nbPtsPositif", "numeric", "position", "question") SELECT "idQCM", "idQuestion", "idType", "isMultiple", "nbPtsNegatif", "nbPtsPositif", "numeric", "position", "question" FROM "Question"; -DROP TABLE "Question"; -ALTER TABLE "new_Question" RENAME TO "Question"; -PRAGMA foreign_key_check("Question"); -PRAGMA foreign_keys=ON; diff --git a/microservices/auth/prisma/migrations/20240615235741_addorder/migration.sql b/microservices/auth/prisma/migrations/20240615235741_addorder/migration.sql deleted file mode 100644 index af5102c8ba20cc6051c01d3ca06b2e7f8d7e14d9..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240615235741_addorder/migration.sql +++ /dev/null @@ -1 +0,0 @@ --- This is an empty migration. \ No newline at end of file diff --git a/microservices/auth/prisma/migrations/20240616122454_/migration.sql b/microservices/auth/prisma/migrations/20240616122454_/migration.sql deleted file mode 100644 index e0ece44a633f8583f16222900e00656f9dbe4dcc..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240616122454_/migration.sql +++ /dev/null @@ -1,27 +0,0 @@ -/* - Warnings: - - - You are about to alter the column `numeric` on the `Question` table. The data in that column could be lost. The data in that column will be cast from `Int` to `Float`. - -*/ --- RedefineTables -PRAGMA defer_foreign_keys=ON; -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Question" ( - "idQuestion" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "question" TEXT NOT NULL, - "position" INTEGER NOT NULL, - "nbPtsPositif" INTEGER NOT NULL, - "nbPtsNegatif" INTEGER NOT NULL, - "numeric" REAL, - "idQCM" INTEGER NOT NULL, - "idType" INTEGER NOT NULL, - "isMultiple" BOOLEAN NOT NULL, - CONSTRAINT "Question_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "QcmTable" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Question_idType_fkey" FOREIGN KEY ("idType") REFERENCES "Type" ("idType") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Question" ("idQCM", "idQuestion", "idType", "isMultiple", "nbPtsNegatif", "nbPtsPositif", "numeric", "position", "question") SELECT "idQCM", "idQuestion", "idType", "isMultiple", "nbPtsNegatif", "nbPtsPositif", "numeric", "position", "question" FROM "Question"; -DROP TABLE "Question"; -ALTER TABLE "new_Question" RENAME TO "Question"; -PRAGMA foreign_keys=ON; -PRAGMA defer_foreign_keys=OFF; diff --git a/microservices/auth/prisma/migrations/20240616122525_change_type_numeric_question/migration.sql b/microservices/auth/prisma/migrations/20240616122525_change_type_numeric_question/migration.sql deleted file mode 100644 index af5102c8ba20cc6051c01d3ca06b2e7f8d7e14d9..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240616122525_change_type_numeric_question/migration.sql +++ /dev/null @@ -1 +0,0 @@ --- This is an empty migration. \ No newline at end of file diff --git a/microservices/auth/prisma/migrations/20240616125927_new_mig/migration.sql b/microservices/auth/prisma/migrations/20240616125927_new_mig/migration.sql deleted file mode 100644 index d0391af090793df9c3cef54babd70e35e0c9ce6c..0000000000000000000000000000000000000000 --- a/microservices/auth/prisma/migrations/20240616125927_new_mig/migration.sql +++ /dev/null @@ -1,27 +0,0 @@ -/* - Warnings: - - - Added the required column `randomOrder` to the `Question` table without a default value. This is not possible if the table is not empty. - -*/ --- RedefineTables -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Question" ( - "idQuestion" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - "question" TEXT NOT NULL, - "position" INTEGER NOT NULL, - "randomOrder" BOOLEAN NOT NULL, - "nbPtsPositif" INTEGER NOT NULL, - "nbPtsNegatif" INTEGER NOT NULL, - "numeric" REAL, - "idQCM" INTEGER NOT NULL, - "idType" INTEGER NOT NULL, - "isMultiple" BOOLEAN NOT NULL, - CONSTRAINT "Question_idQCM_fkey" FOREIGN KEY ("idQCM") REFERENCES "QcmTable" ("idQCM") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "Question_idType_fkey" FOREIGN KEY ("idType") REFERENCES "Type" ("idType") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Question" ("idQCM", "idQuestion", "idType", "isMultiple", "nbPtsNegatif", "nbPtsPositif", "numeric", "position", "question") SELECT "idQCM", "idQuestion", "idType", "isMultiple", "nbPtsNegatif", "nbPtsPositif", "numeric", "position", "question" FROM "Question"; -DROP TABLE "Question"; -ALTER TABLE "new_Question" RENAME TO "Question"; -PRAGMA foreign_key_check("Question"); -PRAGMA foreign_keys=ON; diff --git a/microservices/helloworld/prisma/migrations/20250316233505_init/migration.sql b/microservices/auth/prisma/migrations/20250316233505_init/migration.sql similarity index 100% rename from microservices/helloworld/prisma/migrations/20250316233505_init/migration.sql rename to microservices/auth/prisma/migrations/20250316233505_init/migration.sql diff --git a/microservices/auth/prisma/migrations/migration_lock.toml b/microservices/auth/prisma/migrations/migration_lock.toml index e5e5c4705ab084270b7de6f45d5291ba01666948..648c57fd59d83581e928372c012c2073cc0a1158 100644 --- a/microservices/auth/prisma/migrations/migration_lock.toml +++ b/microservices/auth/prisma/migrations/migration_lock.toml @@ -1,3 +1,3 @@ # Please do not edit this file manually -# It should be added in your version-control system (i.e. Git) -provider = "sqlite" \ No newline at end of file +# It should be added in your version-control system (e.g., Git) +provider = "postgresql" \ No newline at end of file diff --git a/microservices/auth/prisma/schema.prisma b/microservices/auth/prisma/schema.prisma index 61e3d4e68ce364138ff820f8a3b0080aace2ca24..981df4b3dad6eb703bf195e690ecb52f9ffe056b 100644 --- a/microservices/auth/prisma/schema.prisma +++ b/microservices/auth/prisma/schema.prisma @@ -7,6 +7,7 @@ datasource db { url = env("DATABASE_URL") } + // This model is not complete. It's a base for you to start working with Prisma. model User { id Int @id /// The user's id is the same as their gitlab id @@ -34,7 +35,7 @@ model QcmTable { model Type { idType Int @id @default(autoincrement()) - nomType String + nomType String @unique questions Question[] } diff --git a/microservices/auth/prisma/seed.ts b/microservices/auth/prisma/seed.ts index 7d08e7c3f6cb9eec34f9e9fdc890aec227f46d8d..37b26eda2c4857396998ea05d6d7f95a7eea9011 100644 --- a/microservices/auth/prisma/seed.ts +++ b/microservices/auth/prisma/seed.ts @@ -1,11 +1,11 @@ import process from 'process'; -import logger from '../src/logging/WinstonLogger.js'; -import db from '../src/helpers/DatabaseHelper.js'; -import Config from '../src/config/Config.js'; - +import logger from '../src/logging/WinstonLogger.js'; +import db from '../src/helpers/DatabaseHelper.js'; +import Config from '../src/config/Config.js'; async function main() { await users(); + await types(); } main().then(async () => { @@ -20,47 +20,57 @@ main().then(async () => { async function users() { await db.user.upsert({ - where : { id: 142 }, - update: { - name: 'Michaël Minelli' - }, - create: { - id : 142, - name : 'Michaël Minelli', - gitlabUsername: 'michael.minelli', - deleted : false - } - }); + where: { id: 142 }, + update: { + name: 'Michaël Minelli' + }, + create: { + id: 142, + name: 'Michaël Minelli', + gitlabUsername: 'michael.minelli', + deleted: false + } + }); - if ( !Config.production ) { + if (!Config.production) { await db.user.upsert({ - where : { id: 525 }, - update: { - deleted: false - }, - create: { - id : 525, - gitlabUsername: 'stephane.malandai', - deleted : false - } - }); + where: { id: 525 }, + update: { + deleted: false + }, + create: { + id: 525, + gitlabUsername: 'stephane.malandai', + deleted: false + } + }); } - await db.type.create({ - data: { - idType : 1, - nomType : 'text', +} + +async function types() { + await db.type.upsert({ + where: { nomType: 'text' }, + update: {}, + create: { + nomType: 'text' } }); - await db.type.create({ - data: { - idType : 2, - nomType : 'numerique', + + await db.type.upsert({ + where: { nomType: 'numerique' }, + update: {}, + create: { + nomType: 'numerique' } }); - await db.type.create({ - data: { - idType : 3, - nomType : 'vraiFaux', + + await db.type.upsert({ + where: { nomType: 'vraiFaux' }, + update: {}, + create: { + nomType: 'vraiFaux' } }); -} \ No newline at end of file + + console.log("✅ Types de base insérés ou déjà présents."); +} diff --git a/microservices/docker-compose.yml b/microservices/docker-compose.yml index d4cf58cde7108b11604482788e9e38c2bb9001c1..364c81fb2f01cd605b4d3a909b6abf877e4405bf 100644 --- a/microservices/docker-compose.yml +++ b/microservices/docker-compose.yml @@ -18,7 +18,6 @@ services: - ./nginx.conf:/etc/nginx/nginx.conf:ro - ./cors.conf:/etc/nginx/cors.conf:ro depends_on: - - service-helloworld - service-auth - service-correction-qcm - service-realise-qcm @@ -40,23 +39,16 @@ services: networks: - backend_network - service-helloworld: - image: service-helloworld - build: ./helloworld - ports: - - "8002:30992" # Expose pour les tests locaux si nécessaire - networks: - - backend_network - service-auth: image: service-auth build: ./auth ports: - - "8001:30992" - environment: - - API_PORT=30992 # S'assurer que le service écoute sur le bon port + - "8002:30992" # Expose pour les tests locaux si nécessaire networks: - backend_network + depends_on: + - service-database + service-correction-qcm: image: service-correction-qcm diff --git a/microservices/frontend/src/app/affichage-examen/question/question.component.html b/microservices/frontend/src/app/affichage-examen/question/question.component.html index fb398d5cd2f226260ad6036bea26fd26945752e1..bbea2d35fbf59c6f9a911443c50f03fa55cafba8 100644 --- a/microservices/frontend/src/app/affichage-examen/question/question.component.html +++ b/microservices/frontend/src/app/affichage-examen/question/question.component.html @@ -13,9 +13,9 @@ <ng-template #singleChoice> <div *ngFor="let choix of question.choix"> <div class="form-check"> - <input id="formCheck-3" [value]="choix.id" class="form-check-input" name="choices" type="radio" + <input [id]="choix.id" [value]="choix.id" class="form-check-input" name="choices" type="radio" (change)="onRadioChange($event)" [checked]="contain(choix.id)" /> - <label for="choix">{{choix.text}}</label> + <label [for]="choix.id">{{choix.text}}</label> </div> </div> </ng-template> diff --git a/microservices/helloworld/dockerfile b/microservices/helloworld/dockerfile deleted file mode 100644 index 5ecf6a1dd5313d3ea89f871f700813ae6356ac21..0000000000000000000000000000000000000000 --- a/microservices/helloworld/dockerfile +++ /dev/null @@ -1,39 +0,0 @@ -# Étape 1 : Construction de l'application -FROM node:18 AS builder - -# Définir le répertoire de travail -WORKDIR /app - -# Copier les fichiers package -COPY package.json package-lock.json ./ - -# Installer les dépendances -RUN npm install - -# Copier les fichiers sources -COPY . . - -# Compiler le projet TypeScript -RUN npm run build - -# Étape 2 : Image de production -FROM node:18 - -# Définir le répertoire de travail -WORKDIR /app - -# Copier les fichiers nécessaires depuis le builder -COPY --from=builder /app/dist ./dist -COPY --from=builder /app/node_modules ./node_modules -COPY --from=builder /app/prisma ./prisma -COPY package.json ./ -COPY .env .env -COPY entrypoint.sh ./entrypoint.sh - -# Donner les permissions nécessaires -RUN chmod +x entrypoint.sh - -EXPOSE 30992 - -# Utilisation du script d'entrée -ENTRYPOINT ["sh", "./entrypoint.sh"] diff --git a/microservices/helloworld/prisma/migrations/migration_lock.toml b/microservices/helloworld/prisma/migrations/migration_lock.toml deleted file mode 100644 index 648c57fd59d83581e928372c012c2073cc0a1158..0000000000000000000000000000000000000000 --- a/microservices/helloworld/prisma/migrations/migration_lock.toml +++ /dev/null @@ -1,3 +0,0 @@ -# Please do not edit this file manually -# It should be added in your version-control system (e.g., Git) -provider = "postgresql" \ No newline at end of file diff --git a/microservices/helloworld/prisma/schema.prisma b/microservices/helloworld/prisma/schema.prisma deleted file mode 100644 index 981df4b3dad6eb703bf195e690ecb52f9ffe056b..0000000000000000000000000000000000000000 --- a/microservices/helloworld/prisma/schema.prisma +++ /dev/null @@ -1,95 +0,0 @@ -generator client { - provider = "prisma-client-js" -} - -datasource db { - provider = "postgresql" - url = env("DATABASE_URL") -} - - -// This model is not complete. It's a base for you to start working with Prisma. -model User { - id Int @id /// The user's id is the same as their gitlab id - name String? - mail String? @unique - gitlabUsername String @unique - deleted Boolean @default(false) - reponses Reponse[] - participer Participer[] - qcmCree QcmTable[] -} - -model QcmTable { - idQCM Int @id @default(autoincrement()) - nomQCM String - temps Int - randomOrder Boolean - questions Question[] - codeAcces Int - participer Participer[] - idUserCreator Int - creator User @relation(fields: [idUserCreator], references: [id]) - -} - -model Type { - idType Int @id @default(autoincrement()) - nomType String @unique - questions Question[] -} - -model Choix { - idChoix Int @id @default(autoincrement()) - isCorrect Boolean - idQuestion Int - question Question @relation(fields: [idQuestion], references: [idQuestion], onDelete: Cascade, onUpdate: Cascade) - reponses Reponse[] - nomChoix String - position Int -} - -model Question { - idQuestion Int @id @default(autoincrement()) - question String - position Int - randomOrder Boolean - nbPtsPositif Int - nbPtsNegatif Int - numeric Float? - idQCM Int - qcm QcmTable @relation(fields: [idQCM], references: [idQCM]) - idType Int - type Type @relation(fields: [idType], references: [idType]) - choix Choix[] - reponses Reponse[] - isMultiple Boolean -} - -model Reponse { - idReponse Int @id @default(autoincrement()) - idQuestion Int - question Question @relation(fields: [idQuestion], references: [idQuestion]) - idChoix Int? - choix Choix? @relation(fields: [idChoix], references: [idChoix], onDelete: Cascade, onUpdate: Cascade) - idUser Int - user User @relation(fields: [idUser], references: [id]) - numeric Float? - - @@unique([idQuestion, idUser, idChoix]) -} - -model Participer { - idUser Int - idQCM Int - user User @relation(fields: [idUser], references: [id]) - qcm QcmTable @relation(fields: [idQCM], references: [idQCM]) - feedback String - note Float - score Int - heureDebut Int - hasFinished Boolean @default(false) - - @@id([idUser, idQCM]) -} - diff --git a/microservices/helloworld/prisma/seed.ts b/microservices/helloworld/prisma/seed.ts deleted file mode 100644 index 37b26eda2c4857396998ea05d6d7f95a7eea9011..0000000000000000000000000000000000000000 --- a/microservices/helloworld/prisma/seed.ts +++ /dev/null @@ -1,76 +0,0 @@ -import process from 'process'; -import logger from '../src/logging/WinstonLogger.js'; -import db from '../src/helpers/DatabaseHelper.js'; -import Config from '../src/config/Config.js'; - -async function main() { - await users(); - await types(); -} - -main().then(async () => { - await db.$disconnect(); -}).catch(async e => { - logger.error(JSON.stringify(e)); - await db.$disconnect(); - process.exit(1); -}); - -//---------------------------------------------------------------------------------------------------------------------------------------------------------- - -async function users() { - await db.user.upsert({ - where: { id: 142 }, - update: { - name: 'Michaël Minelli' - }, - create: { - id: 142, - name: 'Michaël Minelli', - gitlabUsername: 'michael.minelli', - deleted: false - } - }); - - if (!Config.production) { - await db.user.upsert({ - where: { id: 525 }, - update: { - deleted: false - }, - create: { - id: 525, - gitlabUsername: 'stephane.malandai', - deleted: false - } - }); - } -} - -async function types() { - await db.type.upsert({ - where: { nomType: 'text' }, - update: {}, - create: { - nomType: 'text' - } - }); - - await db.type.upsert({ - where: { nomType: 'numerique' }, - update: {}, - create: { - nomType: 'numerique' - } - }); - - await db.type.upsert({ - where: { nomType: 'vraiFaux' }, - update: {}, - create: { - nomType: 'vraiFaux' - } - }); - - console.log("✅ Types de base insérés ou déjà présents."); -} diff --git a/microservices/minikube/k8s-auth.yaml b/microservices/minikube/k8s-auth.yaml new file mode 100644 index 0000000000000000000000000000000000000000..14eaec5208dca4028da470dff0bd145e21dd5bba --- /dev/null +++ b/microservices/minikube/k8s-auth.yaml @@ -0,0 +1,31 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: auth +spec: + replicas: 1 + selector: + matchLabels: + app: auth + template: + metadata: + labels: + app: auth + spec: + containers: + - name: auth + image: service-auth + ports: + - containerPort: 8002 +--- +apiVersion: v1 +kind: Service +metadata: + name: auth +spec: + selector: + app: auth + ports: + - port: 8002 + targetPort: 8002 + type: ClusterIP \ No newline at end of file diff --git a/microservices/minikube/k8s-postgres.yaml b/microservices/minikube/k8s-postgres.yaml new file mode 100644 index 0000000000000000000000000000000000000000..172b726a7e424adac1e656f80e268f1c1a4f9794 --- /dev/null +++ b/microservices/minikube/k8s-postgres.yaml @@ -0,0 +1,55 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: postgres-pvc +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +apiVersion: v1 +kind: Service +metadata: + name: postgres +spec: + selector: + app: postgres + ports: + - port: 5432 + targetPort: 5432 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: postgres +spec: + replicas: 1 + selector: + matchLabels: + app: postgres + template: + metadata: + labels: + app: postgres + spec: + containers: + - name: postgres + image: postgres:latest + ports: + - containerPort: 5432 + env: + - name: POSTGRES_USER + value: "user" + - name: POSTGRES_PASSWORD + value: "super" + - name: POSTGRES_DB + value: "dbqcm" + volumeMounts: + - mountPath: /var/lib/postgresql/data + name: postgres-storage + volumes: + - name: postgres-storage + persistentVolumeClaim: + claimName: postgres-pvc \ No newline at end of file diff --git a/microservices/nginx.conf b/microservices/nginx.conf index 128a4639e458b11ad01d37d60e79c930ff70a277..4689b482a2448552b60650a0bcf67ed9940887fc 100644 --- a/microservices/nginx.conf +++ b/microservices/nginx.conf @@ -17,10 +17,7 @@ http { } - location /helloworld { - proxy_pass http://service-helloworld:30992; - include cors.conf; - } + location /reponseCorrect/ { proxy_pass http://service-correction-qcm:30992;