diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index 319080be10..f453964e87 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -32,6 +32,8 @@ services: build: context: services dockerfile: frontend/Dockerfile + args: + - --progress=plain kone-db: <<: *defaults diff --git a/docker-compose.yml b/docker-compose.yml index 8c807158fb..26d7400305 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -46,7 +46,7 @@ services: volumes: - backend-nodemod:/opt/app-root/src/node_modules - ./services/backend/:/opt/app-root/src - - ./services/shared/:/opt/app-root/src/src/shared + - ./services/shared/:/opt/app-root/shared frontend: <<: *defaults @@ -61,7 +61,7 @@ services: volumes: - frontend-nodemod:/opt/app-root/src/node_modules - ./services/frontend/:/opt/app-root/src - - ./services/shared/:/opt/app-root/src/src/shared + - ./services/shared/:/opt/app-root/shared kone-db: <<: *defaults diff --git a/eslint.config.mjs b/eslint.config.mjs index 551453dc42..59fe808ed4 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -132,12 +132,6 @@ export default [ 'no-console': 'off', }, }, - { - files: ['services/**/shared/**/*'], - rules: { - 'import/no-unused-modules': 'off', - }, - }, { files: ['cypress/**/*.js', 'services/backend/**/*.js', 'updater/**/*.js'], languageOptions: { @@ -164,7 +158,7 @@ export default [ }, { settings: { - 'import/internal-regex': '^@/shared/', + 'import/internal-regex': '^@shared/', 'import/resolver': { typescript: { project: [ diff --git a/services/backend/Dockerfile b/services/backend/Dockerfile index 873b3ae744..a2ee4b92d1 100644 --- a/services/backend/Dockerfile +++ b/services/backend/Dockerfile @@ -21,11 +21,15 @@ ENV SENTRY_RELEASE=$SENTRY_RELEASE COPY ./backend/package*.json ./ RUN npm ci --include=dev -COPY ./shared ./src/shared +COPY ./shared ../shared COPY ./backend . RUN npm run build +RUN ls -la /opt/app-root/ +RUN ls -la /opt/app-root/src/src/ +RUN ls -la /opt/app-root/src +RUN ls -la /opt/app-root/src/dist FROM registry.access.redhat.com/ubi9/nodejs-22-minimal @@ -56,4 +60,4 @@ COPY --from=build /opt/app-root/src/dist ./dist RUN npm ci -CMD ["node", "dist/index.js"] +CMD ["node", "dist/backend/index.js"] diff --git a/services/backend/package-lock.json b/services/backend/package-lock.json index e2f3b3d8f9..8b27632ab4 100644 --- a/services/backend/package-lock.json +++ b/services/backend/package-lock.json @@ -39,6 +39,7 @@ "@types/morgan": "^1.9.9", "@types/node": "^22.9.0", "@types/validator": "^13.12.2", + "tsc-alias": "^1.8.10", "tsx": "^4.19.2", "typescript": "^5.6.3" } @@ -2161,6 +2162,20 @@ } } }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -2174,6 +2189,16 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/async": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", @@ -2215,6 +2240,19 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/body-parser": { "version": "1.20.3", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", @@ -2302,6 +2340,31 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, "node_modules/cjs-module-lexer": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz", @@ -2375,6 +2438,16 @@ "node": ">= 0.8" } }, + "node_modules/commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || >=14" + } + }, "node_modules/compressible": { "version": "2.0.18", "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", @@ -2551,6 +2624,19 @@ "node": ">=8" } }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/dottie": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/dottie/-/dottie-2.0.6.tgz", @@ -2933,6 +3019,27 @@ "node": ">= 6" } }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -3033,6 +3140,16 @@ "node": ">=0.10.0" } }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/import-in-the-middle": { "version": "1.11.2", "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-1.11.2.tgz", @@ -3141,6 +3258,19 @@ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/is-core-module": { "version": "2.15.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.0.tgz", @@ -3452,6 +3582,20 @@ "@msgpackr-extract/msgpackr-extract-win32-x64": "3.0.2" } }, + "node_modules/mylas": { + "version": "2.1.13", + "resolved": "https://registry.npmjs.org/mylas/-/mylas-2.1.13.tgz", + "integrity": "sha512-+MrqnJRtxdF+xngFfUUkIMQrUUL0KsxbADUkn23Z/4ibGg192Q+z+CQyiYwvWTsYjJygmMR8+w3ZDa98Zh6ESg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/raouldeheer" + } + }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -3488,6 +3632,16 @@ "node-gyp-build-optional-packages-test": "build-test.js" } }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -3577,6 +3731,16 @@ "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==", "license": "MIT" }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/pg": { "version": "8.13.1", "resolved": "https://registry.npmjs.org/pg/-/pg-8.13.1.tgz", @@ -3673,6 +3837,19 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/plimit-lit": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/plimit-lit/-/plimit-lit-1.6.1.tgz", + "integrity": "sha512-B7+VDyb8Tl6oMJT9oSO2CW8XC/T4UcJGrwOVoNGwOQsQYhlpfajmrMj5xeejqaASq3V/EqThyOeATEOMuSEXiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "queue-lit": "^1.5.1" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/pony-cause": { "version": "2.1.11", "resolved": "https://registry.npmjs.org/pony-cause/-/pony-cause-2.1.11.tgz", @@ -3761,6 +3938,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/queue-lit": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/queue-lit/-/queue-lit-1.5.2.tgz", + "integrity": "sha512-tLc36IOPeMAubu8BkW8YDBV+WyIgKlYU7zUNs0J5Vk9skSZ4JfGlPOqplP0aHdfv7HL0B2Pg6nwiq60Qc6M2Hw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -3823,6 +4010,19 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/redis": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/redis/-/redis-4.7.0.tgz", @@ -4276,6 +4476,16 @@ "is-arrayish": "^0.3.1" } }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/split2": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/split2/-/split2-4.1.0.tgz", @@ -4392,6 +4602,24 @@ "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==" }, + "node_modules/tsc-alias": { + "version": "1.8.10", + "resolved": "https://registry.npmjs.org/tsc-alias/-/tsc-alias-1.8.10.tgz", + "integrity": "sha512-Ibv4KAWfFkFdKJxnWfVtdOmB0Zi1RJVxcbPGiCDsFpCQSsmpWyuzHG3rQyI5YkobWwxFPEyQfu1hdo4qLG2zPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.3", + "commander": "^9.0.0", + "globby": "^11.0.4", + "mylas": "^2.1.9", + "normalize-path": "^3.0.0", + "plimit-lit": "^1.2.6" + }, + "bin": { + "tsc-alias": "dist/bin/index.js" + } + }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", diff --git a/services/backend/package.json b/services/backend/package.json index ca18f62cf1..a8fbf5e5ab 100644 --- a/services/backend/package.json +++ b/services/backend/package.json @@ -2,7 +2,7 @@ "name": "backend", "private": true, "scripts": { - "build": "tsc" + "build": "tsc && tsc-alias" }, "dependencies": { "@sentry/node": "^8.37.1", @@ -38,6 +38,7 @@ "@types/morgan": "^1.9.9", "@types/node": "^22.9.0", "@types/validator": "^13.12.2", + "tsc-alias": "^1.8.10", "tsx": "^4.19.2", "typescript": "^5.6.3" }, diff --git a/services/backend/src/middleware/auth.ts b/services/backend/src/middleware/auth.ts index afb5ec64f5..9c1a40f493 100644 --- a/services/backend/src/middleware/auth.ts +++ b/services/backend/src/middleware/auth.ts @@ -1,6 +1,6 @@ import { NextFunction, Request, Response } from 'express' -import { Role } from '../shared/types' +import { Role } from '@shared/types' export const roles = (requiredRoles: Role[], requiredIamGroups?: string[]) => (req: Request, res: Response, next: NextFunction) => { diff --git a/services/backend/src/models/SISStudyRightElement.ts b/services/backend/src/models/SISStudyRightElement.ts index 4af7f9b718..dc24defb04 100644 --- a/services/backend/src/models/SISStudyRightElement.ts +++ b/services/backend/src/models/SISStudyRightElement.ts @@ -11,7 +11,7 @@ import { UpdatedAt, } from 'sequelize-typescript' -import { Name } from '../shared/types' +import { Name } from '@shared/types' import { DegreeProgrammeType, Phase, StudyTrack } from '../types' import { SISStudyRight } from './SISStudyRight' diff --git a/services/backend/src/models/course.ts b/services/backend/src/models/course.ts index 65d0a9d809..3b31447c99 100644 --- a/services/backend/src/models/course.ts +++ b/services/backend/src/models/course.ts @@ -13,7 +13,7 @@ import { UpdatedAt, } from 'sequelize-typescript' -import { Name } from '../shared/types' +import { Name } from '@shared/types' import { CourseProvider } from './courseProvider' import { CourseType } from './courseType' import { Credit } from './credit' diff --git a/services/backend/src/models/courseType.ts b/services/backend/src/models/courseType.ts index ff110f00ab..a50174aa37 100644 --- a/services/backend/src/models/courseType.ts +++ b/services/backend/src/models/courseType.ts @@ -1,7 +1,7 @@ import { InferAttributes } from 'sequelize' import { Column, CreatedAt, DataType, HasMany, Model, PrimaryKey, Table, UpdatedAt } from 'sequelize-typescript' -import { Name } from '../shared/types' +import { Name } from '@shared/types' import { Course } from './course' @Table({ diff --git a/services/backend/src/models/creditType.ts b/services/backend/src/models/creditType.ts index 87e1e5d19f..df58d67532 100644 --- a/services/backend/src/models/creditType.ts +++ b/services/backend/src/models/creditType.ts @@ -1,7 +1,7 @@ import { InferAttributes } from 'sequelize' import { Column, CreatedAt, DataType, Model, PrimaryKey, Table, UpdatedAt } from 'sequelize-typescript' -import { Name } from '../shared/types' +import { Name } from '@shared/types' import { CreditTypeCode } from '../types' @Table({ diff --git a/services/backend/src/models/curriculumPeriod.ts b/services/backend/src/models/curriculumPeriod.ts index f35d653172..b978e1463d 100644 --- a/services/backend/src/models/curriculumPeriod.ts +++ b/services/backend/src/models/curriculumPeriod.ts @@ -1,7 +1,7 @@ import { InferAttributes } from 'sequelize' import { Column, CreatedAt, DataType, Model, Table, UpdatedAt } from 'sequelize-typescript' -import { Name } from '../shared/types' +import { Name } from '@shared/types' @Table({ underscored: true, diff --git a/services/backend/src/models/organization.ts b/services/backend/src/models/organization.ts index ef22226f34..1e559ccbc3 100644 --- a/services/backend/src/models/organization.ts +++ b/services/backend/src/models/organization.ts @@ -11,7 +11,7 @@ import { UpdatedAt, } from 'sequelize-typescript' -import { Name } from '../shared/types' +import { Name } from '@shared/types' import { Course, CourseProvider, ProgrammeModule, SISStudyRight } from '.' @Table({ diff --git a/services/backend/src/models/programmeModule.ts b/services/backend/src/models/programmeModule.ts index a3204561ca..abd6e2c6c0 100644 --- a/services/backend/src/models/programmeModule.ts +++ b/services/backend/src/models/programmeModule.ts @@ -12,7 +12,7 @@ import { UpdatedAt, } from 'sequelize-typescript' -import { Name } from '../shared/types' +import { Name } from '@shared/types' import { DegreeProgrammeType } from '../types' import { Organization } from './organization' import { ProgrammeModuleChild } from './programmeModuleChild' diff --git a/services/backend/src/models/semester.ts b/services/backend/src/models/semester.ts index a357461017..d1fc7b3a91 100644 --- a/services/backend/src/models/semester.ts +++ b/services/backend/src/models/semester.ts @@ -1,7 +1,7 @@ import { InferAttributes } from 'sequelize' import { Column, CreatedAt, DataType, Model, PrimaryKey, Table, UpdatedAt } from 'sequelize-typescript' -import { Name } from '../shared/types' +import { Name } from '@shared/types' @Table({ underscored: true, diff --git a/services/backend/src/models/student.ts b/services/backend/src/models/student.ts index 60e3965222..35fd67287b 100644 --- a/services/backend/src/models/student.ts +++ b/services/backend/src/models/student.ts @@ -1,7 +1,7 @@ import { InferAttributes } from 'sequelize' import { Column, CreatedAt, DataType, HasMany, Model, PrimaryKey, Table, UpdatedAt } from 'sequelize-typescript' -import { Name } from '../shared/types' +import { Name } from '@shared/types' import { GenderCode } from '../types' import { Credit, Enrollment, SISStudyRight, Studyplan } from '.' diff --git a/services/backend/src/models/user.ts b/services/backend/src/models/user.ts index 5042f3833c..3752eb811e 100644 --- a/services/backend/src/models/user.ts +++ b/services/backend/src/models/user.ts @@ -1,8 +1,8 @@ import { CreationOptional, InferAttributes, InferCreationAttributes } from 'sequelize' import { AutoIncrement, Column, DataType, Default, Model, PrimaryKey, Table, Unique } from 'sequelize-typescript' -import { Language } from '../shared/language' -import { Role } from '../shared/types' +import { Language } from '@shared/language' +import { Role } from '@shared/types' @Table({ underscored: true, diff --git a/services/backend/src/routes/changelog.ts b/services/backend/src/routes/changelog.ts index 9c0f2a8952..c2575f87a7 100644 --- a/services/backend/src/routes/changelog.ts +++ b/services/backend/src/routes/changelog.ts @@ -1,8 +1,8 @@ import axios from 'axios' import { Request, Response, Router } from 'express' +import { Release } from '@shared/types' import { isDev } from '../config' -import { Release } from '../shared/types' const router = Router() diff --git a/services/backend/src/routes/faculties.ts b/services/backend/src/routes/faculties.ts index 95f2dfd46c..4328f48b6d 100644 --- a/services/backend/src/routes/faculties.ts +++ b/services/backend/src/routes/faculties.ts @@ -1,5 +1,6 @@ import { Request, Response, Router } from 'express' +import { Graduated, ProgrammeFilter, SpecialGroups, StatsType, YearType } from '@shared/types' import * as auth from '../middleware/auth' import { getDegreeProgrammesOfFaculty, getFacultyCodeById } from '../services/faculty/faculty' import { combineFacultyBasics } from '../services/faculty/facultyBasics' @@ -22,7 +23,6 @@ import { combineFacultyStudentProgress } from '../services/faculty/facultyStuden import { combineFacultyStudents } from '../services/faculty/facultyStudents' import { combineFacultyThesisWriters } from '../services/faculty/facultyThesisWriters' import { updateFacultyOverview, updateFacultyProgressOverview } from '../services/faculty/facultyUpdates' -import { Graduated, ProgrammeFilter, SpecialGroups, StatsType, YearType } from '../shared/types' import logger from '../util/logger' // Faculty uses a lot of tools designed for Study programme. diff --git a/services/backend/src/routes/population.ts b/services/backend/src/routes/population.ts index 39a42320cb..4f0ce451db 100644 --- a/services/backend/src/routes/population.ts +++ b/services/backend/src/routes/population.ts @@ -3,6 +3,7 @@ import crypto from 'crypto' import { Request, Response, Router } from 'express' import { difference, intersection, uniq } from 'lodash' +import { mapToProviders } from '@shared/util' import { rootOrgId } from '../config' import { SISStudyRight } from '../models' import { maxYearsToCreatePopulationFrom, getCourseProvidersForCourses } from '../services/courses' @@ -12,7 +13,6 @@ import { bottlenecksOf } from '../services/populations/bottlenecksOf' import { optimizedStatisticsOf } from '../services/populations/optimizedStatisticsOf' import { populationStudentsMerger, populationCourseStatsMerger } from '../services/statMerger' import { findByTag, findByCourseAndSemesters } from '../services/students' -import { mapToProviders } from '../shared/util' import { GenderCode, ParsedCourse, Unarray, Unification, UnifyStatus } from '../types' import { getFullStudyProgrammeRights, hasFullAccessToStudentData } from '../util' import { ApplicationError } from '../util/customErrors' diff --git a/services/backend/src/routes/studyProgramme.ts b/services/backend/src/routes/studyProgramme.ts index ae8059e1c2..52dd731284 100644 --- a/services/backend/src/routes/studyProgramme.ts +++ b/services/backend/src/routes/studyProgramme.ts @@ -1,5 +1,6 @@ import { Request, Response, Router } from 'express' +import { Graduated, SpecialGroups, YearType } from '@shared/types' import { getBasicStats, setBasicStats, @@ -18,7 +19,6 @@ import { getGraduationStatsForStudyTrack } from '../services/studyProgramme/stud import { updateBasicView, updateStudyTrackView } from '../services/studyProgramme/studyProgrammeUpdates' import { getStudyRightsInProgramme, getStudyTracksForProgramme } from '../services/studyProgramme/studyRightFinders' import { getStudyTrackStatsForStudyProgramme } from '../services/studyProgramme/studyTrackStats' -import { Graduated, SpecialGroups, YearType } from '../shared/types' import logger from '../util/logger' import { logInfoForGrafana } from '../util/logInfoForGrafana' diff --git a/services/backend/src/routes/tags.ts b/services/backend/src/routes/tags.ts index a0b156f48d..333091b689 100644 --- a/services/backend/src/routes/tags.ts +++ b/services/backend/src/routes/tags.ts @@ -1,6 +1,7 @@ import { Request, Response, Router } from 'express' import { difference } from 'lodash' +import { Role } from '@shared/types' import { Tag, TagStudent } from '../models/kone' import { filterStudentnumbersByAccessrights } from '../services/students' import { @@ -14,7 +15,6 @@ import { TagFromFrontend, StudentTagFromFrontend, } from '../services/tags' -import { Role } from '../shared/types' import { getFullStudyProgrammeRights, hasFullAccessToStudentData } from '../util' const router = Router() diff --git a/services/backend/src/routes/teachers.ts b/services/backend/src/routes/teachers.ts index 9c831aefbd..2b40b79461 100644 --- a/services/backend/src/routes/teachers.ts +++ b/services/backend/src/routes/teachers.ts @@ -1,11 +1,11 @@ import { Request, Response, Router } from 'express' +import { mapToProviders } from '@shared/util' import { serviceProvider } from '../config' import * as auth from '../middleware/auth' import { getProvidersOfFaculty, isFaculty } from '../services/organizations' import { getTeachersBySearchTerm, getTeacherStatistics, getYearlyStatistics } from '../services/teachers' import { CategoryID, getTeacherStats, findAndSaveTeachers, getCategoriesAndYears } from '../services/teachers/top' -import { mapToProviders } from '../shared/util' import { getFullStudyProgrammeRights, splitByEmptySpace } from '../util' const router = Router() diff --git a/services/backend/src/routes/university.ts b/services/backend/src/routes/university.ts index 4cafe69c5b..e4e3519e33 100644 --- a/services/backend/src/routes/university.ts +++ b/services/backend/src/routes/university.ts @@ -1,6 +1,7 @@ import { Request, Response, Router } from 'express' import { cloneDeep } from 'lodash' +import { Graduated, NameWithCode } from '@shared/types' import { serviceProvider } from '../config' import { magicFacultyCode } from '../config/organizationConstants' import { Organization } from '../models' @@ -15,7 +16,6 @@ import { } from '../services/faculty/facultyService' import { combineFacultyStudentProgress, FacultyProgressData } from '../services/faculty/facultyStudentProgress' import { getMedian } from '../services/studyProgramme/studyProgrammeHelpers' -import { Graduated, NameWithCode } from '../shared/types' import logger from '../util/logger' const router = Router() diff --git a/services/backend/src/routes/users.ts b/services/backend/src/routes/users.ts index 738d5ef1f9..43bb928ce6 100644 --- a/services/backend/src/routes/users.ts +++ b/services/backend/src/routes/users.ts @@ -1,10 +1,10 @@ import { Request, Response, Router } from 'express' +import { LANGUAGE_CODES, Language } from '@shared/language' import { roles } from '../config/roles' import * as auth from '../middleware/auth' import { sendNotificationAboutAccessToUser, previewNotificationAboutAccessToUser } from '../services/mailService' import * as userService from '../services/userService' -import { LANGUAGE_CODES, Language } from '../shared/language' import logger from '../util/logger' const router = Router() diff --git a/services/backend/src/services/analyticsService.ts b/services/backend/src/services/analyticsService.ts index 5feada7d49..b3653e0e85 100644 --- a/services/backend/src/services/analyticsService.ts +++ b/services/backend/src/services/analyticsService.ts @@ -1,7 +1,7 @@ import moment from 'moment' +import { Graduated, SpecialGroups, YearType } from '@shared/types' import { facultyCodes, ignoredFacultyCodes } from '../config/organizationConstants' -import { Graduated, SpecialGroups, YearType } from '../shared/types' import { redisClient } from './redis' import { isRelevantProgramme } from './studyProgramme/studyProgrammeHelpers' diff --git a/services/backend/src/services/courses/courseStatsCounter.ts b/services/backend/src/services/courses/courseStatsCounter.ts index 9de1e3edb1..1e50909ec4 100644 --- a/services/backend/src/services/courses/courseStatsCounter.ts +++ b/services/backend/src/services/courses/courseStatsCounter.ts @@ -1,4 +1,4 @@ -import { Name } from '../../shared/types' +import { Name } from '@shared/types' import { EnrollmentState } from '../../types' import { lengthOf, percentageOf } from '../../util' diff --git a/services/backend/src/services/courses/courseYearlyStatsCounter.ts b/services/backend/src/services/courses/courseYearlyStatsCounter.ts index 661ddea91a..086fff8519 100644 --- a/services/backend/src/services/courses/courseYearlyStatsCounter.ts +++ b/services/backend/src/services/courses/courseYearlyStatsCounter.ts @@ -1,4 +1,4 @@ -import { Name } from '../../shared/types' +import { Name } from '@shared/types' import { FormattedProgramme, OrganizationDetails } from './helpers' type Programme = { diff --git a/services/backend/src/services/courses/helpers.ts b/services/backend/src/services/courses/helpers.ts index 39a98e03c7..ec53b98a44 100644 --- a/services/backend/src/services/courses/helpers.ts +++ b/services/backend/src/services/courses/helpers.ts @@ -1,6 +1,6 @@ import { Op } from 'sequelize' -import { Name } from '../../shared/types' +import { Name } from '@shared/types' import { Unification } from '../../types' export type FormattedProgramme = { diff --git a/services/backend/src/services/courses/index.ts b/services/backend/src/services/courses/index.ts index fb38970395..85ce8ffa00 100644 --- a/services/backend/src/services/courses/index.ts +++ b/services/backend/src/services/courses/index.ts @@ -1,9 +1,9 @@ import crypto from 'crypto' import { Op } from 'sequelize' +import { Name } from '@shared/types' import { serviceProvider } from '../../config' import { Course, Credit, Enrollment, Organization, SISStudyRightElement } from '../../models' -import { Name } from '../../shared/types' import { EnrollmentState, Unification } from '../../types' import { isOpenUniCourseCode } from '../../util' import logger from '../../util/logger' diff --git a/services/backend/src/services/faculty/facultyBasics.ts b/services/backend/src/services/faculty/facultyBasics.ts index cdc9607ab9..10cf1e8b95 100644 --- a/services/backend/src/services/faculty/facultyBasics.ts +++ b/services/backend/src/services/faculty/facultyBasics.ts @@ -1,6 +1,6 @@ import { cloneDeep } from 'lodash' -import { NameWithCode } from '../../shared/types' +import { NameWithCode } from '@shared/types' import { DegreeProgrammeType } from '../../types' import { getBasicStats, setBasicStats } from '../analyticsService' import { getBasicStatsForStudytrack } from '../studyProgramme/studyProgrammeBasics' diff --git a/services/backend/src/services/faculty/facultyCredits.ts b/services/backend/src/services/faculty/facultyCredits.ts index f17031edf9..84ab251802 100644 --- a/services/backend/src/services/faculty/facultyCredits.ts +++ b/services/backend/src/services/faculty/facultyCredits.ts @@ -1,4 +1,4 @@ -import { Name } from '../../shared/types' +import { Name } from '@shared/types' import { getCreditsProduced } from '../providerCredits' import { isRelevantProgramme } from '../studyProgramme/studyProgrammeHelpers' import { getDegreeProgrammesOfFaculty } from './faculty' diff --git a/services/backend/src/services/faculty/facultyGraduationTimes.ts b/services/backend/src/services/faculty/facultyGraduationTimes.ts index aa02d8a6a5..77ae6e6cb0 100644 --- a/services/backend/src/services/faculty/facultyGraduationTimes.ts +++ b/services/backend/src/services/faculty/facultyGraduationTimes.ts @@ -1,6 +1,6 @@ import { cloneDeep, omit } from 'lodash' -import { Name } from '../../shared/types' +import { Name } from '@shared/types' import { DegreeProgrammeType } from '../../types' import { getGraduationStats, getStudyTrackStats, setGraduationStats, setStudyTrackStats } from '../analyticsService' import { getGraduationStatsForStudyTrack, GraduationTimes } from '../studyProgramme/studyProgrammeGraduations' diff --git a/services/backend/src/services/faculty/facultyService.ts b/services/backend/src/services/faculty/facultyService.ts index de489a2cae..b0045a9bb9 100644 --- a/services/backend/src/services/faculty/facultyService.ts +++ b/services/backend/src/services/faculty/facultyService.ts @@ -1,6 +1,6 @@ import moment from 'moment' -import { Graduated, Name, ProgrammeFilter, SpecialGroups, YearType } from '../../shared/types' +import { Graduated, Name, ProgrammeFilter, SpecialGroups, YearType } from '@shared/types' import { DegreeProgrammeType } from '../../types' import { redisClient } from '../redis' import { FacultyProgressData } from './facultyStudentProgress' diff --git a/services/backend/src/services/faculty/facultyStudentProgress.ts b/services/backend/src/services/faculty/facultyStudentProgress.ts index 6eab7f125e..43ebd53817 100644 --- a/services/backend/src/services/faculty/facultyStudentProgress.ts +++ b/services/backend/src/services/faculty/facultyStudentProgress.ts @@ -1,8 +1,8 @@ import { cloneDeep } from 'lodash' import moment from 'moment' +import { Graduated, SpecialGroups } from '@shared/types' import { rootOrgId } from '../../config' -import { Graduated, SpecialGroups } from '../../shared/types' import { Unarray } from '../../types' import { getStudyTrackStats, setStudyTrackStats } from '../analyticsService' import { getYearsArray } from '../studyProgramme/studyProgrammeHelpers' diff --git a/services/backend/src/services/faculty/facultyUpdates.ts b/services/backend/src/services/faculty/facultyUpdates.ts index da360f81f2..b5d5b0995a 100644 --- a/services/backend/src/services/faculty/facultyUpdates.ts +++ b/services/backend/src/services/faculty/facultyUpdates.ts @@ -1,4 +1,4 @@ -import { StatsType } from '../../shared/types' +import { StatsType } from '@shared/types' import { setCreditStats } from '../analyticsService' import { computeCreditsProduced } from '../providerCredits' import { getDegreeProgrammesOfFaculty } from './faculty' diff --git a/services/backend/src/services/populations/closeToGraduation.ts b/services/backend/src/services/populations/closeToGraduation.ts index e1d3f889c2..4ad9cd7afb 100644 --- a/services/backend/src/services/populations/closeToGraduation.ts +++ b/services/backend/src/services/populations/closeToGraduation.ts @@ -1,5 +1,6 @@ import { col, InferAttributes, Op, where } from 'sequelize' +import { Name } from '@shared/types' import { Course, Credit, @@ -10,7 +11,6 @@ import { SISStudyRight, SISStudyRightElement, } from '../../models' -import { Name } from '../../shared/types' import { CreditTypeCode, DegreeProgrammeType, EnrollmentType, ExtentCode, SemesterEnrollment } from '../../types' import { redisClient } from '../redis' import { getCurriculumVersion } from './shared' diff --git a/services/backend/src/services/populations/optimizedStatisticsOf.ts b/services/backend/src/services/populations/optimizedStatisticsOf.ts index 57f07b0c2f..89d19a0f2b 100644 --- a/services/backend/src/services/populations/optimizedStatisticsOf.ts +++ b/services/backend/src/services/populations/optimizedStatisticsOf.ts @@ -1,5 +1,5 @@ -import { Name } from '../../shared/types' -import { formatQueryParamsToArrays } from '../../shared/util' +import { Name } from '@shared/types' +import { formatQueryParamsToArrays } from '@shared/util' import { Criteria, DegreeProgrammeType } from '../../types' import { getDegreeProgrammeType } from '../../util' import { getCriteria } from '../studyProgramme/studyProgrammeCriteria' diff --git a/services/backend/src/services/populations/shared.ts b/services/backend/src/services/populations/shared.ts index fc678366f5..d0699cad54 100644 --- a/services/backend/src/services/populations/shared.ts +++ b/services/backend/src/services/populations/shared.ts @@ -2,10 +2,10 @@ import { orderBy } from 'lodash' import moment from 'moment' import { Op, QueryTypes } from 'sequelize' +import { Name } from '@shared/types' import { dbConnections } from '../../database/connection' import { Course, Credit, Enrollment, SISStudyRight, SISStudyRightElement, Student, Studyplan } from '../../models' import { Tag, TagStudent } from '../../models/kone' -import { Name } from '../../shared/types' import { Criteria, DegreeProgrammeType, EnrollmentState, ParsedCourse } from '../../types' import { SemesterStart } from '../../util/semester' import { hasTransferredFromOrToProgramme } from '../studyProgramme/studyProgrammeHelpers' diff --git a/services/backend/src/services/programmeModules.ts b/services/backend/src/services/programmeModules.ts index 90c003bcc3..8080fafa87 100644 --- a/services/backend/src/services/programmeModules.ts +++ b/services/backend/src/services/programmeModules.ts @@ -1,9 +1,9 @@ import { Op, QueryTypes } from 'sequelize' +import { Name } from '@shared/types' import { dbConnections } from '../database/connection' import { CurriculumPeriod, ProgrammeModule } from '../models' import { ExcludedCourse } from '../models/kone' -import { Name } from '../shared/types' import logger from '../util/logger' import { combinedStudyProgrammes } from './studyProgramme/studyProgrammeHelpers' diff --git a/services/backend/src/services/providerCredits.ts b/services/backend/src/services/providerCredits.ts index 20c00a91d8..158b0c51bd 100644 --- a/services/backend/src/services/providerCredits.ts +++ b/services/backend/src/services/providerCredits.ts @@ -1,7 +1,7 @@ import { InferAttributes } from 'sequelize' +import { mapToProviders } from '@shared/util' import { SISStudyRight } from '../models' -import { mapToProviders } from '../shared/util' import { EnrollmentType, ExtentCode } from '../types' import { getCreditStats, setCreditStats } from './analyticsService' import { getCourseCodesOfProvider } from './providers' diff --git a/services/backend/src/services/semesters.ts b/services/backend/src/services/semesters.ts index 6ea94857a4..85939e8153 100644 --- a/services/backend/src/services/semesters.ts +++ b/services/backend/src/services/semesters.ts @@ -1,8 +1,8 @@ import moment from 'moment' import { Op } from 'sequelize' +import { Name } from '@shared/types' import { Semester } from '../models' -import { Name } from '../shared/types' type SemestersAndYears = { years: { diff --git a/services/backend/src/services/studyGuidanceGroups.ts b/services/backend/src/services/studyGuidanceGroups.ts index f0a9072c57..258109e38b 100644 --- a/services/backend/src/services/studyGuidanceGroups.ts +++ b/services/backend/src/services/studyGuidanceGroups.ts @@ -2,8 +2,8 @@ import * as Sentry from '@sentry/node' import { AxiosError } from 'axios' import { uniq } from 'lodash' +import { Name } from '@shared/types' import { StudyGuidanceGroupTag } from '../models/kone' -import { Name } from '../shared/types' import { getImporterClient } from '../util/importerClient' import logger from '../util/logger' diff --git a/services/backend/src/services/studyProgramme/index.ts b/services/backend/src/services/studyProgramme/index.ts index 9641716d37..bfee40ca14 100644 --- a/services/backend/src/services/studyProgramme/index.ts +++ b/services/backend/src/services/studyProgramme/index.ts @@ -1,9 +1,9 @@ import { memoize } from 'lodash' import { Op, QueryTypes } from 'sequelize' +import { Name } from '@shared/types' import { dbConnections } from '../../database/connection' import { Course, Credit, Enrollment, Organization, ProgrammeModule } from '../../models' -import { Name } from '../../shared/types' import { CreditTypeCode, EnrollmentState } from '../../types' import logger from '../../util/logger' diff --git a/services/backend/src/services/studyProgramme/studentGetters.ts b/services/backend/src/services/studyProgramme/studentGetters.ts index d691e49a88..a3a51e4b5d 100644 --- a/services/backend/src/services/studyProgramme/studentGetters.ts +++ b/services/backend/src/services/studyProgramme/studentGetters.ts @@ -1,7 +1,7 @@ import { QueryTypes } from 'sequelize' +import { Name } from '@shared/types' import { dbConnections } from '../../database/connection' -import { Name } from '../../shared/types' import { ExtentCode } from '../../types' import logger from '../../util/logger' diff --git a/services/backend/src/services/studyProgramme/studyProgrammeBasics.ts b/services/backend/src/services/studyProgramme/studyProgrammeBasics.ts index 0db2dc52c9..3b99e327de 100644 --- a/services/backend/src/services/studyProgramme/studyProgrammeBasics.ts +++ b/services/backend/src/services/studyProgramme/studyProgrammeBasics.ts @@ -1,6 +1,6 @@ import { indexOf } from 'lodash' -import { Name } from '../../shared/types' +import { Name } from '@shared/types' import { EnrollmentType, SemesterEnrollment } from '../../types' import { getSemestersAndYears } from '../semesters' import { diff --git a/services/backend/src/services/studyProgramme/studyProgrammeCourses.ts b/services/backend/src/services/studyProgramme/studyProgrammeCourses.ts index 6db10c9902..879dd6fe3a 100644 --- a/services/backend/src/services/studyProgramme/studyProgrammeCourses.ts +++ b/services/backend/src/services/studyProgramme/studyProgrammeCourses.ts @@ -1,9 +1,9 @@ import { orderBy, range } from 'lodash' import { Op } from 'sequelize' +import { Name } from '@shared/types' +import { mapToProviders } from '@shared/util' import { Credit, Enrollment } from '../../models' -import { Name } from '../../shared/types' -import { mapToProviders } from '../../shared/util' import { CreditTypeCode, EnrollmentState } from '../../types' import { isOpenUniCourseCode } from '../../util' import { createArrayOfCourses } from '../languageCenterData' diff --git a/services/backend/src/services/studyProgramme/studyProgrammeGraduations.ts b/services/backend/src/services/studyProgramme/studyProgrammeGraduations.ts index edd4289b5c..1e406ee81b 100644 --- a/services/backend/src/services/studyProgramme/studyProgrammeGraduations.ts +++ b/services/backend/src/services/studyProgramme/studyProgrammeGraduations.ts @@ -1,8 +1,8 @@ import { indexOf, orderBy } from 'lodash' import moment from 'moment' -import { Name } from '../../shared/types' -import { mapToProviders } from '../../shared/util' +import { Name } from '@shared/types' +import { mapToProviders } from '@shared/util' import { DegreeProgrammeType, ExtentCode, Phase, SemesterEnrollment, StudyTrack } from '../../types' import { getDegreeProgrammeType, getMinimumCreditsOfProgramme, sortByProgrammeCode } from '../../util' import { countTimeCategories } from '../graduationHelpers' diff --git a/services/backend/src/services/studyProgramme/studyRightFinders.ts b/services/backend/src/services/studyProgramme/studyRightFinders.ts index 2d64795a1f..b61a5dbf7b 100644 --- a/services/backend/src/services/studyProgramme/studyRightFinders.ts +++ b/services/backend/src/services/studyProgramme/studyRightFinders.ts @@ -1,7 +1,7 @@ import { col, fn, Includeable, Op } from 'sequelize' +import { Name } from '@shared/types' import { Student, SISStudyRight, SISStudyRightElement, Credit } from '../../models' -import { Name } from '../../shared/types' import { CreditTypeCode } from '../../types' export const getStudyRightsInProgramme = async ( diff --git a/services/backend/src/services/teachers/index.ts b/services/backend/src/services/teachers/index.ts index 0a24be4048..bb2d4790b2 100644 --- a/services/backend/src/services/teachers/index.ts +++ b/services/backend/src/services/teachers/index.ts @@ -1,8 +1,8 @@ import { Op, QueryTypes } from 'sequelize' +import { Name } from '@shared/types' import { dbConnections } from '../../database/connection' import { Credit, Course, Semester, Teacher } from '../../models' -import { Name } from '../../shared/types' import { CreditTypeCode } from '../../types' import { splitByEmptySpace } from '../../util' import { isRegularCourse, TeacherStats } from './helpers' diff --git a/services/backend/src/services/userService.ts b/services/backend/src/services/userService.ts index 982c94bba2..46da1e0c99 100644 --- a/services/backend/src/services/userService.ts +++ b/services/backend/src/services/userService.ts @@ -2,11 +2,11 @@ import { isEqual, keyBy, omit, uniq } from 'lodash' import { LRUCache } from 'lru-cache' import { InferAttributes } from 'sequelize' +import { Role } from '@shared/types' import { serviceProvider } from '../config' import { roles } from '../config/roles' import { sequelizeUser } from '../database/connection' import { User } from '../models/user' -import { Role } from '../shared/types' import { DetailedProgrammeRights, ExpandedUser, FormattedUser, IamAccess } from '../types' import { createLocaleComparator, getFullStudyProgrammeRights, hasFullAccessToStudentData } from '../util' diff --git a/services/backend/src/types/studyTrack.ts b/services/backend/src/types/studyTrack.ts index 6a541acd85..e0f145c3ad 100644 --- a/services/backend/src/types/studyTrack.ts +++ b/services/backend/src/types/studyTrack.ts @@ -1,4 +1,4 @@ -import { Name } from '../shared/types' +import { Name } from '@shared/types' export interface StudyTrack { code: string diff --git a/services/backend/src/types/user.ts b/services/backend/src/types/user.ts index d980dd3ee5..2e37f994fd 100644 --- a/services/backend/src/types/user.ts +++ b/services/backend/src/types/user.ts @@ -1,8 +1,8 @@ import { InferAttributes } from 'sequelize' +import { Language } from '@shared/language' +import { Role } from '@shared/types' import { User } from '../models/user' -import { Language } from '../shared/language' -import { Role } from '../shared/types' import { DetailedProgrammeRights } from './detailedProgrammeRights' export type ExpandedUser = InferAttributes & { diff --git a/services/backend/src/util/index.ts b/services/backend/src/util/index.ts index 2ed342dcdc..2352bba5ee 100644 --- a/services/backend/src/util/index.ts +++ b/services/backend/src/util/index.ts @@ -1,5 +1,5 @@ +import { Role } from '@shared/types' import { ProgrammeModule } from '../models' -import { Role } from '../shared/types' import { DetailedProgrammeRights } from '../types' const isObjectWithKey = (obj: unknown, key: string): obj is Record => { diff --git a/services/backend/tsconfig.json b/services/backend/tsconfig.json index cf2dc6261e..812674f03a 100644 --- a/services/backend/tsconfig.json +++ b/services/backend/tsconfig.json @@ -8,7 +8,7 @@ "experimentalDecorators": true, "emitDecoratorMetadata": true, "outDir": "dist", - "rootDir": ".", + "rootDir": "..", "esModuleInterop": true, "skipLibCheck": true, "strict": true, @@ -17,7 +17,11 @@ "sourceMap": true, "sourceRoot": "/", "inlineSources": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "baseUrl": ".", + "paths": { + "@shared/*": ["../shared/*"] + } }, "include": ["src/**/*", "index.js"] } diff --git a/services/frontend/Dockerfile b/services/frontend/Dockerfile index 7170371399..ade18a9177 100644 --- a/services/frontend/Dockerfile +++ b/services/frontend/Dockerfile @@ -35,7 +35,7 @@ ENV REACT_APP_LANGUAGE_CENTER_VIEW_ENABLED=$LANGUAGE_CENTER_VIEW_ENABLED COPY ./frontend/package* ./ RUN npm ci --include=dev COPY ./frontend . -COPY ./shared/ ./src/shared +COPY ./shared/ ../shared RUN npm run build && npm install -g serve@12.0.0 diff --git a/services/frontend/src/components/LanguagePicker/useLanguage.tsx b/services/frontend/src/components/LanguagePicker/useLanguage.tsx index e0c9aa579e..859c8f3751 100644 --- a/services/frontend/src/components/LanguagePicker/useLanguage.tsx +++ b/services/frontend/src/components/LanguagePicker/useLanguage.tsx @@ -2,8 +2,8 @@ import { createContext, useCallback, useContext, useEffect, useState, ReactNode import { useGetAuthorizedUserQuery } from '@/redux/auth' import { useModifyLanguageMutation } from '@/redux/users' -import { DEFAULT_LANG, isLanguage, Language } from '@/shared/language' -import { Name } from '@/shared/types' +import { DEFAULT_LANG, isLanguage, Language } from '@shared/language' +import { Name } from '@shared/types' type LanguageContextType = [Language, React.Dispatch>] diff --git a/services/frontend/src/components/PopulationCourseStats/CourseFilterToggle.tsx b/services/frontend/src/components/PopulationCourseStats/CourseFilterToggle.tsx index e33383f957..82a7cdb289 100644 --- a/services/frontend/src/components/PopulationCourseStats/CourseFilterToggle.tsx +++ b/services/frontend/src/components/PopulationCourseStats/CourseFilterToggle.tsx @@ -4,7 +4,7 @@ import { FilterToggleIcon } from '@/components/common/FilterToggleIcon' import { isCourseSelected, toggleCourseSelection } from '@/components/FilterView/filters/courses' import { useFilters } from '@/components/FilterView/useFilters' import { useLanguage } from '@/components/LanguagePicker/useLanguage' -import { Name } from '@/shared/types' +import { Name } from '@shared/types' interface CourseFilterToggleProps { courseCode: string diff --git a/services/frontend/src/components/PopulationSearch/PopulationSearchForm.jsx b/services/frontend/src/components/PopulationSearch/PopulationSearchForm.jsx index 78772db9e5..584bc0bc0a 100644 --- a/services/frontend/src/components/PopulationSearch/PopulationSearchForm.jsx +++ b/services/frontend/src/components/PopulationSearch/PopulationSearchForm.jsx @@ -18,8 +18,8 @@ import { getPopulationStatistics, clearPopulations, useGetProgrammesQuery } from import { clearSelected } from '@/redux/populationSelectedStudentCourses' import { useGetStudyTracksQuery } from '@/redux/studyProgramme' import { useGetStudyProgrammePinsQuery } from '@/redux/studyProgrammePins' -import { formatQueryParamsToArrays } from '@/shared/util' import { momentFromFormat, reformatDate } from '@/util/timeAndDate' +import { formatQueryParamsToArrays } from '@shared/util' import { getMonths } from './common' import './populationSearch.css' diff --git a/services/frontend/src/components/Routes/ProtectedRoute.tsx b/services/frontend/src/components/Routes/ProtectedRoute.tsx index 76b38ef71a..19ad175ea0 100644 --- a/services/frontend/src/components/Routes/ProtectedRoute.tsx +++ b/services/frontend/src/components/Routes/ProtectedRoute.tsx @@ -3,7 +3,7 @@ import { Route } from 'react-router-dom' import { checkUserAccess } from '@/common' import { hasFullAccessToTeacherData } from '@/components/Teachers/util' import { useGetAuthorizedUserQuery } from '@/redux/auth' -import { Role } from '@/shared/types' +import { Role } from '@shared/types' import { AccessDeniedMessage } from './AccessDeniedMessage' export const ProtectedRoute = ({ diff --git a/services/frontend/src/components/StudyProgramme/StudyTrackOverview/StudyTrackSelector.tsx b/services/frontend/src/components/StudyProgramme/StudyTrackOverview/StudyTrackSelector.tsx index 168d6bd60e..892d414ed5 100644 --- a/services/frontend/src/components/StudyProgramme/StudyTrackOverview/StudyTrackSelector.tsx +++ b/services/frontend/src/components/StudyProgramme/StudyTrackOverview/StudyTrackSelector.tsx @@ -2,7 +2,7 @@ import { Dropdown, DropdownProps } from 'semantic-ui-react' import '../studyprogramme.css' import { useLanguage } from '@/components/LanguagePicker/useLanguage' -import { Name } from '@/shared/types' +import { Name } from '@shared/types' interface StudyTrackSelectorProps { track: string diff --git a/services/frontend/src/components/Teachers/TeacherStatistics/index.jsx b/services/frontend/src/components/Teachers/TeacherStatistics/index.jsx index 2582cdd9b5..b7cfb9bafd 100644 --- a/services/frontend/src/components/Teachers/TeacherStatistics/index.jsx +++ b/services/frontend/src/components/Teachers/TeacherStatistics/index.jsx @@ -9,7 +9,7 @@ import { useGetAuthorizedUserQuery } from '@/redux/auth' import { useGetProvidersQuery } from '@/redux/providers' import { useGetSemestersQuery } from '@/redux/semesters' import { useLazyGetTeacherStatisticsQuery } from '@/redux/teachers' -import { mapToProviders } from '@/shared/util' +import { mapToProviders } from '@shared/util' import { hasFullAccessToTeacherData } from '../util' export const TeacherStatistics = () => { diff --git a/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/BreakdownDisplay/BreakdownBarChart.tsx b/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/BreakdownDisplay/BreakdownBarChart.tsx index 7f9ccc37c1..bbe3e53b3c 100644 --- a/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/BreakdownDisplay/BreakdownBarChart.tsx +++ b/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/BreakdownDisplay/BreakdownBarChart.tsx @@ -7,7 +7,7 @@ import exporting from 'highcharts/modules/exporting' import ReactHighcharts from 'react-highcharts' import { useLanguage } from '@/components/LanguagePicker/useLanguage' -import { GraduationStats, Name, NameWithCode } from '@/shared/types' +import { GraduationStats, Name, NameWithCode } from '@shared/types' exporting(ReactHighcharts.Highcharts) exportData(ReactHighcharts.Highcharts) diff --git a/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/BreakdownDisplay/index.tsx b/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/BreakdownDisplay/index.tsx index 578d3385be..5b26686446 100644 --- a/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/BreakdownDisplay/index.tsx +++ b/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/BreakdownDisplay/index.tsx @@ -1,6 +1,6 @@ import { Box, Stack, Typography } from '@mui/material' -import { GraduationStats, Name, NameWithCode, ProgrammeMedians } from '@/shared/types' +import { GraduationStats, Name, NameWithCode, ProgrammeMedians } from '@shared/types' import { BreakdownBarChart } from './BreakdownBarChart' export const BreakdownDisplay = ({ diff --git a/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/MedianDisplay/MedianBarChart.tsx b/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/MedianDisplay/MedianBarChart.tsx index 13b5e531ef..7521d7b129 100644 --- a/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/MedianDisplay/MedianBarChart.tsx +++ b/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/MedianDisplay/MedianBarChart.tsx @@ -7,7 +7,7 @@ import exporting from 'highcharts/modules/exporting' import ReactHighcharts from 'react-highcharts' import { useLanguage } from '@/components/LanguagePicker/useLanguage' -import { GraduationStats, Name, NameWithCode } from '@/shared/types' +import { GraduationStats, Name, NameWithCode } from '@shared/types' exporting(ReactHighcharts.Highcharts) exportData(ReactHighcharts.Highcharts) diff --git a/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/MedianDisplay/index.tsx b/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/MedianDisplay/index.tsx index 6317ff2ae7..bfd3f532ca 100644 --- a/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/MedianDisplay/index.tsx +++ b/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/MedianDisplay/index.tsx @@ -1,6 +1,6 @@ import { Box, Stack, Typography } from '@mui/material' -import { GraduationStats, Name, NameWithCode, ProgrammeMedians } from '@/shared/types' +import { GraduationStats, Name, NameWithCode, ProgrammeMedians } from '@shared/types' import { MedianBarChart } from './MedianBarChart' export const MedianDisplay = ({ diff --git a/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/index.tsx b/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/index.tsx index a394f03b5e..70ba715db6 100644 --- a/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/index.tsx +++ b/services/frontend/src/components/material/FacultyGraduations/GraduationTimes/index.tsx @@ -1,7 +1,7 @@ import { useState } from 'react' import { Section } from '@/components/material/Section' -import { GraduationStats, Name, NameWithCode, ProgrammeMedians } from '@/shared/types' +import { GraduationStats, Name, NameWithCode, ProgrammeMedians } from '@shared/types' import { BreakdownDisplay } from './BreakdownDisplay' import { MedianDisplay } from './MedianDisplay' diff --git a/services/frontend/src/components/material/FacultyProgressTable/ProgrammeProgressChart.tsx b/services/frontend/src/components/material/FacultyProgressTable/ProgrammeProgressChart.tsx index 64c8eb876d..1f2ffdf81c 100644 --- a/services/frontend/src/components/material/FacultyProgressTable/ProgrammeProgressChart.tsx +++ b/services/frontend/src/components/material/FacultyProgressTable/ProgrammeProgressChart.tsx @@ -8,7 +8,7 @@ import ReactHighcharts from 'react-highcharts' import { generateGradientColors } from '@/common' import { useLanguage } from '@/components/LanguagePicker/useLanguage' -import { NameWithCode } from '@/shared/types' +import { NameWithCode } from '@shared/types' exporting(ReactHighcharts.Highcharts) exportData(ReactHighcharts.Highcharts) diff --git a/services/frontend/src/components/material/FacultyProgressTable/index.tsx b/services/frontend/src/components/material/FacultyProgressTable/index.tsx index 10c77b97ee..d76de5658c 100644 --- a/services/frontend/src/components/material/FacultyProgressTable/index.tsx +++ b/services/frontend/src/components/material/FacultyProgressTable/index.tsx @@ -3,7 +3,7 @@ import { Fragment, useState } from 'react' import { ExpandableRow } from '@/components/material/ExpandableRow' import { Section } from '@/components/material/Section' -import { NameWithCode } from '@/shared/types' +import { NameWithCode } from '@shared/types' import { ProgrammeProgressChart } from './ProgrammeProgressChart' export const FacultyProgressTable = ({ diff --git a/services/frontend/src/components/material/NavigationBar/UserButton/index.tsx b/services/frontend/src/components/material/NavigationBar/UserButton/index.tsx index 396cf9a65b..bc46973969 100644 --- a/services/frontend/src/components/material/NavigationBar/UserButton/index.tsx +++ b/services/frontend/src/components/material/NavigationBar/UserButton/index.tsx @@ -4,7 +4,7 @@ import { useState } from 'react' import { useLanguage } from '@/components/LanguagePicker/useLanguage' import { useGetAuthorizedUserQuery } from '@/redux/auth' -import { LANGUAGE_CODES, LANGUAGE_TEXTS } from '@/shared/language' +import { LANGUAGE_CODES, LANGUAGE_TEXTS } from '@shared/language' import { LogOutButton } from './LogOutButton' import { StopMockingButton } from './StopMockingButton' diff --git a/services/frontend/src/pages/Changelog/ReleaseCard.tsx b/services/frontend/src/pages/Changelog/ReleaseCard.tsx index e834e96d79..448dbee5c5 100644 --- a/services/frontend/src/pages/Changelog/ReleaseCard.tsx +++ b/services/frontend/src/pages/Changelog/ReleaseCard.tsx @@ -3,8 +3,8 @@ import ReactMarkdown from 'react-markdown' import { getDescription } from '@/common' import { DISPLAY_DATE_FORMAT } from '@/constants/date' -import { Release } from '@/shared/types' import { reformatDate } from '@/util/timeAndDate' +import { Release } from '@shared/types' export const ReleaseCard = ({ isLoading, release }: { isLoading: boolean; release: Release }) => { return ( diff --git a/services/frontend/src/pages/Changelog/index.tsx b/services/frontend/src/pages/Changelog/index.tsx index a20e1df6e0..c4b9d8e57a 100644 --- a/services/frontend/src/pages/Changelog/index.tsx +++ b/services/frontend/src/pages/Changelog/index.tsx @@ -5,7 +5,7 @@ import { filterInternalReleases } from '@/common' import { useTitle } from '@/common/hooks' import { PageTitle } from '@/components/material/PageTitle' import { useGetChangelogQuery } from '@/redux/changelog' -import { Release } from '@/shared/types' +import { Release } from '@shared/types' import { ReleaseCard } from './ReleaseCard' export const Changelog = () => { diff --git a/services/frontend/src/pages/Faculties/BasicInformationTab/InteractiveDataTable/CollapsedStackedBar.tsx b/services/frontend/src/pages/Faculties/BasicInformationTab/InteractiveDataTable/CollapsedStackedBar.tsx index a231af6c4e..deadecf061 100644 --- a/services/frontend/src/pages/Faculties/BasicInformationTab/InteractiveDataTable/CollapsedStackedBar.tsx +++ b/services/frontend/src/pages/Faculties/BasicInformationTab/InteractiveDataTable/CollapsedStackedBar.tsx @@ -6,7 +6,7 @@ import exporting from 'highcharts/modules/exporting' import ReactHighcharts from 'react-highcharts' import { useLanguage } from '@/components/LanguagePicker/useLanguage' -import { NameWithCode } from '@/shared/types' +import { NameWithCode } from '@shared/types' exporting(ReactHighcharts.Highcharts) exportData(ReactHighcharts.Highcharts) diff --git a/services/frontend/src/pages/Faculties/BasicInformationTab/InteractiveDataTable/index.tsx b/services/frontend/src/pages/Faculties/BasicInformationTab/InteractiveDataTable/index.tsx index eba09abe6b..bd1c49c636 100644 --- a/services/frontend/src/pages/Faculties/BasicInformationTab/InteractiveDataTable/index.tsx +++ b/services/frontend/src/pages/Faculties/BasicInformationTab/InteractiveDataTable/index.tsx @@ -5,7 +5,7 @@ import { facultyToolTips } from '@/common/InfoToolTips' import { ExpandableRow } from '@/components/material/ExpandableRow' import { InfoBox } from '@/components/material/InfoBox' import { Section } from '@/components/material/Section' -import { NameWithCode } from '@/shared/types' +import { NameWithCode } from '@shared/types' import { CollapsedStackedBar } from './CollapsedStackedBar' export const InteractiveDataTable = ({ diff --git a/services/frontend/src/pages/Faculties/BasicInformationTab/index.tsx b/services/frontend/src/pages/Faculties/BasicInformationTab/index.tsx index c1a970e4af..a9c890670f 100644 --- a/services/frontend/src/pages/Faculties/BasicInformationTab/index.tsx +++ b/services/frontend/src/pages/Faculties/BasicInformationTab/index.tsx @@ -13,9 +13,9 @@ import { useGetFacultyThesisStatsQuery, } from '@/redux/facultyStats' import { useGetProgrammesQuery } from '@/redux/populations' -import { NameWithCode } from '@/shared/types' import { DegreeProgramme, GetFacultiesResponse } from '@/types/api/faculty' import { getTimestamp } from '@/util/timeAndDate' +import { NameWithCode } from '@shared/types' import { InteractiveDataTable } from './InteractiveDataTable' const calculateTotals = stats => { diff --git a/services/frontend/src/pages/Faculties/GraduationTimesTab/index.tsx b/services/frontend/src/pages/Faculties/GraduationTimesTab/index.tsx index e0fa182352..222014fa5a 100644 --- a/services/frontend/src/pages/Faculties/GraduationTimesTab/index.tsx +++ b/services/frontend/src/pages/Faculties/GraduationTimesTab/index.tsx @@ -8,9 +8,9 @@ import { GraduationTimes } from '@/components/material/FacultyGraduations/Gradua import { Section } from '@/components/material/Section' import { Toggle } from '@/components/material/Toggle' import { useGetFacultyGraduationTimesQuery } from '@/redux/facultyStats' -import { Name } from '@/shared/types' import { GetFacultiesResponse, GetFacultyGraduationTimesResponse } from '@/types/api/faculty' import { getTimestamp } from '@/util/timeAndDate' +import { Name } from '@shared/types' export const GraduationTimesTab = ({ faculty, diff --git a/services/frontend/src/pages/Faculties/ProgressTab/export.ts b/services/frontend/src/pages/Faculties/ProgressTab/export.ts index f39cef164b..404c09834a 100644 --- a/services/frontend/src/pages/Faculties/ProgressTab/export.ts +++ b/services/frontend/src/pages/Faculties/ProgressTab/export.ts @@ -1,8 +1,8 @@ import { utils, writeFile } from 'xlsx' -import { Name, NameWithCode } from '@/shared/types' import { sortProgrammeKeys } from '@/util/faculty' import { getTimestamp } from '@/util/timeAndDate' +import { Name, NameWithCode } from '@shared/types' export const exportProgressTable = ( progressStats, diff --git a/services/frontend/src/pages/Faculties/StudentsByStartingYearTab/export.ts b/services/frontend/src/pages/Faculties/StudentsByStartingYearTab/export.ts index 996389de66..555c41d269 100644 --- a/services/frontend/src/pages/Faculties/StudentsByStartingYearTab/export.ts +++ b/services/frontend/src/pages/Faculties/StudentsByStartingYearTab/export.ts @@ -1,8 +1,8 @@ import { utils, writeFile } from 'xlsx' -import { Name } from '@/shared/types' import { DegreeProgramme, GetFacultyStudentStatsResponse } from '@/types/api/faculty' import { getTimestamp } from '@/util/timeAndDate' +import { Name } from '@shared/types' export const exportStudentTable = ( data: GetFacultyStudentStatsResponse | undefined, diff --git a/services/frontend/src/pages/FrontPage/ReleaseItem.tsx b/services/frontend/src/pages/FrontPage/ReleaseItem.tsx index 395aec0e0c..65423df85c 100644 --- a/services/frontend/src/pages/FrontPage/ReleaseItem.tsx +++ b/services/frontend/src/pages/FrontPage/ReleaseItem.tsx @@ -3,8 +3,8 @@ import ReactMarkdown from 'react-markdown' import { getDescription } from '@/common' import { DISPLAY_DATE_FORMAT } from '@/constants/date' -import { Release } from '@/shared/types' import { reformatDate } from '@/util/timeAndDate' +import { Release } from '@shared/types' export const ReleaseItem = ({ isLoading, release }: { isLoading: boolean; release: Release }) => { return ( diff --git a/services/frontend/src/pages/FrontPage/index.tsx b/services/frontend/src/pages/FrontPage/index.tsx index b07e28c580..189e49494b 100644 --- a/services/frontend/src/pages/FrontPage/index.tsx +++ b/services/frontend/src/pages/FrontPage/index.tsx @@ -12,7 +12,7 @@ import { useTitle } from '@/common/hooks' import { PageTitle } from '@/components/material/PageTitle' import { useGetAuthorizedUserQuery } from '@/redux/auth' import { useGetChangelogQuery } from '@/redux/changelog' -import { Release } from '@/shared/types' +import { Release } from '@shared/types' import { FeatureItem } from './FeatureItem' import { MaterialInfoCard } from './MaterialInfoCard' import { ReleaseItem } from './ReleaseItem' diff --git a/services/frontend/src/redux/changelog.ts b/services/frontend/src/redux/changelog.ts index c2f7802e4c..b1c6009af6 100644 --- a/services/frontend/src/redux/changelog.ts +++ b/services/frontend/src/redux/changelog.ts @@ -1,5 +1,5 @@ import { RTKApi } from '@/apiConnection' -import { Release } from '@/shared/types' +import { Release } from '@shared/types' const changelogApi = RTKApi.injectEndpoints({ endpoints: builder => ({ diff --git a/services/frontend/src/redux/semesters.ts b/services/frontend/src/redux/semesters.ts index 2a3bce547e..4d6367c2aa 100644 --- a/services/frontend/src/redux/semesters.ts +++ b/services/frontend/src/redux/semesters.ts @@ -1,5 +1,5 @@ import { RTKApi } from '@/apiConnection' -import { Name } from '@/shared/types' +import { Name } from '@shared/types' type SemestersData = { semesters: Record< diff --git a/services/frontend/src/redux/settings.js b/services/frontend/src/redux/settings.js index 1980fecefd..8340af1429 100644 --- a/services/frontend/src/redux/settings.js +++ b/services/frontend/src/redux/settings.js @@ -1,4 +1,4 @@ -import { DEFAULT_LANG } from '@/shared/language' +import { DEFAULT_LANG } from '@shared/language' const initialState = { language: DEFAULT_LANG, diff --git a/services/frontend/src/types/api/faculty.ts b/services/frontend/src/types/api/faculty.ts index 2821cbc915..bcd93496fb 100644 --- a/services/frontend/src/types/api/faculty.ts +++ b/services/frontend/src/types/api/faculty.ts @@ -1,7 +1,7 @@ // TODO: Remove 'status', 'lastUpdated' and any other redundant fields from responses -import { GraduationStats, Name, NameWithCode, ProgrammeMedians } from '@/shared/types' -import { Graduated, ProgrammeFilter, SpecialGroups, YearType } from '@/shared/types/faculty' +import { GraduationStats, Name, NameWithCode, ProgrammeMedians } from '@shared/types' +import { Graduated, ProgrammeFilter, SpecialGroups, YearType } from '@shared/types/faculty' export type GraphStat = { data: number[] diff --git a/services/frontend/src/types/api/university.ts b/services/frontend/src/types/api/university.ts index 2910c92b42..5b00018916 100644 --- a/services/frontend/src/types/api/university.ts +++ b/services/frontend/src/types/api/university.ts @@ -1,4 +1,4 @@ -import { GraduationStats, NameWithCode, ProgrammeMedians } from '@/shared/types' +import { GraduationStats, NameWithCode, ProgrammeMedians } from '@shared/types' // ? Almost identical to GetFacultyGraduationTimesResponse, could be combined? export interface GetAllGraduationStatsResponse { diff --git a/services/frontend/src/util/getDefaultMRTOptions.tsx b/services/frontend/src/util/getDefaultMRTOptions.tsx index b591ca97b0..b1f2f4105f 100644 --- a/services/frontend/src/util/getDefaultMRTOptions.tsx +++ b/services/frontend/src/util/getDefaultMRTOptions.tsx @@ -4,7 +4,7 @@ import { MRT_RowData, MRT_TableOptions, MRT_Row } from 'material-react-table' import { MRT_Localization_EN } from 'material-react-table/locales/en' import { MRT_Localization_FI } from 'material-react-table/locales/fi' -import { DEFAULT_LANG } from '@/shared/language' +import { DEFAULT_LANG } from '@shared/language' export const getDefaultMRTOptions = ( setExportData: (data: Record[]) => void, diff --git a/services/frontend/tsconfig.json b/services/frontend/tsconfig.json index 59c3b4bef4..c7dc18a83b 100644 --- a/services/frontend/tsconfig.json +++ b/services/frontend/tsconfig.json @@ -24,7 +24,8 @@ "baseUrl": ".", "types": ["node"], "paths": { - "@/*": ["./src/*"] + "@/*": ["./src/*"], + "@shared/*": ["../shared/*"] } }, "include": ["src"], diff --git a/services/frontend/vite.config.ts b/services/frontend/vite.config.ts index 6a6244dfe6..2208764e08 100644 --- a/services/frontend/vite.config.ts +++ b/services/frontend/vite.config.ts @@ -30,6 +30,7 @@ export default defineConfig({ resolve: { alias: { '@': path.resolve(__dirname, './src'), + '@shared': path.resolve(__dirname, '../shared'), }, }, build: { diff --git a/services/shared/tsconfig.json b/services/shared/tsconfig.json index aaad789400..e0515a737c 100644 --- a/services/shared/tsconfig.json +++ b/services/shared/tsconfig.json @@ -7,7 +7,6 @@ "experimentalDecorators": true, "emitDecoratorMetadata": true, "outDir": "dist", - "rootDir": ".", "esModuleInterop": true, "skipLibCheck": true, "strict": true,