-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor code structure & add ÉTS API integration for courses and pro…
…grams (#29) * Add common folder * Add program resource * Fix eslint rule (complexity) & fix dependencies versions * add course, cours-instance * add session resource * Add prisma, scraper, program files (modules and services) * Fix prisma & add scraper files & eslint migration * chore: address sonarlint warning (if statement) * Rollback eslint flat to v8 & remove entity & format imports * add public to classes * cleanup * add ets api hekper files * add ets-program logic & (WIP) upsert programs * Remove unnecessary dtos * (wip 🚔) Add controllers & fix course routes * fix tests * Fix ProgramType relation * Add coursePrerequisite controller & service * Move scraper folder into /common * Move pdf folder into /common * fix http & add prisma to app module * fix tests (wip) & sessions route * fix tests * rename * Add schema image generator * add methods * fix * change "program to programType" relation * fix ci test * miaow miaow * test test * only run eslint on src folder * Rollback to ".test.ts" only * pdf small test * fix logging * fix PR & remove scraper folder * update enum trimester * remove file * fix param
- Loading branch information
Showing
72 changed files
with
2,825 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
DATABASE_URL="postgresql://postgres:randompassword@localhost:5432/mydb?schema=public" | ||
NODE_ENV=development | ||
|
||
## if no password, use this instead: | ||
# DATABASE_URL="postgresql://postgres@localhost:5432/mydb?schema=public" | ||
PORT=3000 | ||
|
||
DATABASE_URL="postgresql://postgres@localhost:5432/planifetsDB?schema=public" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,45 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin', 'import', 'simple-import-sort'], | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
'airbnb-typescript/base', | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
ignorePatterns: ['.eslintrc.js', 'dist/'], | ||
rules: { | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/lines-between-class-members': 'off', | ||
complexity: ['warn', { max: 10 }], | ||
complexity: ['error', { max: 15 }], | ||
'@typescript-eslint/explicit-member-accessibility': [ | ||
'error', | ||
{ | ||
overrides: { | ||
constructors: 'no-public', | ||
}, | ||
}, | ||
], | ||
'simple-import-sort/imports': 'error', | ||
'simple-import-sort/exports': 'error', | ||
'prettier/prettier': [ | ||
'error', | ||
{ | ||
endOfLine: 'lf', | ||
}, | ||
], | ||
indent: 'off', | ||
'@typescript-eslint/indent': 'off', | ||
}, | ||
}; | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin', 'import', 'simple-import-sort'], | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
'airbnb-typescript/base', | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
ignorePatterns: ['.eslintrc.js', 'dist/'], | ||
rules: { | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/lines-between-class-members': 'off', | ||
complexity: ['warn', { max: 10 }], | ||
complexity: ['error', { max: 15 }], | ||
'@typescript-eslint/explicit-member-accessibility': [ | ||
'error', | ||
{ | ||
overrides: { | ||
constructors: 'no-public', | ||
}, | ||
}, | ||
], | ||
'simple-import-sort/imports': 'error', | ||
'simple-import-sort/exports': 'error', | ||
'prettier/prettier': [ | ||
'error', | ||
{ | ||
endOfLine: 'lf', | ||
}, | ||
], | ||
'@typescript-eslint/brace-style': 'off', | ||
indent: 'off', | ||
'@typescript-eslint/indent': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{ | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
} | ||
{ | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"endOfLine": "lf" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode", | ||
"rvest.vs-code-prettier-eslint" | ||
] | ||
} | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode", | ||
"abians.prisma-generate-uml" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
prisma/migrations/20240622070105_add_program_type_table_values/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `abbreviation` on the `Program` table. All the data in the column will be lost. | ||
- You are about to drop the column `type` on the `Program` table. All the data in the column will be lost. | ||
- A unique constraint covering the columns `[code,title]` on the table `Program` will be added. If there are existing duplicate values, this will fail. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "Program" DROP COLUMN "abbreviation", | ||
DROP COLUMN "type", | ||
ADD COLUMN "types" INTEGER[]; | ||
|
||
-- CreateTable | ||
CREATE TABLE "ProgramType" ( | ||
"id" INTEGER NOT NULL, | ||
"title" TEXT NOT NULL, | ||
|
||
CONSTRAINT "ProgramType_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Program_code_title_key" ON "Program"("code", "title"); |
34 changes: 34 additions & 0 deletions
34
...igrations/20240724005644_add_program_type_relation_and_update_session_table/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `unstructuredPrerequisites` on the `Course` table. All the data in the column will be lost. | ||
- You are about to drop the column `types` on the `Program` table. All the data in the column will be lost. | ||
- You are about to drop the column `name` on the `Session` table. All the data in the column will be lost. | ||
- Added the required column `programTypeId` to the `Program` table without a default value. This is not possible if the table is not empty. | ||
- Added the required column `trimester` to the `Session` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- CreateEnum | ||
CREATE TYPE "Trimester" AS ENUM ('A', 'E', 'H'); | ||
|
||
-- AlterTable | ||
ALTER TABLE "Course" DROP COLUMN "unstructuredPrerequisites"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Program" DROP COLUMN "types", | ||
ADD COLUMN "programTypeId" INTEGER NOT NULL; | ||
|
||
-- AlterTable | ||
CREATE SEQUENCE programtype_id_seq; | ||
ALTER TABLE "ProgramType" ALTER COLUMN "id" SET DEFAULT nextval('programtype_id_seq'); | ||
ALTER SEQUENCE programtype_id_seq OWNED BY "ProgramType"."id"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Session" DROP COLUMN "name", | ||
ADD COLUMN "trimester" "Trimester" NOT NULL; | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Program_programTypeId_idx" ON "Program"("programTypeId"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Program" ADD CONSTRAINT "Program_programTypeId_fkey" FOREIGN KEY ("programTypeId") REFERENCES "ProgramType"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
15 changes: 15 additions & 0 deletions
15
prisma/migrations/20240724060002_update_many_to_many_program_type_to_program/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `programTypeId` on the `Program` table. All the data in the column will be lost. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "Program" DROP CONSTRAINT "Program_programTypeId_fkey"; | ||
|
||
-- DropIndex | ||
DROP INDEX "Program_programTypeId_idx"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Program" DROP COLUMN "programTypeId", | ||
ADD COLUMN "programTypeIds" TEXT NOT NULL DEFAULT '[]'; |
16 changes: 16 additions & 0 deletions
16
...ions/20240724061353_update_program_table_add_cycle_update_program_type_type/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
Warnings: | ||
- Added the required column `cycle` to the `Program` table without a default value. This is not possible if the table is not empty. | ||
- Changed the type of `programTypeIds` on the `Program` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "Program" ADD COLUMN "cycle" INTEGER NOT NULL, | ||
ALTER COLUMN "credits" SET DATA TYPE TEXT, | ||
DROP COLUMN "programTypeIds", | ||
ADD COLUMN "programTypeIds" JSONB NOT NULL; | ||
|
||
-- AlterTable | ||
ALTER TABLE "ProgramType" ALTER COLUMN "id" DROP DEFAULT; | ||
DROP SEQUENCE "programtype_id_seq"; |
14 changes: 14 additions & 0 deletions
14
prisma/migrations/20240803014322_update_trimester_enum/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
Warnings: | ||
- The values [A,E,H] on the enum `Trimester` will be removed. If these variants are still used in the database, this will fail. | ||
*/ | ||
-- AlterEnum | ||
BEGIN; | ||
CREATE TYPE "Trimester_new" AS ENUM ('AUTOMNE', 'ETE', 'HIVER'); | ||
ALTER TABLE "Session" ALTER COLUMN "trimester" TYPE "Trimester_new" USING ("trimester"::text::"Trimester_new"); | ||
ALTER TYPE "Trimester" RENAME TO "Trimester_old"; | ||
ALTER TYPE "Trimester_new" RENAME TO "Trimester"; | ||
DROP TYPE "Trimester_old"; | ||
COMMIT; |
Oops, something went wrong.