Merge pull request #188 from SELab-2/refactor/qol

refactor: Quality of Life changes
This commit is contained in:
Tibo De Peuter 2025-04-13 08:39:13 +02:00 committed by GitHub
commit 1ccbfd6c38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 68 additions and 2003 deletions

21
backend/.env-old Normal file
View file

@ -0,0 +1,21 @@
PORT=3000
DWENGO_DB_HOST=db
DWENGO_DB_PORT=5432
DWENGO_DB_USERNAME=postgres
DWENGO_DB_PASSWORD=postgres
DWENGO_DB_UPDATE=false
DWENGO_AUTH_STUDENT_URL=http://localhost/idp/realms/student
DWENGO_AUTH_STUDENT_CLIENT_ID=dwengo
DWENGO_AUTH_STUDENT_JWKS_ENDPOINT=http://idp:7080/idp/realms/student/protocol/openid-connect/certs
DWENGO_AUTH_TEACHER_URL=http://localhost/idp/realms/teacher
DWENGO_AUTH_TEACHER_CLIENT_ID=dwengo
DWENGO_AUTH_TEACHER_JWKS_ENDPOINT=http://idp:7080/idp/realms/teacher/protocol/openid-connect/certs
# Allow Vite dev-server to access the backend (for testing purposes). Don't forget to remove this in production!
#DWENGO_CORS_ALLOWED_ORIGINS=http://localhost/,127.0.0.1:80,http://127.0.0.1,http://localhost:80,http://127.0.0.1:80,localhost
DWENGO_CORS_ALLOWED_ORIGINS=http://localhost/*,http://idp:7080,https://idp:7080
# Logging and monitoring
LOKI_HOST=http://logging:3102

View file

@ -6,8 +6,9 @@ WORKDIR /app/dwengo
COPY package*.json ./
COPY backend/package.json ./backend/
# Backend depends on common
# Backend depends on common and docs
COPY common/package.json ./common/
COPY docs/package.json ./docs/
RUN npm install --silent
@ -34,6 +35,7 @@ COPY ./backend/i18n ./i18n
COPY --from=build-stage /app/dwengo/common/dist ./common/dist
COPY --from=build-stage /app/dwengo/backend/dist ./backend/dist
COPY --from=build-stage /app/dwengo/docs/api/swagger.json ./docs/api/swagger.json
COPY package*.json ./
COPY backend/package.json ./backend/
@ -42,7 +44,6 @@ COPY common/package.json ./common/
RUN npm install --silent --only=production
COPY ./docs ./docs
COPY ./backend/i18n ./backend/i18n
EXPOSE 3000

1
docs/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
api/swagger.json

View file

@ -15,6 +15,10 @@ const doc = {
url: 'http://localhost:3000/',
description: 'Development server',
},
{
url: 'http://localhost/',
description: 'Staging server',
},
{
url: 'https://sel2-1.ugent.be/',
description: 'Production server',
@ -55,4 +59,4 @@ const doc = {
const outputFile = './swagger.json';
const routes = ['../../backend/src/app.ts'];
await swaggerAutogen({ openapi: '3.1.0' })(outputFile, routes, doc);
void swaggerAutogen({ openapi: '3.1.0' })(outputFile, routes, doc);

File diff suppressed because it is too large Load diff

View file

@ -44,16 +44,16 @@ export default [
// All @typescript-eslint configuration options are listed.
// If the rules are commented, they are configured by the inherited configurations.
'@typescript-eslint/adjacent-overload-signatures': 'warn',
'@typescript-eslint/array-type': 'warn',
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-comment': ['error', { minimumDescriptionLength: 10 }],
'@typescript-eslint/ban-tslint-comment': 'error',
camelcase: 'off',
'@typescript-eslint/class-literal-property-style': 'warn',
'@typescript-eslint/class-literal-property-style': 'error',
'class-methods-use-this': 'off',
'@typescript-eslint/class-methods-use-this': ['error', { ignoreOverrideMethods: true }],
'@typescript-eslint/consistent-generic-constructors': 'warn',
'@typescript-eslint/consistent-generic-constructors': 'error',
'@typescript-eslint/consistent-indexed-object-style': 'error',
'consistent-return': 'off',
'@typescript-eslint/consistent-return': 'off',
@ -64,18 +64,18 @@ export default [
'default-param-last': 'off',
'@typescript-eslint/default-param-last': 'error',
'dot-notation': 'off',
'@typescript-eslint/dot-notation': 'warn',
'@typescript-eslint/explicit-function-return-type': 'warn',
'@typescript-eslint/dot-notation': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'warn',
'@typescript-eslint/explicit-module-boundary-types': 'error',
'init-declarations': 'off',
'@typescript-eslint/init-declarations': 'off',
'max-params': 'off',
'@typescript-eslint/max-params': ['error', { max: 6 }],
'@typescript-eslint/member-ordering': 'warn',
'@typescript-eslint/member-ordering': 'error',
'@typescript-eslint/method-signature-style': 'off', // Don't care about TypeScript strict mode.
'@typescript-eslint/naming-convention': [
'warn',
'error',
{
// Enforce that all variables, functions and properties are camelCase
selector: 'variableLike',
@ -113,7 +113,7 @@ export default [
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-empty-object-type': 'error',
'@typescript-eslint/no-explicit-any': 'warn', // Once in production, this should be an error.
'@typescript-eslint/no-explicit-any': 'error', // Once in production, this should be an error.
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/no-floating-promises': 'error',
@ -121,7 +121,7 @@ export default [
'no-implied-eval': 'off',
'@typescript-eslint/no-implied-eval': 'error',
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/no-inferrable-types': 'warn',
'@typescript-eslint/no-inferrable-types': 'error',
'no-invalid-this': 'off',
'@typescript-eslint/no-invalid-this': 'off',
'@typescript-eslint/no-invalid-void-type': 'error',
@ -146,10 +146,10 @@ export default [
'@typescript-eslint/no-unsafe-function-type': 'error',
'no-unused-expressions': 'off',
'@typescript-eslint/no-unused-expressions': 'warn',
'@typescript-eslint/no-unused-expressions': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
'error',
{
args: 'all',
argsIgnorePattern: '^_',
@ -164,53 +164,53 @@ export default [
'@typescript-eslint/parameter-properties': 'off',
'@typescript-eslint/prefer-find': 'warn',
'@typescript-eslint/prefer-find': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
'@typescript-eslint/promise-function-async': 'warn',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/require-array-sort-compare': 'warn',
'@typescript-eslint/require-array-sort-compare': 'error',
'no-await-in-loop': 'warn',
'no-await-in-loop': 'error',
'no-constructor-return': 'error',
'no-inner-declarations': 'error',
'no-self-compare': 'error',
'no-template-curly-in-string': 'error',
'no-unmodified-loop-condition': 'warn',
'no-unreachable-loop': 'warn',
'no-unmodified-loop-condition': 'error',
'no-unreachable-loop': 'error',
'no-useless-assignment': 'error',
'arrow-body-style': ['warn', 'as-needed'],
'block-scoped-var': 'warn',
'capitalized-comments': 'warn',
'arrow-body-style': ['error', 'as-needed'],
'block-scoped-var': 'error',
'capitalized-comments': 'error',
'consistent-this': 'error',
curly: 'error',
'default-case': 'error',
'default-case-last': 'error',
eqeqeq: 'error',
'func-names': 'warn',
'func-style': ['warn', 'declaration'],
'grouped-accessor-pairs': ['warn', 'getBeforeSet'],
'guard-for-in': 'warn',
'logical-assignment-operators': 'warn',
'max-classes-per-file': 'warn',
'func-names': 'error',
'func-style': ['error', 'declaration'],
'grouped-accessor-pairs': ['error', 'getBeforeSet'],
'guard-for-in': 'error',
'logical-assignment-operators': 'error',
'max-classes-per-file': 'error',
'no-alert': 'error',
'no-bitwise': 'warn',
'no-console': 'warn',
'no-continue': 'warn',
'no-else-return': 'warn',
'no-bitwise': 'error',
'no-console': 'error',
'no-continue': 'error',
'no-else-return': 'error',
'no-eq-null': 'error',
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-label': 'error',
'no-implicit-coercion': 'warn',
'no-implicit-coercion': 'error',
'no-iterator': 'error',
'no-label-var': 'warn',
'no-labels': 'warn',
'no-label-var': 'error',
'no-labels': 'error',
'no-multi-assign': 'error',
'no-nested-ternary': 'error',
'no-object-constructor': 'error',

View file

@ -20,6 +20,7 @@
"@tanstack/vue-query": "^5.69.0",
"axios": "^1.8.2",
"oidc-client-ts": "^3.1.0",
"uuid": "^11.1.0",
"vue": "^3.5.13",
"vue-i18n": "^11.1.2",
"vue-router": "^4.5.0",

1
package-lock.json generated
View file

@ -273,6 +273,7 @@
"@tanstack/vue-query": "^5.69.0",
"axios": "^1.8.2",
"oidc-client-ts": "^3.1.0",
"uuid": "^11.1.0",
"vue": "^3.5.13",
"vue-i18n": "^11.1.2",
"vue-router": "^4.5.0",

View file

@ -5,7 +5,7 @@
"private": true,
"type": "module",
"scripts": {
"prebuild": "npm run clean",
"prebuild": "npm run clean && npm run swagger --workspace=docs",
"build": "tsc --build tsconfig.build.json",
"clean": "tsc --build tsconfig.build.json --clean",
"watch": "tsc --build tsconfig.build.json --watch",