From 30f499cf2e68c5bdfde866193523dbb1232ae3b4 Mon Sep 17 00:00:00 2001 From: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> Date: Wed, 20 Mar 2024 19:32:04 +0100 Subject: [PATCH] chore(server): use absolute import paths (#8080) update server to use absolute import paths --- .vscode/settings.json | 30 +++++ server/.eslintrc.js | 1 + server/e2e/client/asset-api.ts | 2 +- server/e2e/client/auth-api.ts | 5 +- server/e2e/client/index.ts | 6 +- server/e2e/client/library-api.ts | 2 +- server/e2e/jobs/jest-e2e.json | 6 +- .../jobs/specs/library-watcher.e2e-spec.ts | 12 +- server/e2e/jobs/specs/library.e2e-spec.ts | 20 ++- server/package.json | 10 +- server/src/domain/access/access.core.ts | 8 +- server/src/domain/access/index.ts | 1 - server/src/domain/activity/activity.dto.ts | 6 +- .../src/domain/activity/activity.service.ts | 11 +- server/src/domain/activity/activity.spec.ts | 13 +- server/src/domain/activity/index.ts | 2 - .../domain/album/album-response.dto.spec.ts | 4 +- server/src/domain/album/album-response.dto.ts | 10 +- server/src/domain/album/album.service.spec.ts | 30 ++--- server/src/domain/album/album.service.ts | 34 ++--- .../domain/album/dto/album-add-users.dto.ts | 2 +- .../src/domain/album/dto/album-create.dto.ts | 2 +- .../src/domain/album/dto/album-update.dto.ts | 4 +- server/src/domain/album/dto/album.dto.ts | 2 +- server/src/domain/album/dto/get-albums.dto.ts | 2 +- server/src/domain/album/dto/index.ts | 5 - server/src/domain/album/index.ts | 3 - server/src/domain/api-key/api-key.dto.ts | 2 +- .../domain/api-key/api-key.service.spec.ts | 10 +- server/src/domain/api-key/api-key.service.ts | 9 +- server/src/domain/api-key/index.ts | 2 - server/src/domain/asset/asset.service.spec.ts | 65 ++++------ server/src/domain/asset/asset.service.ts | 71 +++++----- server/src/domain/asset/dto/asset-ids.dto.ts | 2 +- .../src/domain/asset/dto/asset-stack.dto.ts | 2 +- .../domain/asset/dto/asset-statistics.dto.ts | 6 +- server/src/domain/asset/dto/asset.dto.ts | 4 +- server/src/domain/asset/dto/index.ts | 7 - server/src/domain/asset/dto/map-marker.dto.ts | 2 +- .../src/domain/asset/dto/time-bucket.dto.ts | 6 +- server/src/domain/asset/index.ts | 3 - .../response-dto/asset-ids-response.dto.ts | 2 +- .../asset/response-dto/asset-response.dto.ts | 15 ++- .../asset/response-dto/exif-response.dto.ts | 2 +- server/src/domain/asset/response-dto/index.ts | 6 - .../response-dto/smart-info-response.dto.ts | 2 +- server/src/domain/audit/audit.dto.ts | 5 +- server/src/domain/audit/audit.service.spec.ts | 41 +++--- server/src/domain/audit/audit.service.ts | 37 +++--- server/src/domain/audit/index.ts | 2 - server/src/domain/auth/auth.dto.ts | 5 +- server/src/domain/auth/auth.service.spec.ts | 56 ++++---- server/src/domain/auth/auth.service.ts | 36 +++--- server/src/domain/auth/index.ts | 3 - .../domain/database/database.service.spec.ts | 15 +-- .../src/domain/database/database.service.ts | 6 +- server/src/domain/database/index.ts | 1 - server/src/domain/domain.config.ts | 2 +- server/src/domain/domain.constant.spec.ts | 2 +- server/src/domain/domain.constant.ts | 2 +- server/src/domain/domain.module.ts | 50 +++---- server/src/domain/domain.util.ts | 2 +- server/src/domain/download/download.dto.ts | 2 +- .../domain/download/download.service.spec.ts | 22 ++-- .../src/domain/download/download.service.ts | 18 +-- server/src/domain/download/index.ts | 2 - server/src/domain/index.ts | 30 ----- server/src/domain/job/index.ts | 4 - server/src/domain/job/job.dto.ts | 4 +- server/src/domain/job/job.service.spec.ts | 37 +++--- server/src/domain/job/job.service.ts | 29 ++--- server/src/domain/library/index.ts | 2 - server/src/domain/library/library.dto.ts | 4 +- .../domain/library/library.service.spec.ts | 77 +++++------ server/src/domain/library/library.service.ts | 46 +++---- server/src/domain/media/index.ts | 2 - server/src/domain/media/media.service.spec.ts | 58 ++++----- server/src/domain/media/media.service.ts | 67 +++++----- server/src/domain/media/media.util.ts | 13 +- server/src/domain/metadata/index.ts | 1 - .../domain/metadata/metadata.service.spec.ts | 70 +++++----- .../src/domain/metadata/metadata.service.ts | 45 +++---- server/src/domain/partner/index.ts | 2 - server/src/domain/partner/partner.dto.ts | 2 +- .../domain/partner/partner.service.spec.ts | 13 +- server/src/domain/partner/partner.service.ts | 13 +- server/src/domain/person/index.ts | 2 - server/src/domain/person/person.dto.ts | 7 +- .../src/domain/person/person.service.spec.ts | 71 +++++----- server/src/domain/person/person.service.ts | 61 ++++----- .../repositories/activity.repository.ts | 4 +- .../domain/repositories/album.repository.ts | 2 +- .../domain/repositories/api-key.repository.ts | 2 +- .../repositories/asset-stack.repository.ts | 2 +- .../domain/repositories/asset.repository.ts | 10 +- .../domain/repositories/audit.repository.ts | 2 +- .../repositories/communication.repository.ts | 5 +- .../repositories/database.repository.ts | 2 +- server/src/domain/repositories/index.ts | 27 ---- .../src/domain/repositories/job.repository.ts | 5 +- .../domain/repositories/library.repository.ts | 4 +- .../machine-learning.repository.ts | 2 +- .../domain/repositories/media.repository.ts | 2 +- .../domain/repositories/move.repository.ts | 2 +- .../domain/repositories/partner.repository.ts | 2 +- .../domain/repositories/person.repository.ts | 6 +- .../domain/repositories/search.repository.ts | 7 +- .../repositories/shared-link.repository.ts | 2 +- .../domain/repositories/storage.repository.ts | 2 +- .../repositories/system-config.repository.ts | 2 +- .../system-metadata.repository.ts | 2 +- .../src/domain/repositories/tag.repository.ts | 3 +- .../repositories/user-token.repository.ts | 2 +- .../domain/repositories/user.repository.ts | 2 +- server/src/domain/search/dto/index.ts | 1 - .../search/dto/search-suggestion.dto.ts | 2 +- server/src/domain/search/dto/search.dto.ts | 6 +- server/src/domain/search/index.ts | 3 - .../src/domain/search/response-dto/index.ts | 2 - .../search-explore.response.dto.ts | 2 +- .../response-dto/search-response.dto.ts | 4 +- .../src/domain/search/search.service.spec.ts | 46 +++---- server/src/domain/search/search.service.ts | 35 +++-- server/src/domain/server-info/index.ts | 2 - .../src/domain/server-info/server-info.dto.ts | 5 +- .../server-info/server-info.service.spec.ts | 34 +++-- .../domain/server-info/server-info.service.ts | 30 ++--- server/src/domain/shared-link/index.ts | 3 - .../shared-link/shared-link-response.dto.ts | 6 +- .../src/domain/shared-link/shared-link.dto.ts | 4 +- .../shared-link/shared-link.service.spec.ts | 27 ++-- .../domain/shared-link/shared-link.service.ts | 24 ++-- server/src/domain/smart-info/dto/index.ts | 1 - .../domain/smart-info/dto/model-config.dto.ts | 4 +- server/src/domain/smart-info/index.ts | 2 - .../smart-info/smart-info.service.spec.ts | 40 +++--- .../domain/smart-info/smart-info.service.ts | 26 ++-- server/src/domain/storage-template/index.ts | 1 - .../storage-template.service.spec.ts | 54 ++++---- .../storage-template.service.ts | 47 ++++--- server/src/domain/storage/index.ts | 2 - server/src/domain/storage/storage.core.ts | 28 ++-- .../domain/storage/storage.service.spec.ts | 6 +- server/src/domain/storage/storage.service.ts | 9 +- server/src/domain/system-config/dto/index.ts | 8 -- .../dto/system-config-ffmpeg.dto.ts | 11 +- .../dto/system-config-job.dto.ts | 2 +- .../dto/system-config-library.dto.ts | 2 +- .../dto/system-config-logging.dto.ts | 4 +- .../dto/system-config-machine-learning.dto.ts | 4 +- .../dto/system-config-map.dto.ts | 2 +- .../system-config-new-version-check.dto.ts | 2 +- .../dto/system-config-oauth.dto.ts | 2 +- .../dto/system-config-password-login.dto.ts | 2 +- .../system-config-reverse-geocoding.dto.ts | 2 +- .../dto/system-config-storage-template.dto.ts | 2 +- .../dto/system-config-thumbnail.dto.ts | 2 +- .../dto/system-config-trash.dto.ts | 2 +- .../system-config/dto/system-config.dto.ts | 34 ++--- server/src/domain/system-config/index.ts | 5 - .../system-config/response-dto/index.ts | 1 - .../system-config/system-config.core.ts | 26 ++-- .../system-config.service.spec.ts | 21 +-- .../system-config/system-config.service.ts | 18 +-- server/src/domain/tag/index.ts | 3 - server/src/domain/tag/tag-response.dto.ts | 2 +- server/src/domain/tag/tag.dto.ts | 4 +- server/src/domain/tag/tag.service.spec.ts | 13 +- server/src/domain/tag/tag.service.ts | 12 +- server/src/domain/trash/index.ts | 1 - server/src/domain/trash/trash.service.spec.ts | 23 ++-- server/src/domain/trash/trash.service.ts | 21 ++- .../user/dto/create-profile-image.dto.ts | 2 +- .../domain/user/dto/create-user.dto.spec.ts | 2 +- server/src/domain/user/dto/create-user.dto.ts | 2 +- server/src/domain/user/dto/delete-user.dto.ts | 2 +- server/src/domain/user/dto/index.ts | 4 - .../domain/user/dto/update-user.dto.spec.ts | 2 +- server/src/domain/user/dto/update-user.dto.ts | 4 +- server/src/domain/user/index.ts | 4 - server/src/domain/user/response-dto/index.ts | 2 - .../user/response-dto/user-response.dto.ts | 2 +- server/src/domain/user/user.core.ts | 9 +- server/src/domain/user/user.service.spec.ts | 50 ++++--- server/src/domain/user/user.service.ts | 43 +++--- server/src/immich-admin/app.module.ts | 15 ++- .../commands/list-users.command.ts | 4 +- .../src/immich-admin/commands/oauth-login.ts | 2 +- .../immich-admin/commands/password-login.ts | 2 +- .../commands/reset-admin-password.command.ts | 3 +- server/src/immich-admin/constants.ts | 4 +- server/src/immich-admin/main.ts | 4 +- .../immich/api-v1/asset/asset-repository.ts | 15 ++- .../immich/api-v1/asset/asset.controller.ts | 42 +++--- .../immich/api-v1/asset/asset.service.spec.ts | 46 +++---- .../src/immich/api-v1/asset/asset.service.ts | 63 +++++---- .../api-v1/asset/dto/asset-search.dto.ts | 2 +- .../dto/check-existing-assets.dto.spec.ts | 2 +- .../api-v1/asset/dto/create-asset.dto.ts | 3 +- .../asset/dto/get-asset-thumbnail.dto.ts | 2 +- .../immich/api-v1/asset/dto/serve-file.dto.ts | 2 +- server/src/immich/app.guard.ts | 6 +- server/src/immich/app.module.ts | 67 +++++----- server/src/immich/app.service.ts | 23 ++-- server/src/immich/app.utils.ts | 18 +-- .../immich/controllers/activity.controller.ts | 30 ++--- .../immich/controllers/album.controller.ts | 32 ++--- .../immich/controllers/api-key.controller.ts | 14 +- .../src/immich/controllers/app.controller.ts | 4 +- .../immich/controllers/asset.controller.ts | 49 +++---- .../immich/controllers/audit.controller.ts | 12 +- .../src/immich/controllers/auth.controller.ts | 34 +++-- .../immich/controllers/download.controller.ts | 11 +- .../src/immich/controllers/face.controller.ts | 8 +- server/src/immich/controllers/index.ts | 21 --- .../src/immich/controllers/job.controller.ts | 5 +- .../immich/controllers/library.controller.ts | 34 ++--- .../immich/controllers/oauth.controller.ts | 15 +-- .../immich/controllers/partner.controller.ts | 10 +- .../immich/controllers/person.controller.ts | 22 ++-- .../immich/controllers/search.controller.ts | 32 ++--- .../controllers/server-info.controller.ts | 10 +- .../controllers/shared-link.controller.ts | 22 ++-- .../controllers/system-config.controller.ts | 8 +- .../src/immich/controllers/tag.controller.ts | 21 ++- .../immich/controllers/trash.controller.ts | 6 +- .../src/immich/controllers/user.controller.ts | 30 ++--- server/src/immich/index.ts | 2 - .../immich/interceptors/error.interceptor.ts | 6 +- .../interceptors/file-upload.interceptor.ts | 6 +- server/src/immich/interceptors/index.ts | 2 - server/src/immich/main.ts | 15 ++- server/src/infra/database.config.ts | 2 +- server/src/infra/entities/activity.entity.ts | 6 +- server/src/infra/entities/album.entity.ts | 6 +- server/src/infra/entities/api-key.entity.ts | 2 +- .../src/infra/entities/asset-face.entity.ts | 4 +- .../infra/entities/asset-job-status.entity.ts | 2 +- .../src/infra/entities/asset-stack.entity.ts | 2 +- server/src/infra/entities/asset.entity.ts | 22 ++-- server/src/infra/entities/exif.entity.ts | 2 +- server/src/infra/entities/index.ts | 67 ++++------ server/src/infra/entities/library.entity.ts | 4 +- server/src/infra/entities/partner.entity.ts | 3 +- server/src/infra/entities/person.entity.ts | 4 +- .../src/infra/entities/shared-link.entity.ts | 6 +- .../src/infra/entities/smart-info.entity.ts | 2 +- .../src/infra/entities/smart-search.entity.ts | 2 +- .../infra/entities/system-config.entity.ts | 2 +- server/src/infra/entities/tag.entity.ts | 4 +- .../src/infra/entities/user-token.entity.ts | 2 +- server/src/infra/entities/user.entity.ts | 4 +- server/src/infra/index.ts | 4 - server/src/infra/infra.config.ts | 2 +- server/src/infra/infra.module.ts | 122 +++++++++--------- server/src/infra/infra.utils.ts | 16 ++- server/src/infra/instrumentation.ts | 6 +- server/src/infra/logger.ts | 2 +- .../migrations/1700713871511-UsePgVectors.ts | 12 +- .../1700713994428-AddCLIPEmbeddingIndex.ts | 4 +- .../1700714033632-AddFaceEmbeddingIndex.ts | 4 +- .../infra/repositories/access.repository.ts | 28 ++-- .../infra/repositories/activity.repository.ts | 8 +- .../infra/repositories/album.repository.ts | 21 ++- .../infra/repositories/api-key.repository.ts | 8 +- .../repositories/asset-stack.repository.ts | 6 +- .../infra/repositories/asset.repository.ts | 36 ++++-- .../infra/repositories/audit.repository.ts | 6 +- .../repositories/communication.repository.ts | 22 ++-- .../infra/repositories/crypto.repository.ts | 4 +- .../infra/repositories/database.repository.ts | 19 ++- .../repositories/filesystem.provider.spec.ts | 4 +- .../infra/repositories/filesystem.provider.ts | 24 ++-- server/src/infra/repositories/index.ts | 27 ---- .../src/infra/repositories/job.repository.ts | 24 ++-- .../infra/repositories/library.repository.ts | 9 +- .../machine-learning.repository.ts | 12 +- .../infra/repositories/media.repository.ts | 20 +-- .../infra/repositories/metadata.repository.ts | 32 +++-- .../src/infra/repositories/move.repository.ts | 8 +- .../infra/repositories/partner.repository.ts | 6 +- .../infra/repositories/person.repository.ts | 19 +-- .../infra/repositories/search.repository.ts | 39 +++--- .../repositories/server-info.repository.ts | 4 +- .../repositories/shared-link.repository.ts | 8 +- .../repositories/system-config.repository.ts | 10 +- .../system-metadata.repository.ts | 6 +- .../src/infra/repositories/tag.repository.ts | 7 +- .../repositories/user-token.repository.ts | 8 +- .../src/infra/repositories/user.repository.ts | 14 +- server/src/infra/sql-generator/index.ts | 44 +++---- .../src/infra/subscribers/audit.subscriber.ts | 4 +- server/src/main.ts | 6 +- server/src/microservices/app.service.ts | 34 +++-- server/src/microservices/main.ts | 10 +- .../src/microservices/microservices.module.ts | 6 +- .../utils/exif/coordinates.spec.ts | 2 +- .../microservices/utils/exif/coordinates.ts | 2 +- .../src/microservices/utils/numbers.spec.ts | 2 +- server/src/test-utils/utils.ts | 18 ++- server/test/fixtures/activity.stub.ts | 10 +- server/test/fixtures/album.stub.ts | 8 +- server/test/fixtures/api-key.stub.ts | 6 +- server/test/fixtures/asset.stub.ts | 12 +- server/test/fixtures/audit.stub.ts | 4 +- server/test/fixtures/auth.stub.ts | 6 +- server/test/fixtures/face.stub.ts | 6 +- server/test/fixtures/index.ts | 18 --- server/test/fixtures/library.stub.ts | 7 +- server/test/fixtures/media.stub.ts | 2 +- server/test/fixtures/partner.stub.ts | 4 +- server/test/fixtures/person.stub.ts | 4 +- server/test/fixtures/shared-link.stub.ts | 19 ++- server/test/fixtures/system-config.stub.ts | 2 +- server/test/fixtures/tag.stub.ts | 6 +- server/test/fixtures/user-token.stub.ts | 4 +- server/test/fixtures/user.stub.ts | 4 +- server/test/index.ts | 2 - .../repositories/access.repository.mock.ts | 3 +- .../repositories/activity.repository.mock.ts | 2 +- .../repositories/album.repository.mock.ts | 2 +- .../repositories/api-key.repository.mock.ts | 2 +- .../asset-stack.repository.mock.ts | 2 +- .../repositories/asset.repository.mock.ts | 2 +- .../repositories/audit.repository.mock.ts | 2 +- .../communication.repository.mock.ts | 2 +- .../repositories/crypto.repository.mock.ts | 2 +- .../repositories/database.repository.mock.ts | 3 +- server/test/repositories/index.ts | 26 ---- .../test/repositories/job.repository.mock.ts | 2 +- .../repositories/library.repository.mock.ts | 2 +- .../machine-learning.repository.mock.ts | 2 +- .../repositories/media.repository.mock.ts | 2 +- .../repositories/metadata.repository.mock.ts | 2 +- .../test/repositories/move.repository.mock.ts | 2 +- .../repositories/partner.repository.mock.ts | 2 +- .../repositories/person.repository.mock.ts | 2 +- .../repositories/search.repository.mock.ts | 2 +- .../shared-link.repository.mock.ts | 2 +- .../repositories/storage.repository.mock.ts | 3 +- .../system-config.repository.mock.ts | 3 +- .../system-info.repository.mock.ts | 2 +- .../system-metadata.repository.mock.ts | 2 +- .../test/repositories/tag.repository.mock.ts | 2 +- .../user-token.repository.mock.ts | 2 +- .../test/repositories/user.repository.mock.ts | 3 +- server/tsconfig.json | 18 +-- 347 files changed, 1962 insertions(+), 2274 deletions(-) create mode 100644 .vscode/settings.json delete mode 100644 server/src/domain/access/index.ts delete mode 100644 server/src/domain/activity/index.ts delete mode 100644 server/src/domain/album/dto/index.ts delete mode 100644 server/src/domain/album/index.ts delete mode 100644 server/src/domain/api-key/index.ts delete mode 100644 server/src/domain/asset/dto/index.ts delete mode 100644 server/src/domain/asset/index.ts delete mode 100644 server/src/domain/asset/response-dto/index.ts delete mode 100644 server/src/domain/audit/index.ts delete mode 100644 server/src/domain/auth/index.ts delete mode 100644 server/src/domain/database/index.ts delete mode 100644 server/src/domain/download/index.ts delete mode 100644 server/src/domain/index.ts delete mode 100644 server/src/domain/job/index.ts delete mode 100644 server/src/domain/library/index.ts delete mode 100644 server/src/domain/media/index.ts delete mode 100644 server/src/domain/metadata/index.ts delete mode 100644 server/src/domain/partner/index.ts delete mode 100644 server/src/domain/person/index.ts delete mode 100644 server/src/domain/repositories/index.ts delete mode 100644 server/src/domain/search/dto/index.ts delete mode 100644 server/src/domain/search/index.ts delete mode 100644 server/src/domain/search/response-dto/index.ts delete mode 100644 server/src/domain/server-info/index.ts delete mode 100644 server/src/domain/shared-link/index.ts delete mode 100644 server/src/domain/smart-info/dto/index.ts delete mode 100644 server/src/domain/smart-info/index.ts delete mode 100644 server/src/domain/storage-template/index.ts delete mode 100644 server/src/domain/storage/index.ts delete mode 100644 server/src/domain/system-config/dto/index.ts delete mode 100644 server/src/domain/system-config/index.ts delete mode 100644 server/src/domain/system-config/response-dto/index.ts delete mode 100644 server/src/domain/tag/index.ts delete mode 100644 server/src/domain/trash/index.ts delete mode 100644 server/src/domain/user/dto/index.ts delete mode 100644 server/src/domain/user/index.ts delete mode 100644 server/src/domain/user/response-dto/index.ts delete mode 100644 server/src/immich/controllers/index.ts delete mode 100644 server/src/immich/index.ts delete mode 100644 server/src/immich/interceptors/index.ts delete mode 100644 server/src/infra/index.ts delete mode 100644 server/src/infra/repositories/index.ts delete mode 100644 server/test/fixtures/index.ts delete mode 100644 server/test/index.ts delete mode 100644 server/test/repositories/index.ts diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..eae6e1a16d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + "editor.formatOnSave": true, + "[javascript][typescript][css]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.tabSize": 2, + "editor.formatOnSave": true + }, + "[svelte]": { + "editor.defaultFormatter": "svelte.svelte-vscode", + "editor.tabSize": 2 + }, + "svelte.enable-ts-plugin": true, + "eslint.validate": [ + "javascript", + "svelte" + ], + "typescript.preferences.importModuleSpecifier": "non-relative", + "[dart]": { + "editor.formatOnSave": true, + "editor.selectionHighlight": false, + "editor.suggest.snippetsPreventQuickSuggestions": false, + "editor.suggestSelection": "first", + "editor.tabCompletion": "onlySnippets", + "editor.wordBasedSuggestions": "off", + "editor.defaultFormatter": "Dart-Code.dart-code" + }, + "cSpell.words": [ + "immich" + ], +} \ No newline at end of file diff --git a/server/.eslintrc.js b/server/.eslintrc.js index 3673add3c1..75138ff235 100644 --- a/server/.eslintrc.js +++ b/server/.eslintrc.js @@ -33,5 +33,6 @@ module.exports = { '@typescript-eslint/require-await': 'error', curly: 2, 'prettier/prettier': 0, + 'no-restricted-imports': ['error', { patterns: [{ group: ['.*'], message: 'Relative imports are not allowed.' }] }], }, }; diff --git a/server/e2e/client/asset-api.ts b/server/e2e/client/asset-api.ts index 63d4395866..8f30e1f4ab 100644 --- a/server/e2e/client/asset-api.ts +++ b/server/e2e/client/asset-api.ts @@ -1,4 +1,4 @@ -import { AssetResponseDto } from '@app/domain'; +import { AssetResponseDto } from 'src/domain/asset/response-dto/asset-response.dto'; import request from 'supertest'; export const assetApi = { diff --git a/server/e2e/client/auth-api.ts b/server/e2e/client/auth-api.ts index e89e6d0576..46b21fb98f 100644 --- a/server/e2e/client/auth-api.ts +++ b/server/e2e/client/auth-api.ts @@ -1,6 +1,7 @@ -import { LoginResponseDto, UserResponseDto } from '@app/domain'; -import { adminSignupStub, loginResponseStub, loginStub } from '@test'; +import { LoginResponseDto } from 'src/domain/auth/auth.dto'; +import { UserResponseDto } from 'src/domain/user/response-dto/user-response.dto'; import request from 'supertest'; +import { adminSignupStub, loginResponseStub, loginStub } from 'test/fixtures/auth.stub'; export const authApi = { adminSignUp: async (server: any) => { diff --git a/server/e2e/client/index.ts b/server/e2e/client/index.ts index b4aa2a141b..41418ddcc0 100644 --- a/server/e2e/client/index.ts +++ b/server/e2e/client/index.ts @@ -1,6 +1,6 @@ -import { assetApi } from './asset-api'; -import { authApi } from './auth-api'; -import { libraryApi } from './library-api'; +import { assetApi } from 'e2e/client/asset-api'; +import { authApi } from 'e2e/client/auth-api'; +import { libraryApi } from 'e2e/client/library-api'; export const api = { authApi, diff --git a/server/e2e/client/library-api.ts b/server/e2e/client/library-api.ts index 070683eb01..90b1b74517 100644 --- a/server/e2e/client/library-api.ts +++ b/server/e2e/client/library-api.ts @@ -1,4 +1,4 @@ -import { CreateLibraryDto, LibraryResponseDto, ScanLibraryDto } from '@app/domain'; +import { CreateLibraryDto, LibraryResponseDto, ScanLibraryDto } from 'src/domain/library/library.dto'; import request from 'supertest'; export const libraryApi = { diff --git a/server/e2e/jobs/jest-e2e.json b/server/e2e/jobs/jest-e2e.json index 333174c5a9..b9a238d838 100644 --- a/server/e2e/jobs/jest-e2e.json +++ b/server/e2e/jobs/jest-e2e.json @@ -16,9 +16,7 @@ ], "coverageDirectory": "./coverage", "moduleNameMapper": { - "^@test(|/.*)$": "/test/$1", - "^@app/immich(|/.*)$": "/src/immich/$1", - "^@app/infra(|/.*)$": "/src/infra/$1", - "^@app/domain(|/.*)$": "/src/domain/$1" + "^test(|/.*)$": "/test/$1", + "^src(|/.*)$": "/src/$1" } } diff --git a/server/e2e/jobs/specs/library-watcher.e2e-spec.ts b/server/e2e/jobs/specs/library-watcher.e2e-spec.ts index 5f05d736bc..50d29f8ff6 100644 --- a/server/e2e/jobs/specs/library-watcher.e2e-spec.ts +++ b/server/e2e/jobs/specs/library-watcher.e2e-spec.ts @@ -1,15 +1,19 @@ -import { LibraryResponseDto, LibraryService, LoginResponseDto, StorageEventType } from '@app/domain'; -import { AssetType, LibraryType } from '@app/infra/entities'; +import { api } from 'e2e/client'; import fs from 'node:fs/promises'; import path from 'node:path'; +import { LoginResponseDto } from 'src/domain/auth/auth.dto'; +import { LibraryResponseDto } from 'src/domain/library/library.dto'; +import { LibraryService } from 'src/domain/library/library.service'; +import { StorageEventType } from 'src/domain/repositories/storage.repository'; +import { AssetType } from 'src/infra/entities/asset.entity'; +import { LibraryType } from 'src/infra/entities/library.entity'; import { IMMICH_TEST_ASSET_PATH, IMMICH_TEST_ASSET_TEMP_PATH, restoreTempFolder, testApp, waitForEvent, -} from '../../../src/test-utils/utils'; -import { api } from '../../client'; +} from 'src/test-utils/utils'; describe(`Library watcher (e2e)`, () => { let server: any; diff --git a/server/e2e/jobs/specs/library.e2e-spec.ts b/server/e2e/jobs/specs/library.e2e-spec.ts index 75411e8fac..24d7a620b6 100644 --- a/server/e2e/jobs/specs/library.e2e-spec.ts +++ b/server/e2e/jobs/specs/library.e2e-spec.ts @@ -1,17 +1,13 @@ -import { LoginResponseDto } from '@app/domain'; -import { LibraryController } from '@app/immich'; -import { LibraryType } from '@app/infra/entities'; -import { errorStub, uuidStub } from '@test/fixtures'; -import * as fs from 'node:fs'; +import { api } from 'e2e/client'; +import fs from 'node:fs'; +import { LoginResponseDto } from 'src/domain/auth/auth.dto'; +import { LibraryController } from 'src/immich/controllers/library.controller'; +import { LibraryType } from 'src/infra/entities/library.entity'; +import { IMMICH_TEST_ASSET_PATH, IMMICH_TEST_ASSET_TEMP_PATH, restoreTempFolder, testApp } from 'src/test-utils/utils'; import request from 'supertest'; +import { errorStub } from 'test/fixtures/error.stub'; +import { uuidStub } from 'test/fixtures/uuid.stub'; import { utimes } from 'utimes'; -import { - IMMICH_TEST_ASSET_PATH, - IMMICH_TEST_ASSET_TEMP_PATH, - restoreTempFolder, - testApp, -} from '../../../src/test-utils/utils'; -import { api } from '../../client'; describe(`${LibraryController.name} (e2e)`, () => { let server: any; diff --git a/server/package.json b/server/package.json index 3138db5657..5aede827bb 100644 --- a/server/package.json +++ b/server/package.json @@ -155,16 +155,14 @@ "./src/domain/": { "branches": 75, "functions": 80, - "lines": 90, - "statements": 90 + "lines": 85, + "statements": 85 } }, "testEnvironment": "node", "moduleNameMapper": { - "^@test(|/.*)$": "/test/$1", - "^@app/immich(|/.*)$": "/src/immich/$1", - "^@app/infra(|/.*)$": "/src/infra/$1", - "^@app/domain(|/.*)$": "/src/domain/$1" + "^test(|/.*)$": "/test/$1", + "^src(|/.*)$": "/src/$1" }, "globalSetup": "/test/global-setup.js" }, diff --git a/server/src/domain/access/access.core.ts b/server/src/domain/access/access.core.ts index 40b01de1da..a514128568 100644 --- a/server/src/domain/access/access.core.ts +++ b/server/src/domain/access/access.core.ts @@ -1,8 +1,8 @@ import { BadRequestException, UnauthorizedException } from '@nestjs/common'; -import { SharedLinkEntity } from '../../infra/entities'; -import { AuthDto } from '../auth'; -import { setDifference, setIsEqual, setUnion } from '../domain.util'; -import { IAccessRepository } from '../repositories'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { setDifference, setIsEqual, setUnion } from 'src/domain/domain.util'; +import { IAccessRepository } from 'src/domain/repositories/access.repository'; +import { SharedLinkEntity } from 'src/infra/entities/shared-link.entity'; export enum Permission { ACTIVITY_CREATE = 'activity.create', diff --git a/server/src/domain/access/index.ts b/server/src/domain/access/index.ts deleted file mode 100644 index 80ae0c534a..0000000000 --- a/server/src/domain/access/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './access.core'; diff --git a/server/src/domain/activity/activity.dto.ts b/server/src/domain/activity/activity.dto.ts index a5a5bd3dfd..627a06c42e 100644 --- a/server/src/domain/activity/activity.dto.ts +++ b/server/src/domain/activity/activity.dto.ts @@ -1,8 +1,8 @@ -import { ActivityEntity } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { IsEnum, IsNotEmpty, IsString, ValidateIf } from 'class-validator'; -import { Optional, ValidateUUID } from '../domain.util'; -import { UserDto, mapSimpleUser } from '../user/response-dto'; +import { Optional, ValidateUUID } from 'src/domain/domain.util'; +import { UserDto, mapSimpleUser } from 'src/domain/user/response-dto/user-response.dto'; +import { ActivityEntity } from 'src/infra/entities/activity.entity'; export enum ReactionType { COMMENT = 'comment', diff --git a/server/src/domain/activity/activity.service.ts b/server/src/domain/activity/activity.service.ts index 69386f561e..f8727141c5 100644 --- a/server/src/domain/activity/activity.service.ts +++ b/server/src/domain/activity/activity.service.ts @@ -1,8 +1,5 @@ -import { ActivityEntity } from '@app/infra/entities'; import { Inject, Injectable } from '@nestjs/common'; -import { AccessCore, Permission } from '../access'; -import { AuthDto } from '../auth'; -import { IAccessRepository, IActivityRepository } from '../repositories'; +import { AccessCore, Permission } from 'src/domain/access/access.core'; import { ActivityCreateDto, ActivityDto, @@ -13,7 +10,11 @@ import { ReactionLevel, ReactionType, mapActivity, -} from './activity.dto'; +} from 'src/domain/activity/activity.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { IAccessRepository } from 'src/domain/repositories/access.repository'; +import { IActivityRepository } from 'src/domain/repositories/activity.repository'; +import { ActivityEntity } from 'src/infra/entities/activity.entity'; @Injectable() export class ActivityService { diff --git a/server/src/domain/activity/activity.spec.ts b/server/src/domain/activity/activity.spec.ts index 10a4c07257..cd70572cad 100644 --- a/server/src/domain/activity/activity.spec.ts +++ b/server/src/domain/activity/activity.spec.ts @@ -1,10 +1,11 @@ import { BadRequestException } from '@nestjs/common'; -import { authStub, IAccessRepositoryMock, newAccessRepositoryMock } from '@test'; -import { activityStub } from '@test/fixtures/activity.stub'; -import { newActivityRepositoryMock } from '@test/repositories/activity.repository.mock'; -import { IActivityRepository } from '../repositories'; -import { ReactionType } from './activity.dto'; -import { ActivityService } from './activity.service'; +import { ReactionType } from 'src/domain/activity/activity.dto'; +import { ActivityService } from 'src/domain/activity/activity.service'; +import { IActivityRepository } from 'src/domain/repositories/activity.repository'; +import { activityStub } from 'test/fixtures/activity.stub'; +import { authStub } from 'test/fixtures/auth.stub'; +import { IAccessRepositoryMock, newAccessRepositoryMock } from 'test/repositories/access.repository.mock'; +import { newActivityRepositoryMock } from 'test/repositories/activity.repository.mock'; describe(ActivityService.name, () => { let sut: ActivityService; diff --git a/server/src/domain/activity/index.ts b/server/src/domain/activity/index.ts deleted file mode 100644 index f0d954014f..0000000000 --- a/server/src/domain/activity/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './activity.dto'; -export * from './activity.service'; diff --git a/server/src/domain/album/album-response.dto.spec.ts b/server/src/domain/album/album-response.dto.spec.ts index c8485af650..568b416b4d 100644 --- a/server/src/domain/album/album-response.dto.spec.ts +++ b/server/src/domain/album/album-response.dto.spec.ts @@ -1,5 +1,5 @@ -import { albumStub } from '@test'; -import { mapAlbum } from './album-response.dto'; +import { mapAlbum } from 'src/domain/album/album-response.dto'; +import { albumStub } from 'test/fixtures/album.stub'; describe('mapAlbum', () => { it('should set start and end dates', () => { diff --git a/server/src/domain/album/album-response.dto.ts b/server/src/domain/album/album-response.dto.ts index bcca1cd315..ab8454a493 100644 --- a/server/src/domain/album/album-response.dto.ts +++ b/server/src/domain/album/album-response.dto.ts @@ -1,9 +1,9 @@ -import { AlbumEntity, AssetOrder } from '@app/infra/entities'; -import { Optional } from '@nestjs/common'; import { ApiProperty } from '@nestjs/swagger'; -import { AssetResponseDto, mapAsset } from '../asset'; -import { AuthDto } from '../auth/auth.dto'; -import { UserResponseDto, mapUser } from '../user'; +import { AssetResponseDto, mapAsset } from 'src/domain/asset/response-dto/asset-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { Optional } from 'src/domain/domain.util'; +import { UserResponseDto, mapUser } from 'src/domain/user/response-dto/user-response.dto'; +import { AlbumEntity, AssetOrder } from 'src/infra/entities/album.entity'; export class AlbumResponseDto { id!: string; diff --git a/server/src/domain/album/album.service.spec.ts b/server/src/domain/album/album.service.spec.ts index fa0852d8cd..e8122b73cd 100644 --- a/server/src/domain/album/album.service.spec.ts +++ b/server/src/domain/album/album.service.spec.ts @@ -1,36 +1,32 @@ import { BadRequestException } from '@nestjs/common'; -import { - albumStub, - authStub, - IAccessRepositoryMock, - newAccessRepositoryMock, - newAlbumRepositoryMock, - newAssetRepositoryMock, - newJobRepositoryMock, - newUserRepositoryMock, - userStub, -} from '@test'; import _ from 'lodash'; -import { BulkIdErrorReason } from '../asset'; -import { IAlbumRepository, IAssetRepository, IJobRepository, IUserRepository } from '../repositories'; -import { AlbumService } from './album.service'; +import { AlbumService } from 'src/domain/album/album.service'; +import { BulkIdErrorReason } from 'src/domain/asset/response-dto/asset-ids-response.dto'; +import { IAlbumRepository } from 'src/domain/repositories/album.repository'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { albumStub } from 'test/fixtures/album.stub'; +import { authStub } from 'test/fixtures/auth.stub'; +import { userStub } from 'test/fixtures/user.stub'; +import { IAccessRepositoryMock, newAccessRepositoryMock } from 'test/repositories/access.repository.mock'; +import { newAlbumRepositoryMock } from 'test/repositories/album.repository.mock'; +import { newAssetRepositoryMock } from 'test/repositories/asset.repository.mock'; +import { newUserRepositoryMock } from 'test/repositories/user.repository.mock'; describe(AlbumService.name, () => { let sut: AlbumService; let accessMock: IAccessRepositoryMock; let albumMock: jest.Mocked; let assetMock: jest.Mocked; - let jobMock: jest.Mocked; let userMock: jest.Mocked; beforeEach(() => { accessMock = newAccessRepositoryMock(); albumMock = newAlbumRepositoryMock(); assetMock = newAssetRepositoryMock(); - jobMock = newJobRepositoryMock(); userMock = newUserRepositoryMock(); - sut = new AlbumService(accessMock, albumMock, assetMock, jobMock, userMock); + sut = new AlbumService(accessMock, albumMock, assetMock, userMock); }); it('should work', () => { diff --git a/server/src/domain/album/album.service.ts b/server/src/domain/album/album.service.ts index dc3d510d4b..7ba91f1d9c 100644 --- a/server/src/domain/album/album.service.ts +++ b/server/src/domain/album/album.service.ts @@ -1,26 +1,27 @@ -import { AlbumEntity, AssetEntity, UserEntity } from '@app/infra/entities'; import { BadRequestException, Inject, Injectable } from '@nestjs/common'; -import { AccessCore, Permission } from '../access'; -import { BulkIdErrorReason, BulkIdResponseDto, BulkIdsDto } from '../asset'; -import { AuthDto } from '../auth'; -import { setUnion } from '../domain.util'; -import { - AlbumAssetCount, - AlbumInfoOptions, - IAccessRepository, - IAlbumRepository, - IAssetRepository, - IJobRepository, - IUserRepository, -} from '../repositories'; +import { AccessCore, Permission } from 'src/domain/access/access.core'; import { AlbumCountResponseDto, AlbumResponseDto, mapAlbum, mapAlbumWithAssets, mapAlbumWithoutAssets, -} from './album-response.dto'; -import { AddUsersDto, AlbumInfoDto, CreateAlbumDto, GetAlbumsDto, UpdateAlbumDto } from './dto'; +} from 'src/domain/album/album-response.dto'; +import { AddUsersDto } from 'src/domain/album/dto/album-add-users.dto'; +import { CreateAlbumDto } from 'src/domain/album/dto/album-create.dto'; +import { UpdateAlbumDto } from 'src/domain/album/dto/album-update.dto'; +import { AlbumInfoDto } from 'src/domain/album/dto/album.dto'; +import { GetAlbumsDto } from 'src/domain/album/dto/get-albums.dto'; +import { BulkIdErrorReason, BulkIdResponseDto, BulkIdsDto } from 'src/domain/asset/response-dto/asset-ids-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { setUnion } from 'src/domain/domain.util'; +import { IAccessRepository } from 'src/domain/repositories/access.repository'; +import { AlbumAssetCount, AlbumInfoOptions, IAlbumRepository } from 'src/domain/repositories/album.repository'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { AlbumEntity } from 'src/infra/entities/album.entity'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { UserEntity } from 'src/infra/entities/user.entity'; @Injectable() export class AlbumService { @@ -29,7 +30,6 @@ export class AlbumService { @Inject(IAccessRepository) accessRepository: IAccessRepository, @Inject(IAlbumRepository) private albumRepository: IAlbumRepository, @Inject(IAssetRepository) private assetRepository: IAssetRepository, - @Inject(IJobRepository) private jobRepository: IJobRepository, @Inject(IUserRepository) private userRepository: IUserRepository, ) { this.access = AccessCore.create(accessRepository); diff --git a/server/src/domain/album/dto/album-add-users.dto.ts b/server/src/domain/album/dto/album-add-users.dto.ts index f238b9a054..b6a9e8be9f 100644 --- a/server/src/domain/album/dto/album-add-users.dto.ts +++ b/server/src/domain/album/dto/album-add-users.dto.ts @@ -1,5 +1,5 @@ import { ArrayNotEmpty } from 'class-validator'; -import { ValidateUUID } from '../../domain.util'; +import { ValidateUUID } from 'src/domain/domain.util'; export class AddUsersDto { @ValidateUUID({ each: true }) diff --git a/server/src/domain/album/dto/album-create.dto.ts b/server/src/domain/album/dto/album-create.dto.ts index bebbed20bd..0765e4d77e 100644 --- a/server/src/domain/album/dto/album-create.dto.ts +++ b/server/src/domain/album/dto/album-create.dto.ts @@ -1,6 +1,6 @@ import { ApiProperty } from '@nestjs/swagger'; import { IsString } from 'class-validator'; -import { Optional, ValidateUUID } from '../../domain.util'; +import { Optional, ValidateUUID } from 'src/domain/domain.util'; export class CreateAlbumDto { @IsString() diff --git a/server/src/domain/album/dto/album-update.dto.ts b/server/src/domain/album/dto/album-update.dto.ts index 4f88cefbbd..c6b21e08d0 100644 --- a/server/src/domain/album/dto/album-update.dto.ts +++ b/server/src/domain/album/dto/album-update.dto.ts @@ -1,7 +1,7 @@ -import { AssetOrder } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { IsEnum, IsString } from 'class-validator'; -import { Optional, ValidateBoolean, ValidateUUID } from '../../domain.util'; +import { Optional, ValidateBoolean, ValidateUUID } from 'src/domain/domain.util'; +import { AssetOrder } from 'src/infra/entities/album.entity'; export class UpdateAlbumDto { @Optional() diff --git a/server/src/domain/album/dto/album.dto.ts b/server/src/domain/album/dto/album.dto.ts index b7aad98b5c..f1772b4c2e 100644 --- a/server/src/domain/album/dto/album.dto.ts +++ b/server/src/domain/album/dto/album.dto.ts @@ -1,4 +1,4 @@ -import { ValidateBoolean } from '../../domain.util'; +import { ValidateBoolean } from 'src/domain/domain.util'; export class AlbumInfoDto { @ValidateBoolean({ optional: true }) diff --git a/server/src/domain/album/dto/get-albums.dto.ts b/server/src/domain/album/dto/get-albums.dto.ts index 2628a3fc72..e03c219aa4 100644 --- a/server/src/domain/album/dto/get-albums.dto.ts +++ b/server/src/domain/album/dto/get-albums.dto.ts @@ -1,4 +1,4 @@ -import { ValidateBoolean, ValidateUUID } from '../../domain.util'; +import { ValidateBoolean, ValidateUUID } from 'src/domain/domain.util'; export class GetAlbumsDto { @ValidateBoolean({ optional: true }) diff --git a/server/src/domain/album/dto/index.ts b/server/src/domain/album/dto/index.ts deleted file mode 100644 index b1a4c2141b..0000000000 --- a/server/src/domain/album/dto/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './album-add-users.dto'; -export * from './album-create.dto'; -export * from './album-update.dto'; -export * from './album.dto'; -export * from './get-albums.dto'; diff --git a/server/src/domain/album/index.ts b/server/src/domain/album/index.ts deleted file mode 100644 index f06f6d33c8..0000000000 --- a/server/src/domain/album/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './album-response.dto'; -export * from './album.service'; -export * from './dto'; diff --git a/server/src/domain/api-key/api-key.dto.ts b/server/src/domain/api-key/api-key.dto.ts index c25ef5fd49..19099ba18c 100644 --- a/server/src/domain/api-key/api-key.dto.ts +++ b/server/src/domain/api-key/api-key.dto.ts @@ -1,5 +1,5 @@ import { IsNotEmpty, IsString } from 'class-validator'; -import { Optional } from '../domain.util'; +import { Optional } from 'src/domain/domain.util'; export class APIKeyCreateDto { @IsString() @IsNotEmpty() diff --git a/server/src/domain/api-key/api-key.service.spec.ts b/server/src/domain/api-key/api-key.service.spec.ts index f3b2910845..e50d0d9b33 100644 --- a/server/src/domain/api-key/api-key.service.spec.ts +++ b/server/src/domain/api-key/api-key.service.spec.ts @@ -1,7 +1,11 @@ import { BadRequestException } from '@nestjs/common'; -import { authStub, keyStub, newCryptoRepositoryMock, newKeyRepositoryMock } from '@test'; -import { ICryptoRepository, IKeyRepository } from '../repositories'; -import { APIKeyService } from './api-key.service'; +import { APIKeyService } from 'src/domain/api-key/api-key.service'; +import { IKeyRepository } from 'src/domain/repositories/api-key.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { keyStub } from 'test/fixtures/api-key.stub'; +import { authStub } from 'test/fixtures/auth.stub'; +import { newKeyRepositoryMock } from 'test/repositories/api-key.repository.mock'; +import { newCryptoRepositoryMock } from 'test/repositories/crypto.repository.mock'; describe(APIKeyService.name, () => { let sut: APIKeyService; diff --git a/server/src/domain/api-key/api-key.service.ts b/server/src/domain/api-key/api-key.service.ts index 0eef1981ce..5a531e9d5a 100644 --- a/server/src/domain/api-key/api-key.service.ts +++ b/server/src/domain/api-key/api-key.service.ts @@ -1,8 +1,9 @@ -import { APIKeyEntity } from '@app/infra/entities'; import { BadRequestException, Inject, Injectable } from '@nestjs/common'; -import { AuthDto } from '../auth'; -import { ICryptoRepository, IKeyRepository } from '../repositories'; -import { APIKeyCreateDto, APIKeyCreateResponseDto, APIKeyResponseDto } from './api-key.dto'; +import { APIKeyCreateDto, APIKeyCreateResponseDto, APIKeyResponseDto } from 'src/domain/api-key/api-key.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { IKeyRepository } from 'src/domain/repositories/api-key.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { APIKeyEntity } from 'src/infra/entities/api-key.entity'; @Injectable() export class APIKeyService { diff --git a/server/src/domain/api-key/index.ts b/server/src/domain/api-key/index.ts deleted file mode 100644 index 94076f2a35..0000000000 --- a/server/src/domain/api-key/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './api-key.dto'; -export * from './api-key.service'; diff --git a/server/src/domain/asset/asset.service.spec.ts b/server/src/domain/asset/asset.service.spec.ts index 11d2ed00b9..fdf89739f2 100644 --- a/server/src/domain/asset/asset.service.spec.ts +++ b/server/src/domain/asset/asset.service.spec.ts @@ -1,42 +1,33 @@ -import { AssetEntity, AssetType } from '@app/infra/entities'; import { BadRequestException, UnauthorizedException } from '@nestjs/common'; -import { - IAccessRepositoryMock, - assetStackStub, - assetStub, - authStub, - faceStub, - newAccessRepositoryMock, - newAssetRepositoryMock, - newAssetStackRepositoryMock, - newCommunicationRepositoryMock, - newJobRepositoryMock, - newPartnerRepositoryMock, - newStorageRepositoryMock, - newSystemConfigRepositoryMock, - newUserRepositoryMock, - partnerStub, - userStub, -} from '@test'; import { when } from 'jest-when'; -import { JobName } from '../job'; -import { - AssetStats, - ClientEvent, - IAssetRepository, - IAssetStackRepository, - ICommunicationRepository, - IJobRepository, - IPartnerRepository, - IStorageRepository, - ISystemConfigRepository, - IUserRepository, - JobItem, - TimeBucketSize, -} from '../repositories'; -import { AssetService, UploadFieldName } from './asset.service'; -import { AssetJobName, AssetStatsResponseDto } from './dto'; -import { mapAsset } from './response-dto'; +import { AssetService, UploadFieldName } from 'src/domain/asset/asset.service'; +import { AssetJobName } from 'src/domain/asset/dto/asset-ids.dto'; +import { AssetStatsResponseDto } from 'src/domain/asset/dto/asset-statistics.dto'; +import { mapAsset } from 'src/domain/asset/response-dto/asset-response.dto'; +import { JobName } from 'src/domain/job/job.constants'; +import { IAssetStackRepository } from 'src/domain/repositories/asset-stack.repository'; +import { AssetStats, IAssetRepository, TimeBucketSize } from 'src/domain/repositories/asset.repository'; +import { ClientEvent, ICommunicationRepository } from 'src/domain/repositories/communication.repository'; +import { IJobRepository, JobItem } from 'src/domain/repositories/job.repository'; +import { IPartnerRepository } from 'src/domain/repositories/partner.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { AssetEntity, AssetType } from 'src/infra/entities/asset.entity'; +import { assetStackStub, assetStub } from 'test/fixtures/asset.stub'; +import { authStub } from 'test/fixtures/auth.stub'; +import { faceStub } from 'test/fixtures/face.stub'; +import { partnerStub } from 'test/fixtures/partner.stub'; +import { userStub } from 'test/fixtures/user.stub'; +import { IAccessRepositoryMock, newAccessRepositoryMock } from 'test/repositories/access.repository.mock'; +import { newAssetStackRepositoryMock } from 'test/repositories/asset-stack.repository.mock'; +import { newAssetRepositoryMock } from 'test/repositories/asset.repository.mock'; +import { newCommunicationRepositoryMock } from 'test/repositories/communication.repository.mock'; +import { newJobRepositoryMock } from 'test/repositories/job.repository.mock'; +import { newPartnerRepositoryMock } from 'test/repositories/partner.repository.mock'; +import { newStorageRepositoryMock } from 'test/repositories/storage.repository.mock'; +import { newSystemConfigRepositoryMock } from 'test/repositories/system-config.repository.mock'; +import { newUserRepositoryMock } from 'test/repositories/user.repository.mock'; const stats: AssetStats = { [AssetType.IMAGE]: 10, diff --git a/server/src/domain/asset/asset.service.ts b/server/src/domain/asset/asset.service.ts index fbe4e91bd1..3d78c8c7be 100644 --- a/server/src/domain/asset/asset.service.ts +++ b/server/src/domain/asset/asset.service.ts @@ -1,54 +1,43 @@ -import { AssetEntity, LibraryType } from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; import { BadRequestException, Inject } from '@nestjs/common'; import _ from 'lodash'; import { DateTime, Duration } from 'luxon'; import { extname } from 'node:path'; import sanitize from 'sanitize-filename'; -import { AccessCore, Permission } from '../access'; -import { AuthDto } from '../auth'; -import { mimeTypes } from '../domain.constant'; -import { usePagination } from '../domain.util'; -import { IAssetDeletionJob, ISidecarWriteJob, JOBS_ASSET_PAGINATION_SIZE, JobName } from '../job'; -import { - ClientEvent, - IAccessRepository, - IAssetRepository, - IAssetStackRepository, - ICommunicationRepository, - IJobRepository, - IPartnerRepository, - IStorageRepository, - ISystemConfigRepository, - IUserRepository, - JobItem, - JobStatus, - TimeBucketOptions, -} from '../repositories'; -import { StorageCore, StorageFolder } from '../storage'; -import { SystemConfigCore } from '../system-config'; -import { - AssetBulkDeleteDto, - AssetBulkUpdateDto, - AssetJobName, - AssetJobsDto, - AssetStatsDto, - MapMarkerDto, - MemoryLaneDto, - TimeBucketAssetDto, - TimeBucketDto, - UpdateAssetDto, - UpdateStackParentDto, - mapStats, -} from './dto'; +import { AccessCore, Permission } from 'src/domain/access/access.core'; +import { AssetJobName, AssetJobsDto } from 'src/domain/asset/dto/asset-ids.dto'; +import { UpdateStackParentDto } from 'src/domain/asset/dto/asset-stack.dto'; +import { AssetStatsDto, mapStats } from 'src/domain/asset/dto/asset-statistics.dto'; +import { AssetBulkDeleteDto, AssetBulkUpdateDto, UpdateAssetDto } from 'src/domain/asset/dto/asset.dto'; +import { MapMarkerDto } from 'src/domain/asset/dto/map-marker.dto'; +import { MemoryLaneDto } from 'src/domain/asset/dto/memory-lane.dto'; +import { TimeBucketAssetDto, TimeBucketDto } from 'src/domain/asset/dto/time-bucket.dto'; import { AssetResponseDto, - MapMarkerResponseDto, MemoryLaneResponseDto, SanitizedAssetResponseDto, - TimeBucketResponseDto, mapAsset, -} from './response-dto'; +} from 'src/domain/asset/response-dto/asset-response.dto'; +import { MapMarkerResponseDto } from 'src/domain/asset/response-dto/map-marker-response.dto'; +import { TimeBucketResponseDto } from 'src/domain/asset/response-dto/time-bucket-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { mimeTypes } from 'src/domain/domain.constant'; +import { usePagination } from 'src/domain/domain.util'; +import { JOBS_ASSET_PAGINATION_SIZE, JobName } from 'src/domain/job/job.constants'; +import { IAssetDeletionJob, ISidecarWriteJob } from 'src/domain/job/job.interface'; +import { IAccessRepository } from 'src/domain/repositories/access.repository'; +import { IAssetStackRepository } from 'src/domain/repositories/asset-stack.repository'; +import { IAssetRepository, TimeBucketOptions } from 'src/domain/repositories/asset.repository'; +import { ClientEvent, ICommunicationRepository } from 'src/domain/repositories/communication.repository'; +import { IJobRepository, JobItem, JobStatus } from 'src/domain/repositories/job.repository'; +import { IPartnerRepository } from 'src/domain/repositories/partner.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { StorageCore, StorageFolder } from 'src/domain/storage/storage.core'; +import { SystemConfigCore } from 'src/domain/system-config/system-config.core'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { LibraryType } from 'src/infra/entities/library.entity'; +import { ImmichLogger } from 'src/infra/logger'; export enum UploadFieldName { ASSET_DATA = 'assetData', diff --git a/server/src/domain/asset/dto/asset-ids.dto.ts b/server/src/domain/asset/dto/asset-ids.dto.ts index 5ee988bb44..ae236f13db 100644 --- a/server/src/domain/asset/dto/asset-ids.dto.ts +++ b/server/src/domain/asset/dto/asset-ids.dto.ts @@ -1,6 +1,6 @@ import { ApiProperty } from '@nestjs/swagger'; import { IsEnum } from 'class-validator'; -import { ValidateUUID } from '../../domain.util'; +import { ValidateUUID } from 'src/domain/domain.util'; export class AssetIdsDto { @ValidateUUID({ each: true }) diff --git a/server/src/domain/asset/dto/asset-stack.dto.ts b/server/src/domain/asset/dto/asset-stack.dto.ts index 80dabdb34b..e05bf6a0b2 100644 --- a/server/src/domain/asset/dto/asset-stack.dto.ts +++ b/server/src/domain/asset/dto/asset-stack.dto.ts @@ -1,4 +1,4 @@ -import { ValidateUUID } from '../../domain.util'; +import { ValidateUUID } from 'src/domain/domain.util'; export class UpdateStackParentDto { @ValidateUUID() diff --git a/server/src/domain/asset/dto/asset-statistics.dto.ts b/server/src/domain/asset/dto/asset-statistics.dto.ts index c313ccdf47..9d935789ac 100644 --- a/server/src/domain/asset/dto/asset-statistics.dto.ts +++ b/server/src/domain/asset/dto/asset-statistics.dto.ts @@ -1,7 +1,7 @@ -import { AssetType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; -import { ValidateBoolean } from '../../domain.util'; -import { AssetStats } from '../../repositories'; +import { ValidateBoolean } from 'src/domain/domain.util'; +import { AssetStats } from 'src/domain/repositories/asset.repository'; +import { AssetType } from 'src/infra/entities/asset.entity'; export class AssetStatsDto { @ValidateBoolean({ optional: true }) diff --git a/server/src/domain/asset/dto/asset.dto.ts b/server/src/domain/asset/dto/asset.dto.ts index 2abe31d0ad..31eaa916e8 100644 --- a/server/src/domain/asset/dto/asset.dto.ts +++ b/server/src/domain/asset/dto/asset.dto.ts @@ -9,8 +9,8 @@ import { IsString, ValidateIf, } from 'class-validator'; -import { Optional, ValidateBoolean, ValidateUUID } from '../../domain.util'; -import { BulkIdsDto } from '../response-dto'; +import { BulkIdsDto } from 'src/domain/asset/response-dto/asset-ids-response.dto'; +import { Optional, ValidateBoolean, ValidateUUID } from 'src/domain/domain.util'; export class DeviceIdDto { @IsNotEmpty() diff --git a/server/src/domain/asset/dto/index.ts b/server/src/domain/asset/dto/index.ts deleted file mode 100644 index bc7a100b94..0000000000 --- a/server/src/domain/asset/dto/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './asset-ids.dto'; -export * from './asset-stack.dto'; -export * from './asset-statistics.dto'; -export * from './asset.dto'; -export * from './map-marker.dto'; -export * from './memory-lane.dto'; -export * from './time-bucket.dto'; diff --git a/server/src/domain/asset/dto/map-marker.dto.ts b/server/src/domain/asset/dto/map-marker.dto.ts index 4fe6c16b84..f06dc201e2 100644 --- a/server/src/domain/asset/dto/map-marker.dto.ts +++ b/server/src/domain/asset/dto/map-marker.dto.ts @@ -1,4 +1,4 @@ -import { ValidateBoolean, ValidateDate } from '../../domain.util'; +import { ValidateBoolean, ValidateDate } from 'src/domain/domain.util'; export class MapMarkerDto { @ValidateBoolean({ optional: true }) diff --git a/server/src/domain/asset/dto/time-bucket.dto.ts b/server/src/domain/asset/dto/time-bucket.dto.ts index 7c5b9c212b..052e3732e2 100644 --- a/server/src/domain/asset/dto/time-bucket.dto.ts +++ b/server/src/domain/asset/dto/time-bucket.dto.ts @@ -1,8 +1,8 @@ -import { AssetOrder } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { IsEnum, IsNotEmpty, IsString } from 'class-validator'; -import { Optional, ValidateBoolean, ValidateUUID } from '../../domain.util'; -import { TimeBucketSize } from '../../repositories'; +import { Optional, ValidateBoolean, ValidateUUID } from 'src/domain/domain.util'; +import { TimeBucketSize } from 'src/domain/repositories/asset.repository'; +import { AssetOrder } from 'src/infra/entities/album.entity'; export class TimeBucketDto { @IsNotEmpty() diff --git a/server/src/domain/asset/index.ts b/server/src/domain/asset/index.ts deleted file mode 100644 index 71ad3c8c48..0000000000 --- a/server/src/domain/asset/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './asset.service'; -export * from './dto'; -export * from './response-dto'; diff --git a/server/src/domain/asset/response-dto/asset-ids-response.dto.ts b/server/src/domain/asset/response-dto/asset-ids-response.dto.ts index 9bb6a5b368..3a7e8129a4 100644 --- a/server/src/domain/asset/response-dto/asset-ids-response.dto.ts +++ b/server/src/domain/asset/response-dto/asset-ids-response.dto.ts @@ -1,4 +1,4 @@ -import { ValidateUUID } from '../../domain.util'; +import { ValidateUUID } from 'src/domain/domain.util'; /** @deprecated Use `BulkIdResponseDto` instead */ export enum AssetIdErrorReason { diff --git a/server/src/domain/asset/response-dto/asset-response.dto.ts b/server/src/domain/asset/response-dto/asset-response.dto.ts index 2961a9dcc7..a5c88b4cb2 100644 --- a/server/src/domain/asset/response-dto/asset-response.dto.ts +++ b/server/src/domain/asset/response-dto/asset-response.dto.ts @@ -1,11 +1,12 @@ -import { AuthDto } from '@app/domain/auth/auth.dto'; -import { AssetEntity, AssetFaceEntity, AssetType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; -import { PersonWithFacesResponseDto, mapFacesWithoutPerson, mapPerson } from '../../person/person.dto'; -import { TagResponseDto, mapTag } from '../../tag'; -import { UserResponseDto, mapUser } from '../../user/response-dto/user-response.dto'; -import { ExifResponseDto, mapExif } from './exif-response.dto'; -import { SmartInfoResponseDto, mapSmartInfo } from './smart-info-response.dto'; +import { ExifResponseDto, mapExif } from 'src/domain/asset/response-dto/exif-response.dto'; +import { SmartInfoResponseDto, mapSmartInfo } from 'src/domain/asset/response-dto/smart-info-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { PersonWithFacesResponseDto, mapFacesWithoutPerson, mapPerson } from 'src/domain/person/person.dto'; +import { TagResponseDto, mapTag } from 'src/domain/tag/tag-response.dto'; +import { UserResponseDto, mapUser } from 'src/domain/user/response-dto/user-response.dto'; +import { AssetFaceEntity } from 'src/infra/entities/asset-face.entity'; +import { AssetEntity, AssetType } from 'src/infra/entities/asset.entity'; export class SanitizedAssetResponseDto { id!: string; diff --git a/server/src/domain/asset/response-dto/exif-response.dto.ts b/server/src/domain/asset/response-dto/exif-response.dto.ts index f4d0226b47..fbef6cbbce 100644 --- a/server/src/domain/asset/response-dto/exif-response.dto.ts +++ b/server/src/domain/asset/response-dto/exif-response.dto.ts @@ -1,5 +1,5 @@ -import { ExifEntity } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; +import { ExifEntity } from 'src/infra/entities/exif.entity'; export class ExifResponseDto { make?: string | null = null; diff --git a/server/src/domain/asset/response-dto/index.ts b/server/src/domain/asset/response-dto/index.ts deleted file mode 100644 index 7ed99db130..0000000000 --- a/server/src/domain/asset/response-dto/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './asset-ids-response.dto'; -export * from './asset-response.dto'; -export * from './exif-response.dto'; -export * from './map-marker-response.dto'; -export * from './smart-info-response.dto'; -export * from './time-bucket-response.dto'; diff --git a/server/src/domain/asset/response-dto/smart-info-response.dto.ts b/server/src/domain/asset/response-dto/smart-info-response.dto.ts index 72c336205d..840fca8a7f 100644 --- a/server/src/domain/asset/response-dto/smart-info-response.dto.ts +++ b/server/src/domain/asset/response-dto/smart-info-response.dto.ts @@ -1,4 +1,4 @@ -import { SmartInfoEntity } from '@app/infra/entities'; +import { SmartInfoEntity } from 'src/infra/entities/smart-info.entity'; export class SmartInfoResponseDto { tags?: string[] | null; diff --git a/server/src/domain/audit/audit.dto.ts b/server/src/domain/audit/audit.dto.ts index 0f3f04dab2..131ce147b2 100644 --- a/server/src/domain/audit/audit.dto.ts +++ b/server/src/domain/audit/audit.dto.ts @@ -1,8 +1,9 @@ -import { AssetPathType, EntityType, PathType, PersonPathType, UserPathType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { Type } from 'class-transformer'; import { IsArray, IsEnum, IsString, IsUUID, ValidateNested } from 'class-validator'; -import { Optional, ValidateDate, ValidateUUID } from '../domain.util'; +import { Optional, ValidateDate, ValidateUUID } from 'src/domain/domain.util'; +import { EntityType } from 'src/infra/entities/audit.entity'; +import { AssetPathType, PathType, PersonPathType, UserPathType } from 'src/infra/entities/move.entity'; const PathEnum = Object.values({ ...AssetPathType, ...PersonPathType, ...UserPathType }); diff --git a/server/src/domain/audit/audit.service.spec.ts b/server/src/domain/audit/audit.service.spec.ts index 82c6cc699e..b8a4d2b2bd 100644 --- a/server/src/domain/audit/audit.service.spec.ts +++ b/server/src/domain/audit/audit.service.spec.ts @@ -1,26 +1,21 @@ -import { DatabaseAction, EntityType } from '@app/infra/entities'; -import { - IAccessRepositoryMock, - auditStub, - authStub, - newAccessRepositoryMock, - newAssetRepositoryMock, - newAuditRepositoryMock, - newCryptoRepositoryMock, - newPersonRepositoryMock, - newStorageRepositoryMock, - newUserRepositoryMock, -} from '@test'; -import { - IAssetRepository, - IAuditRepository, - ICryptoRepository, - IPersonRepository, - IStorageRepository, - IUserRepository, - JobStatus, -} from '../repositories'; -import { AuditService } from './audit.service'; +import { AuditService } from 'src/domain/audit/audit.service'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { IAuditRepository } from 'src/domain/repositories/audit.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { JobStatus } from 'src/domain/repositories/job.repository'; +import { IPersonRepository } from 'src/domain/repositories/person.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { DatabaseAction, EntityType } from 'src/infra/entities/audit.entity'; +import { auditStub } from 'test/fixtures/audit.stub'; +import { authStub } from 'test/fixtures/auth.stub'; +import { IAccessRepositoryMock, newAccessRepositoryMock } from 'test/repositories/access.repository.mock'; +import { newAssetRepositoryMock } from 'test/repositories/asset.repository.mock'; +import { newAuditRepositoryMock } from 'test/repositories/audit.repository.mock'; +import { newCryptoRepositoryMock } from 'test/repositories/crypto.repository.mock'; +import { newPersonRepositoryMock } from 'test/repositories/person.repository.mock'; +import { newStorageRepositoryMock } from 'test/repositories/storage.repository.mock'; +import { newUserRepositoryMock } from 'test/repositories/user.repository.mock'; describe(AuditService.name, () => { let sut: AuditService; diff --git a/server/src/domain/audit/audit.service.ts b/server/src/domain/audit/audit.service.ts index c96f36d740..0bcb2ed15d 100644 --- a/server/src/domain/audit/audit.service.ts +++ b/server/src/domain/audit/audit.service.ts @@ -1,24 +1,7 @@ -import { AssetPathType, DatabaseAction, PersonPathType, UserPathType } from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; import { BadRequestException, Inject, Injectable } from '@nestjs/common'; import { DateTime } from 'luxon'; import { resolve } from 'node:path'; -import { AccessCore, Permission } from '../access'; -import { AuthDto } from '../auth'; -import { AUDIT_LOG_MAX_DURATION } from '../domain.constant'; -import { usePagination } from '../domain.util'; -import { JOBS_ASSET_PAGINATION_SIZE } from '../job'; -import { - IAccessRepository, - IAssetRepository, - IAuditRepository, - ICryptoRepository, - IPersonRepository, - IStorageRepository, - IUserRepository, - JobStatus, -} from '../repositories'; -import { StorageCore, StorageFolder } from '../storage'; +import { AccessCore, Permission } from 'src/domain/access/access.core'; import { AuditDeletesDto, AuditDeletesResponseDto, @@ -26,7 +9,23 @@ import { FileChecksumResponseDto, FileReportItemDto, PathEntityType, -} from './audit.dto'; +} from 'src/domain/audit/audit.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { AUDIT_LOG_MAX_DURATION } from 'src/domain/domain.constant'; +import { usePagination } from 'src/domain/domain.util'; +import { JOBS_ASSET_PAGINATION_SIZE } from 'src/domain/job/job.constants'; +import { IAccessRepository } from 'src/domain/repositories/access.repository'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { IAuditRepository } from 'src/domain/repositories/audit.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { JobStatus } from 'src/domain/repositories/job.repository'; +import { IPersonRepository } from 'src/domain/repositories/person.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { StorageCore, StorageFolder } from 'src/domain/storage/storage.core'; +import { DatabaseAction } from 'src/infra/entities/audit.entity'; +import { AssetPathType, PersonPathType, UserPathType } from 'src/infra/entities/move.entity'; +import { ImmichLogger } from 'src/infra/logger'; @Injectable() export class AuditService { diff --git a/server/src/domain/audit/index.ts b/server/src/domain/audit/index.ts deleted file mode 100644 index febebf0f64..0000000000 --- a/server/src/domain/audit/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './audit.dto'; -export * from './audit.service'; diff --git a/server/src/domain/auth/auth.dto.ts b/server/src/domain/auth/auth.dto.ts index 2f6f4b4b72..1694231abf 100644 --- a/server/src/domain/auth/auth.dto.ts +++ b/server/src/domain/auth/auth.dto.ts @@ -1,7 +1,10 @@ -import { APIKeyEntity, SharedLinkEntity, UserEntity, UserTokenEntity } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { Transform } from 'class-transformer'; import { IsEmail, IsNotEmpty, IsString, MinLength } from 'class-validator'; +import { APIKeyEntity } from 'src/infra/entities/api-key.entity'; +import { SharedLinkEntity } from 'src/infra/entities/shared-link.entity'; +import { UserTokenEntity } from 'src/infra/entities/user-token.entity'; +import { UserEntity } from 'src/infra/entities/user.entity'; export class AuthDto { user!: UserEntity; diff --git a/server/src/domain/auth/auth.service.spec.ts b/server/src/domain/auth/auth.service.spec.ts index 214b6748e3..37941aa44c 100644 --- a/server/src/domain/auth/auth.service.spec.ts +++ b/server/src/domain/auth/auth.service.spec.ts @@ -1,38 +1,32 @@ -import { UserEntity } from '@app/infra/entities'; import { BadRequestException, UnauthorizedException } from '@nestjs/common'; -import { - IAccessRepositoryMock, - authStub, - keyStub, - loginResponseStub, - newAccessRepositoryMock, - newCryptoRepositoryMock, - newKeyRepositoryMock, - newLibraryRepositoryMock, - newSharedLinkRepositoryMock, - newSystemConfigRepositoryMock, - newUserRepositoryMock, - newUserTokenRepositoryMock, - sharedLinkStub, - systemConfigStub, - userStub, - userTokenStub, -} from '@test'; import { IncomingHttpHeaders } from 'node:http'; import { Issuer, generators } from 'openid-client'; import { Socket } from 'socket.io'; -import { - ICryptoRepository, - IKeyRepository, - ILibraryRepository, - ISharedLinkRepository, - ISystemConfigRepository, - IUserRepository, - IUserTokenRepository, -} from '../repositories'; -import { AuthType } from './auth.constant'; -import { AuthDto, SignUpDto } from './auth.dto'; -import { AuthService } from './auth.service'; +import { AuthType } from 'src/domain/auth/auth.constant'; +import { AuthDto, SignUpDto } from 'src/domain/auth/auth.dto'; +import { AuthService } from 'src/domain/auth/auth.service'; +import { IKeyRepository } from 'src/domain/repositories/api-key.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { ILibraryRepository } from 'src/domain/repositories/library.repository'; +import { ISharedLinkRepository } from 'src/domain/repositories/shared-link.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { IUserTokenRepository } from 'src/domain/repositories/user-token.repository'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { UserEntity } from 'src/infra/entities/user.entity'; +import { keyStub } from 'test/fixtures/api-key.stub'; +import { authStub, loginResponseStub } from 'test/fixtures/auth.stub'; +import { sharedLinkStub } from 'test/fixtures/shared-link.stub'; +import { systemConfigStub } from 'test/fixtures/system-config.stub'; +import { userTokenStub } from 'test/fixtures/user-token.stub'; +import { userStub } from 'test/fixtures/user.stub'; +import { IAccessRepositoryMock, newAccessRepositoryMock } from 'test/repositories/access.repository.mock'; +import { newKeyRepositoryMock } from 'test/repositories/api-key.repository.mock'; +import { newCryptoRepositoryMock } from 'test/repositories/crypto.repository.mock'; +import { newLibraryRepositoryMock } from 'test/repositories/library.repository.mock'; +import { newSharedLinkRepositoryMock } from 'test/repositories/shared-link.repository.mock'; +import { newSystemConfigRepositoryMock } from 'test/repositories/system-config.repository.mock'; +import { newUserTokenRepositoryMock } from 'test/repositories/user-token.repository.mock'; +import { newUserRepositoryMock } from 'test/repositories/user.repository.mock'; // const token = Buffer.from('my-api-key', 'utf8').toString('base64'); diff --git a/server/src/domain/auth/auth.service.ts b/server/src/domain/auth/auth.service.ts index fe01ef39b6..bb01e1b3b9 100644 --- a/server/src/domain/auth/auth.service.ts +++ b/server/src/domain/auth/auth.service.ts @@ -1,5 +1,3 @@ -import { SystemConfig, UserEntity } from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; import { BadRequestException, Inject, @@ -12,20 +10,7 @@ import cookieParser from 'cookie'; import { DateTime } from 'luxon'; import { IncomingHttpHeaders } from 'node:http'; import { ClientMetadata, Issuer, UserinfoResponse, custom, generators } from 'openid-client'; -import { AccessCore, Permission } from '../access'; -import { HumanReadableSize } from '../domain.util'; -import { - IAccessRepository, - ICryptoRepository, - IKeyRepository, - ILibraryRepository, - ISharedLinkRepository, - ISystemConfigRepository, - IUserRepository, - IUserTokenRepository, -} from '../repositories'; -import { SystemConfigCore } from '../system-config/system-config.core'; -import { UserCore, UserResponseDto, mapUser } from '../user'; +import { AccessCore, Permission } from 'src/domain/access/access.core'; import { AuthType, IMMICH_ACCESS_COOKIE, @@ -34,7 +19,7 @@ import { IMMICH_IS_AUTHENTICATED, LOGIN_URL, MOBILE_REDIRECT, -} from './auth.constant'; +} from 'src/domain/auth/auth.constant'; import { AuthDeviceResponseDto, AuthDto, @@ -48,7 +33,22 @@ import { SignUpDto, mapLoginResponse, mapUserToken, -} from './auth.dto'; +} from 'src/domain/auth/auth.dto'; +import { HumanReadableSize } from 'src/domain/domain.util'; +import { IAccessRepository } from 'src/domain/repositories/access.repository'; +import { IKeyRepository } from 'src/domain/repositories/api-key.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { ILibraryRepository } from 'src/domain/repositories/library.repository'; +import { ISharedLinkRepository } from 'src/domain/repositories/shared-link.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { IUserTokenRepository } from 'src/domain/repositories/user-token.repository'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { SystemConfigCore } from 'src/domain/system-config/system-config.core'; +import { UserResponseDto, mapUser } from 'src/domain/user/response-dto/user-response.dto'; +import { UserCore } from 'src/domain/user/user.core'; +import { SystemConfig } from 'src/infra/entities/system-config.entity'; +import { UserEntity } from 'src/infra/entities/user.entity'; +import { ImmichLogger } from 'src/infra/logger'; export interface LoginDetails { isSecure: boolean; diff --git a/server/src/domain/auth/index.ts b/server/src/domain/auth/index.ts deleted file mode 100644 index 52e0463bcb..0000000000 --- a/server/src/domain/auth/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './auth.constant'; -export * from './auth.dto'; -export * from './auth.service'; diff --git a/server/src/domain/database/database.service.spec.ts b/server/src/domain/database/database.service.spec.ts index 14464c0cd1..25ebe61afb 100644 --- a/server/src/domain/database/database.service.spec.ts +++ b/server/src/domain/database/database.service.spec.ts @@ -1,13 +1,8 @@ -import { - DatabaseExtension, - DatabaseService, - IDatabaseRepository, - VectorIndex, - Version, - VersionType, -} from '@app/domain'; -import { ImmichLogger } from '@app/infra/logger'; -import { newDatabaseRepositoryMock } from '@test'; +import { DatabaseService } from 'src/domain/database/database.service'; +import { Version, VersionType } from 'src/domain/domain.constant'; +import { DatabaseExtension, IDatabaseRepository, VectorIndex } from 'src/domain/repositories/database.repository'; +import { ImmichLogger } from 'src/infra/logger'; +import { newDatabaseRepositoryMock } from 'test/repositories/database.repository.mock'; describe(DatabaseService.name, () => { let sut: DatabaseService; diff --git a/server/src/domain/database/database.service.ts b/server/src/domain/database/database.service.ts index 946c6dac82..6e6ef98aa6 100644 --- a/server/src/domain/database/database.service.ts +++ b/server/src/domain/database/database.service.ts @@ -1,6 +1,5 @@ -import { ImmichLogger } from '@app/infra/logger'; import { Inject, Injectable } from '@nestjs/common'; -import { Version, VersionType } from '../domain.constant'; +import { Version, VersionType } from 'src/domain/domain.constant'; import { DatabaseExtension, DatabaseLock, @@ -8,7 +7,8 @@ import { VectorExtension, VectorIndex, extName, -} from '../repositories'; +} from 'src/domain/repositories/database.repository'; +import { ImmichLogger } from 'src/infra/logger'; @Injectable() export class DatabaseService { diff --git a/server/src/domain/database/index.ts b/server/src/domain/database/index.ts deleted file mode 100644 index cd4e1d2177..0000000000 --- a/server/src/domain/database/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './database.service'; diff --git a/server/src/domain/domain.config.ts b/server/src/domain/domain.config.ts index b0471080d1..40580b8e4c 100644 --- a/server/src/domain/domain.config.ts +++ b/server/src/domain/domain.config.ts @@ -1,7 +1,7 @@ // TODO: remove nestjs references from domain -import { LogLevel } from '@app/infra/entities'; import { ConfigModuleOptions } from '@nestjs/config'; import Joi from 'joi'; +import { LogLevel } from 'src/infra/entities/system-config.entity'; const WHEN_DB_URL_SET = Joi.when('DB_URL', { is: Joi.exist(), diff --git a/server/src/domain/domain.constant.spec.ts b/server/src/domain/domain.constant.spec.ts index 70944328e4..e8a1c7b728 100644 --- a/server/src/domain/domain.constant.spec.ts +++ b/server/src/domain/domain.constant.spec.ts @@ -1,4 +1,4 @@ -import { Version, VersionType, mimeTypes } from './domain.constant'; +import { mimeTypes, Version, VersionType } from 'src/domain/domain.constant'; describe('mimeTypes', () => { for (const { mimetype, extension } of [ diff --git a/server/src/domain/domain.constant.ts b/server/src/domain/domain.constant.ts index 56b455855e..13c8fa5322 100644 --- a/server/src/domain/domain.constant.ts +++ b/server/src/domain/domain.constant.ts @@ -1,7 +1,7 @@ -import { AssetType } from '@app/infra/entities'; import { Duration } from 'luxon'; import { readFileSync } from 'node:fs'; import { extname, join } from 'node:path'; +import { AssetType } from 'src/infra/entities/asset.entity'; export const AUDIT_LOG_MAX_DURATION = Duration.fromObject({ days: 100 }); export const ONE_HOUR = Duration.fromObject({ hours: 1 }); diff --git a/server/src/domain/domain.module.ts b/server/src/domain/domain.module.ts index c3e62edb55..04d7c51f44 100644 --- a/server/src/domain/domain.module.ts +++ b/server/src/domain/domain.module.ts @@ -1,29 +1,29 @@ -import { ImmichLogger } from '@app/infra/logger'; import { Global, Module, Provider } from '@nestjs/common'; -import { ActivityService } from './activity'; -import { AlbumService } from './album'; -import { APIKeyService } from './api-key'; -import { AssetService } from './asset'; -import { AuditService } from './audit'; -import { AuthService } from './auth'; -import { DatabaseService } from './database'; -import { DownloadService } from './download'; -import { JobService } from './job'; -import { LibraryService } from './library'; -import { MediaService } from './media'; -import { MetadataService } from './metadata'; -import { PartnerService } from './partner'; -import { PersonService } from './person'; -import { SearchService } from './search'; -import { ServerInfoService } from './server-info'; -import { SharedLinkService } from './shared-link'; -import { SmartInfoService } from './smart-info'; -import { StorageService } from './storage'; -import { StorageTemplateService } from './storage-template'; -import { SystemConfigService } from './system-config'; -import { TagService } from './tag'; -import { TrashService } from './trash'; -import { UserService } from './user'; +import { ActivityService } from 'src/domain/activity/activity.service'; +import { AlbumService } from 'src/domain/album/album.service'; +import { APIKeyService } from 'src/domain/api-key/api-key.service'; +import { AssetService } from 'src/domain/asset/asset.service'; +import { AuditService } from 'src/domain/audit/audit.service'; +import { AuthService } from 'src/domain/auth/auth.service'; +import { DatabaseService } from 'src/domain/database/database.service'; +import { DownloadService } from 'src/domain/download/download.service'; +import { JobService } from 'src/domain/job/job.service'; +import { LibraryService } from 'src/domain/library/library.service'; +import { MediaService } from 'src/domain/media/media.service'; +import { MetadataService } from 'src/domain/metadata/metadata.service'; +import { PartnerService } from 'src/domain/partner/partner.service'; +import { PersonService } from 'src/domain/person/person.service'; +import { SearchService } from 'src/domain/search/search.service'; +import { ServerInfoService } from 'src/domain/server-info/server-info.service'; +import { SharedLinkService } from 'src/domain/shared-link/shared-link.service'; +import { SmartInfoService } from 'src/domain/smart-info/smart-info.service'; +import { StorageTemplateService } from 'src/domain/storage-template/storage-template.service'; +import { StorageService } from 'src/domain/storage/storage.service'; +import { SystemConfigService } from 'src/domain/system-config/system-config.service'; +import { TagService } from 'src/domain/tag/tag.service'; +import { TrashService } from 'src/domain/trash/trash.service'; +import { UserService } from 'src/domain/user/user.service'; +import { ImmichLogger } from 'src/infra/logger'; const providers: Provider[] = [ APIKeyService, diff --git a/server/src/domain/domain.util.ts b/server/src/domain/domain.util.ts index a079ff6bf6..820c17f3f0 100644 --- a/server/src/domain/domain.util.ts +++ b/server/src/domain/domain.util.ts @@ -1,4 +1,3 @@ -import { ImmichLogger } from '@app/infra/logger'; import { BadRequestException, applyDecorators } from '@nestjs/common'; import { ApiProperty } from '@nestjs/swagger'; import { Transform } from 'class-transformer'; @@ -18,6 +17,7 @@ import { CronJob } from 'cron'; import _ from 'lodash'; import { basename, extname } from 'node:path'; import sanitize from 'sanitize-filename'; +import { ImmichLogger } from 'src/infra/logger'; export enum CacheControl { PRIVATE_WITH_CACHE = 'private_with_cache', diff --git a/server/src/domain/download/download.dto.ts b/server/src/domain/download/download.dto.ts index 3785a9d432..e350d66acf 100644 --- a/server/src/domain/download/download.dto.ts +++ b/server/src/domain/download/download.dto.ts @@ -1,6 +1,6 @@ import { ApiProperty } from '@nestjs/swagger'; import { IsInt, IsPositive } from 'class-validator'; -import { Optional, ValidateUUID } from '../domain.util'; +import { Optional, ValidateUUID } from 'src/domain/domain.util'; export class DownloadInfoDto { @ValidateUUID({ each: true, optional: true }) diff --git a/server/src/domain/download/download.service.spec.ts b/server/src/domain/download/download.service.spec.ts index 09161d8f66..d22ce69e8d 100644 --- a/server/src/domain/download/download.service.spec.ts +++ b/server/src/domain/download/download.service.spec.ts @@ -1,18 +1,16 @@ import { BadRequestException } from '@nestjs/common'; -import { - IAccessRepositoryMock, - assetStub, - authStub, - newAccessRepositoryMock, - newAssetRepositoryMock, - newStorageRepositoryMock, -} from '@test'; import { when } from 'jest-when'; +import { CacheControl, ImmichFileResponse } from 'src/domain/domain.util'; +import { DownloadResponseDto } from 'src/domain/download/download.dto'; +import { DownloadService } from 'src/domain/download/download.service'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { authStub } from 'test/fixtures/auth.stub'; +import { IAccessRepositoryMock, newAccessRepositoryMock } from 'test/repositories/access.repository.mock'; +import { newAssetRepositoryMock } from 'test/repositories/asset.repository.mock'; +import { newStorageRepositoryMock } from 'test/repositories/storage.repository.mock'; import { Readable } from 'typeorm/platform/PlatformTools.js'; -import { CacheControl, ImmichFileResponse } from '../domain.util'; -import { IAssetRepository, IStorageRepository } from '../repositories'; -import { DownloadResponseDto } from './download.dto'; -import { DownloadService } from './download.service'; const downloadResponse: DownloadResponseDto = { totalSize: 105_000, diff --git a/server/src/domain/download/download.service.ts b/server/src/domain/download/download.service.ts index 1b4a19185f..b069ac9b30 100644 --- a/server/src/domain/download/download.service.ts +++ b/server/src/domain/download/download.service.ts @@ -1,13 +1,15 @@ -import { AssetEntity } from '@app/infra/entities'; import { BadRequestException, Inject, Injectable } from '@nestjs/common'; import { parse } from 'node:path'; -import { AccessCore, Permission } from '../access'; -import { AssetIdsDto } from '../asset'; -import { AuthDto } from '../auth'; -import { mimeTypes } from '../domain.constant'; -import { CacheControl, HumanReadableSize, ImmichFileResponse, usePagination } from '../domain.util'; -import { IAccessRepository, IAssetRepository, IStorageRepository, ImmichReadStream } from '../repositories'; -import { DownloadArchiveInfo, DownloadInfoDto, DownloadResponseDto } from './download.dto'; +import { AccessCore, Permission } from 'src/domain/access/access.core'; +import { AssetIdsDto } from 'src/domain/asset/dto/asset-ids.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { mimeTypes } from 'src/domain/domain.constant'; +import { CacheControl, HumanReadableSize, ImmichFileResponse, usePagination } from 'src/domain/domain.util'; +import { DownloadArchiveInfo, DownloadInfoDto, DownloadResponseDto } from 'src/domain/download/download.dto'; +import { IAccessRepository } from 'src/domain/repositories/access.repository'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { IStorageRepository, ImmichReadStream } from 'src/domain/repositories/storage.repository'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; @Injectable() export class DownloadService { diff --git a/server/src/domain/download/index.ts b/server/src/domain/download/index.ts deleted file mode 100644 index ab5c91ec97..0000000000 --- a/server/src/domain/download/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './download.dto'; -export * from './download.service'; diff --git a/server/src/domain/index.ts b/server/src/domain/index.ts deleted file mode 100644 index dce2fa696d..0000000000 --- a/server/src/domain/index.ts +++ /dev/null @@ -1,30 +0,0 @@ -export * from './access'; -export * from './activity'; -export * from './album'; -export * from './api-key'; -export * from './asset'; -export * from './audit'; -export * from './auth'; -export * from './database'; -export * from './domain.config'; -export * from './domain.constant'; -export * from './domain.module'; -export * from './domain.util'; -export * from './download'; -export * from './job'; -export * from './library'; -export * from './media'; -export * from './metadata'; -export * from './partner'; -export * from './person'; -export * from './repositories'; -export * from './search'; -export * from './server-info'; -export * from './shared-link'; -export * from './smart-info'; -export * from './storage'; -export * from './storage-template'; -export * from './system-config'; -export * from './tag'; -export * from './trash'; -export * from './user'; diff --git a/server/src/domain/job/index.ts b/server/src/domain/job/index.ts deleted file mode 100644 index 44f617f0c4..0000000000 --- a/server/src/domain/job/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './job.constants'; -export * from './job.dto'; -export * from './job.interface'; -export * from './job.service'; diff --git a/server/src/domain/job/job.dto.ts b/server/src/domain/job/job.dto.ts index 87be1332f7..f551ab9613 100644 --- a/server/src/domain/job/job.dto.ts +++ b/server/src/domain/job/job.dto.ts @@ -1,7 +1,7 @@ import { ApiProperty } from '@nestjs/swagger'; import { IsEnum, IsNotEmpty } from 'class-validator'; -import { ValidateBoolean } from '../domain.util'; -import { JobCommand, QueueName } from './job.constants'; +import { ValidateBoolean } from 'src/domain/domain.util'; +import { JobCommand, QueueName } from 'src/domain/job/job.constants'; export class JobIdParamDto { @IsNotEmpty() diff --git a/server/src/domain/job/job.service.spec.ts b/server/src/domain/job/job.service.spec.ts index c2133a6239..7fc8cc86ee 100644 --- a/server/src/domain/job/job.service.spec.ts +++ b/server/src/domain/job/job.service.spec.ts @@ -1,26 +1,19 @@ -import { SystemConfig, SystemConfigKey } from '@app/infra/entities'; import { BadRequestException } from '@nestjs/common'; -import { - assetStub, - newAssetRepositoryMock, - newCommunicationRepositoryMock, - newJobRepositoryMock, - newPersonRepositoryMock, - newSystemConfigRepositoryMock, -} from '@test'; -import { - IAssetRepository, - ICommunicationRepository, - IJobRepository, - IPersonRepository, - ISystemConfigRepository, - JobHandler, - JobItem, - JobStatus, -} from '../repositories'; -import { FeatureFlag, SystemConfigCore } from '../system-config/system-config.core'; -import { JobCommand, JobName, QueueName } from './job.constants'; -import { JobService } from './job.service'; +import { JobCommand, JobName, QueueName } from 'src/domain/job/job.constants'; +import { JobService } from 'src/domain/job/job.service'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { ICommunicationRepository } from 'src/domain/repositories/communication.repository'; +import { IJobRepository, JobHandler, JobItem, JobStatus } from 'src/domain/repositories/job.repository'; +import { IPersonRepository } from 'src/domain/repositories/person.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { FeatureFlag, SystemConfigCore } from 'src/domain/system-config/system-config.core'; +import { SystemConfig, SystemConfigKey } from 'src/infra/entities/system-config.entity'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { newAssetRepositoryMock } from 'test/repositories/asset.repository.mock'; +import { newCommunicationRepositoryMock } from 'test/repositories/communication.repository.mock'; +import { newJobRepositoryMock } from 'test/repositories/job.repository.mock'; +import { newPersonRepositoryMock } from 'test/repositories/person.repository.mock'; +import { newSystemConfigRepositoryMock } from 'test/repositories/system-config.repository.mock'; const makeMockHandlers = (status: JobStatus) => { const mock = jest.fn().mockResolvedValue(status); diff --git a/server/src/domain/job/job.service.ts b/server/src/domain/job/job.service.ts index e00636ad68..bccb897d31 100644 --- a/server/src/domain/job/job.service.ts +++ b/server/src/domain/job/job.service.ts @@ -1,22 +1,15 @@ -import { AssetType } from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; import { BadRequestException, Inject, Injectable } from '@nestjs/common'; -import { mapAsset } from '../asset'; -import { - ClientEvent, - IAssetRepository, - ICommunicationRepository, - IJobRepository, - IPersonRepository, - ISystemConfigRepository, - JobHandler, - JobItem, - JobStatus, - QueueCleanType, -} from '../repositories'; -import { FeatureFlag, SystemConfigCore } from '../system-config/system-config.core'; -import { ConcurrentQueueName, JobCommand, JobName, QueueName } from './job.constants'; -import { AllJobStatusResponseDto, JobCommandDto, JobStatusDto } from './job.dto'; +import { mapAsset } from 'src/domain/asset/response-dto/asset-response.dto'; +import { ConcurrentQueueName, JobCommand, JobName, QueueName } from 'src/domain/job/job.constants'; +import { AllJobStatusResponseDto, JobCommandDto, JobStatusDto } from 'src/domain/job/job.dto'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { ClientEvent, ICommunicationRepository } from 'src/domain/repositories/communication.repository'; +import { IJobRepository, JobHandler, JobItem, JobStatus, QueueCleanType } from 'src/domain/repositories/job.repository'; +import { IPersonRepository } from 'src/domain/repositories/person.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { FeatureFlag, SystemConfigCore } from 'src/domain/system-config/system-config.core'; +import { AssetType } from 'src/infra/entities/asset.entity'; +import { ImmichLogger } from 'src/infra/logger'; @Injectable() export class JobService { diff --git a/server/src/domain/library/index.ts b/server/src/domain/library/index.ts deleted file mode 100644 index da0d981f2e..0000000000 --- a/server/src/domain/library/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './library.dto'; -export * from './library.service'; diff --git a/server/src/domain/library/library.dto.ts b/server/src/domain/library/library.dto.ts index fcce02f878..26faf43407 100644 --- a/server/src/domain/library/library.dto.ts +++ b/server/src/domain/library/library.dto.ts @@ -1,7 +1,7 @@ -import { LibraryEntity, LibraryType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { ArrayMaxSize, ArrayUnique, IsEnum, IsNotEmpty, IsString } from 'class-validator'; -import { Optional, ValidateBoolean, ValidateUUID } from '../domain.util'; +import { Optional, ValidateBoolean, ValidateUUID } from 'src/domain/domain.util'; +import { LibraryEntity, LibraryType } from 'src/infra/entities/library.entity'; export class CreateLibraryDto { @IsEnum(LibraryType) diff --git a/server/src/domain/library/library.service.spec.ts b/server/src/domain/library/library.service.spec.ts index bd57a684d4..bfa3102d97 100644 --- a/server/src/domain/library/library.service.spec.ts +++ b/server/src/domain/library/library.service.spec.ts @@ -1,45 +1,39 @@ -import { AssetType, LibraryType, SystemConfig, SystemConfigKey, UserEntity } from '@app/infra/entities'; import { BadRequestException } from '@nestjs/common'; -import { - IAccessRepositoryMock, - assetStub, - authStub, - libraryStub, - makeMockWatcher, - newAccessRepositoryMock, - newAssetRepositoryMock, - newCryptoRepositoryMock, - newDatabaseRepositoryMock, - newJobRepositoryMock, - newLibraryRepositoryMock, - newStorageRepositoryMock, - newSystemConfigRepositoryMock, - systemConfigStub, - userStub, -} from '@test'; import { when } from 'jest-when'; import { R_OK } from 'node:constants'; import { Stats } from 'node:fs'; -import { ILibraryFileJob, ILibraryRefreshJob, JobName } from '../job'; -import { - IAssetRepository, - ICryptoRepository, - IDatabaseRepository, - IJobRepository, - ILibraryRepository, - IStorageRepository, - ISystemConfigRepository, - JobStatus, - StorageEventType, -} from '../repositories'; -import { SystemConfigCore } from '../system-config/system-config.core'; -import { mapLibrary } from './library.dto'; -import { LibraryService } from './library.service'; +import { JobName } from 'src/domain/job/job.constants'; +import { ILibraryFileJob, ILibraryRefreshJob } from 'src/domain/job/job.interface'; +import { mapLibrary } from 'src/domain/library/library.dto'; +import { LibraryService } from 'src/domain/library/library.service'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { IDatabaseRepository } from 'src/domain/repositories/database.repository'; +import { IJobRepository, JobStatus } from 'src/domain/repositories/job.repository'; +import { ILibraryRepository } from 'src/domain/repositories/library.repository'; +import { IStorageRepository, StorageEventType } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { SystemConfigCore } from 'src/domain/system-config/system-config.core'; +import { AssetType } from 'src/infra/entities/asset.entity'; +import { LibraryType } from 'src/infra/entities/library.entity'; +import { SystemConfig, SystemConfigKey } from 'src/infra/entities/system-config.entity'; +import { UserEntity } from 'src/infra/entities/user.entity'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { authStub } from 'test/fixtures/auth.stub'; +import { libraryStub } from 'test/fixtures/library.stub'; +import { systemConfigStub } from 'test/fixtures/system-config.stub'; +import { userStub } from 'test/fixtures/user.stub'; +import { newAssetRepositoryMock } from 'test/repositories/asset.repository.mock'; +import { newCryptoRepositoryMock } from 'test/repositories/crypto.repository.mock'; +import { newDatabaseRepositoryMock } from 'test/repositories/database.repository.mock'; +import { newJobRepositoryMock } from 'test/repositories/job.repository.mock'; +import { newLibraryRepositoryMock } from 'test/repositories/library.repository.mock'; +import { makeMockWatcher, newStorageRepositoryMock } from 'test/repositories/storage.repository.mock'; +import { newSystemConfigRepositoryMock } from 'test/repositories/system-config.repository.mock'; describe(LibraryService.name, () => { let sut: LibraryService; - let accessMock: IAccessRepositoryMock; let assetMock: jest.Mocked; let configMock: jest.Mocked; let cryptoMock: jest.Mocked; @@ -49,7 +43,6 @@ describe(LibraryService.name, () => { let databaseMock: jest.Mocked; beforeEach(() => { - accessMock = newAccessRepositoryMock(); configMock = newSystemConfigRepositoryMock(); libraryMock = newLibraryRepositoryMock(); assetMock = newAssetRepositoryMock(); @@ -58,19 +51,7 @@ describe(LibraryService.name, () => { storageMock = newStorageRepositoryMock(); databaseMock = newDatabaseRepositoryMock(); - // Always validate owner access for library. - accessMock.library.checkOwnerAccess.mockImplementation((_, libraryIds) => Promise.resolve(libraryIds)); - - sut = new LibraryService( - accessMock, - assetMock, - configMock, - cryptoMock, - jobMock, - libraryMock, - storageMock, - databaseMock, - ); + sut = new LibraryService(assetMock, configMock, cryptoMock, jobMock, libraryMock, storageMock, databaseMock); databaseMock.tryLock.mockResolvedValue(true); }); diff --git a/server/src/domain/library/library.service.ts b/server/src/domain/library/library.service.ts index 00667539b1..7ad781f283 100644 --- a/server/src/domain/library/library.service.ts +++ b/server/src/domain/library/library.service.ts @@ -1,5 +1,3 @@ -import { AssetType, LibraryEntity, LibraryType } from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; import { BadRequestException, Inject, Injectable } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; import { Trie } from 'mnemonist'; @@ -8,28 +6,10 @@ import { EventEmitter } from 'node:events'; import { Stats } from 'node:fs'; import path, { basename, parse } from 'node:path'; import picomatch from 'picomatch'; -import { AccessCore } from '../access'; -import { mimeTypes } from '../domain.constant'; -import { handlePromiseError, usePagination, validateCronExpression } from '../domain.util'; -import { IBaseJob, IEntityJob, ILibraryFileJob, ILibraryRefreshJob, JOBS_ASSET_PAGINATION_SIZE, JobName } from '../job'; -import { - DatabaseLock, - IAccessRepository, - IAssetRepository, - ICryptoRepository, - IDatabaseRepository, - IJobRepository, - ILibraryRepository, - IStorageRepository, - ISystemConfigRepository, - InternalEvent, - InternalEventMap, - JobStatus, - StorageEventType, - WithProperty, -} from '../repositories'; -import { StorageCore } from '../storage'; -import { SystemConfigCore } from '../system-config'; +import { mimeTypes } from 'src/domain/domain.constant'; +import { handlePromiseError, usePagination, validateCronExpression } from 'src/domain/domain.util'; +import { JOBS_ASSET_PAGINATION_SIZE, JobName } from 'src/domain/job/job.constants'; +import { IBaseJob, IEntityJob, ILibraryFileJob, ILibraryRefreshJob } from 'src/domain/job/job.interface'; import { CreateLibraryDto, LibraryResponseDto, @@ -41,21 +21,32 @@ import { ValidateLibraryImportPathResponseDto, ValidateLibraryResponseDto, mapLibrary, -} from './library.dto'; +} from 'src/domain/library/library.dto'; +import { IAssetRepository, WithProperty } from 'src/domain/repositories/asset.repository'; +import { InternalEvent, InternalEventMap } from 'src/domain/repositories/communication.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { DatabaseLock, IDatabaseRepository } from 'src/domain/repositories/database.repository'; +import { IJobRepository, JobStatus } from 'src/domain/repositories/job.repository'; +import { ILibraryRepository } from 'src/domain/repositories/library.repository'; +import { IStorageRepository, StorageEventType } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { StorageCore } from 'src/domain/storage/storage.core'; +import { SystemConfigCore } from 'src/domain/system-config/system-config.core'; +import { AssetType } from 'src/infra/entities/asset.entity'; +import { LibraryEntity, LibraryType } from 'src/infra/entities/library.entity'; +import { ImmichLogger } from 'src/infra/logger'; const LIBRARY_SCAN_BATCH_SIZE = 5000; @Injectable() export class LibraryService extends EventEmitter { readonly logger = new ImmichLogger(LibraryService.name); - private access: AccessCore; private configCore: SystemConfigCore; private watchLibraries = false; private watchLock = false; private watchers: Record Promise> = {}; constructor( - @Inject(IAccessRepository) accessRepository: IAccessRepository, @Inject(IAssetRepository) private assetRepository: IAssetRepository, @Inject(ISystemConfigRepository) configRepository: ISystemConfigRepository, @Inject(ICryptoRepository) private cryptoRepository: ICryptoRepository, @@ -65,7 +56,6 @@ export class LibraryService extends EventEmitter { @Inject(IDatabaseRepository) private databaseRepository: IDatabaseRepository, ) { super(); - this.access = AccessCore.create(accessRepository); this.configCore = SystemConfigCore.create(configRepository); } diff --git a/server/src/domain/media/index.ts b/server/src/domain/media/index.ts deleted file mode 100644 index 83a31567bd..0000000000 --- a/server/src/domain/media/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './media.constant'; -export * from './media.service'; diff --git a/server/src/domain/media/media.service.spec.ts b/server/src/domain/media/media.service.spec.ts index 36d2cfdbac..9a5727ef21 100644 --- a/server/src/domain/media/media.service.spec.ts +++ b/server/src/domain/media/media.service.spec.ts @@ -1,43 +1,37 @@ +import { Stats } from 'node:fs'; +import { JobName } from 'src/domain/job/job.constants'; +import { MediaService } from 'src/domain/media/media.service'; +import { IAssetRepository, WithoutProperty } from 'src/domain/repositories/asset.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { IJobRepository, JobStatus } from 'src/domain/repositories/job.repository'; +import { IMediaRepository } from 'src/domain/repositories/media.repository'; +import { IMoveRepository } from 'src/domain/repositories/move.repository'; +import { IPersonRepository } from 'src/domain/repositories/person.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { AssetType } from 'src/infra/entities/asset.entity'; +import { ExifEntity } from 'src/infra/entities/exif.entity'; import { - AssetType, AudioCodec, Colorspace, - ExifEntity, SystemConfigKey, ToneMapping, TranscodeHWAccel, TranscodePolicy, VideoCodec, -} from '@app/infra/entities'; -import { - assetStub, - faceStub, - newAssetRepositoryMock, - newCryptoRepositoryMock, - newJobRepositoryMock, - newMediaRepositoryMock, - newMoveRepositoryMock, - newPersonRepositoryMock, - newStorageRepositoryMock, - newSystemConfigRepositoryMock, - personStub, - probeStub, -} from '@test'; -import { Stats } from 'node:fs'; -import { JobName } from '../job'; -import { - IAssetRepository, - ICryptoRepository, - IJobRepository, - IMediaRepository, - IMoveRepository, - IPersonRepository, - IStorageRepository, - ISystemConfigRepository, - JobStatus, - WithoutProperty, -} from '../repositories'; -import { MediaService } from './media.service'; +} from 'src/infra/entities/system-config.entity'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { faceStub } from 'test/fixtures/face.stub'; +import { probeStub } from 'test/fixtures/media.stub'; +import { personStub } from 'test/fixtures/person.stub'; +import { newAssetRepositoryMock } from 'test/repositories/asset.repository.mock'; +import { newCryptoRepositoryMock } from 'test/repositories/crypto.repository.mock'; +import { newJobRepositoryMock } from 'test/repositories/job.repository.mock'; +import { newMediaRepositoryMock } from 'test/repositories/media.repository.mock'; +import { newMoveRepositoryMock } from 'test/repositories/move.repository.mock'; +import { newPersonRepositoryMock } from 'test/repositories/person.repository.mock'; +import { newStorageRepositoryMock } from 'test/repositories/storage.repository.mock'; +import { newSystemConfigRepositoryMock } from 'test/repositories/system-config.repository.mock'; describe(MediaService.name, () => { let sut: MediaService; diff --git a/server/src/domain/media/media.service.ts b/server/src/domain/media/media.service.ts index 31eafcbcfa..bb0c2503d9 100644 --- a/server/src/domain/media/media.service.ts +++ b/server/src/domain/media/media.service.ts @@ -1,37 +1,7 @@ -import { - AssetEntity, - AssetPathType, - AssetType, - AudioCodec, - Colorspace, - TranscodeHWAccel, - TranscodePolicy, - TranscodeTarget, - VideoCodec, -} from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; import { Inject, Injectable, UnsupportedMediaTypeException } from '@nestjs/common'; -import { usePagination } from '../domain.util'; -import { IBaseJob, IEntityJob, JOBS_ASSET_PAGINATION_SIZE, JobName, QueueName } from '../job'; -import { - AudioStreamInfo, - IAssetRepository, - ICryptoRepository, - IJobRepository, - IMediaRepository, - IMoveRepository, - IPersonRepository, - IStorageRepository, - ISystemConfigRepository, - JobItem, - JobStatus, - VideoCodecHWConfig, - VideoStreamInfo, - WithoutProperty, -} from '../repositories'; -import { StorageCore, StorageFolder } from '../storage'; -import { SystemConfigFFmpegDto } from '../system-config'; -import { SystemConfigCore } from '../system-config/system-config.core'; +import { usePagination } from 'src/domain/domain.util'; +import { JOBS_ASSET_PAGINATION_SIZE, JobName, QueueName } from 'src/domain/job/job.constants'; +import { IBaseJob, IEntityJob } from 'src/domain/job/job.interface'; import { H264Config, HEVCConfig, @@ -41,7 +11,34 @@ import { ThumbnailConfig, VAAPIConfig, VP9Config, -} from './media.util'; +} from 'src/domain/media/media.util'; +import { IAssetRepository, WithoutProperty } from 'src/domain/repositories/asset.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { IJobRepository, JobItem, JobStatus } from 'src/domain/repositories/job.repository'; +import { + AudioStreamInfo, + IMediaRepository, + VideoCodecHWConfig, + VideoStreamInfo, +} from 'src/domain/repositories/media.repository'; +import { IMoveRepository } from 'src/domain/repositories/move.repository'; +import { IPersonRepository } from 'src/domain/repositories/person.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { StorageCore, StorageFolder } from 'src/domain/storage/storage.core'; +import { SystemConfigFFmpegDto } from 'src/domain/system-config/dto/system-config-ffmpeg.dto'; +import { SystemConfigCore } from 'src/domain/system-config/system-config.core'; +import { AssetEntity, AssetType } from 'src/infra/entities/asset.entity'; +import { AssetPathType } from 'src/infra/entities/move.entity'; +import { + AudioCodec, + Colorspace, + TranscodeHWAccel, + TranscodePolicy, + TranscodeTarget, + VideoCodec, +} from 'src/infra/entities/system-config.entity'; +import { ImmichLogger } from 'src/infra/logger'; @Injectable() export class MediaService { @@ -58,7 +55,7 @@ export class MediaService { @Inject(IStorageRepository) private storageRepository: IStorageRepository, @Inject(ISystemConfigRepository) configRepository: ISystemConfigRepository, @Inject(IMoveRepository) moveRepository: IMoveRepository, - @Inject(ICryptoRepository) private cryptoRepository: ICryptoRepository, + @Inject(ICryptoRepository) cryptoRepository: ICryptoRepository, ) { this.configCore = SystemConfigCore.create(configRepository); this.storageCore = StorageCore.create( diff --git a/server/src/domain/media/media.util.ts b/server/src/domain/media/media.util.ts index 3acabb4356..224e55a217 100644 --- a/server/src/domain/media/media.util.ts +++ b/server/src/domain/media/media.util.ts @@ -1,4 +1,3 @@ -import { CQMode, ToneMapping, TranscodeHWAccel, TranscodeTarget, VideoCodec } from '@app/infra/entities'; import { AudioStreamInfo, BitrateDistribution, @@ -6,8 +5,16 @@ import { VideoCodecHWConfig, VideoCodecSWConfig, VideoStreamInfo, -} from '../repositories'; -import { SystemConfigFFmpegDto } from '../system-config/dto'; +} from 'src/domain/repositories/media.repository'; +import { SystemConfigFFmpegDto } from 'src/domain/system-config/dto/system-config-ffmpeg.dto'; +import { + CQMode, + ToneMapping, + TranscodeHWAccel, + TranscodeTarget, + VideoCodec, +} from 'src/infra/entities/system-config.entity'; + class BaseConfig implements VideoCodecSWConfig { presets = ['veryslow', 'slower', 'slow', 'medium', 'fast', 'faster', 'veryfast', 'superfast', 'ultrafast']; constructor(protected config: SystemConfigFFmpegDto) {} diff --git a/server/src/domain/metadata/index.ts b/server/src/domain/metadata/index.ts deleted file mode 100644 index 92c69e4505..0000000000 --- a/server/src/domain/metadata/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './metadata.service'; diff --git a/server/src/domain/metadata/metadata.service.spec.ts b/server/src/domain/metadata/metadata.service.spec.ts index 69d31cbd57..e23da47baa 100644 --- a/server/src/domain/metadata/metadata.service.spec.ts +++ b/server/src/domain/metadata/metadata.service.spec.ts @@ -1,46 +1,40 @@ -import { AssetType, ExifEntity, SystemConfigKey } from '@app/infra/entities'; -import { - assetStub, - fileStub, - newAlbumRepositoryMock, - newAssetRepositoryMock, - newCommunicationRepositoryMock, - newCryptoRepositoryMock, - newDatabaseRepositoryMock, - newJobRepositoryMock, - newMediaRepositoryMock, - newMetadataRepositoryMock, - newMoveRepositoryMock, - newPersonRepositoryMock, - newStorageRepositoryMock, - newSystemConfigRepositoryMock, - probeStub, -} from '@test'; import { BinaryField } from 'exiftool-vendored'; import { when } from 'jest-when'; import { randomBytes } from 'node:crypto'; import { Stats } from 'node:fs'; import { constants } from 'node:fs/promises'; -import { JobName } from '../job'; -import { - ClientEvent, - IAlbumRepository, - IAssetRepository, - ICommunicationRepository, - ICryptoRepository, - IDatabaseRepository, - IJobRepository, - IMediaRepository, - IMetadataRepository, - IMoveRepository, - IPersonRepository, - IStorageRepository, - ISystemConfigRepository, - ImmichTags, - JobStatus, - WithoutProperty, -} from '../repositories'; -import { MetadataService, Orientation } from './metadata.service'; +import { JobName } from 'src/domain/job/job.constants'; +import { MetadataService, Orientation } from 'src/domain/metadata/metadata.service'; +import { IAlbumRepository } from 'src/domain/repositories/album.repository'; +import { IAssetRepository, WithoutProperty } from 'src/domain/repositories/asset.repository'; +import { ClientEvent, ICommunicationRepository } from 'src/domain/repositories/communication.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { IDatabaseRepository } from 'src/domain/repositories/database.repository'; +import { IJobRepository, JobStatus } from 'src/domain/repositories/job.repository'; +import { IMediaRepository } from 'src/domain/repositories/media.repository'; +import { IMetadataRepository, ImmichTags } from 'src/domain/repositories/metadata.repository'; +import { IMoveRepository } from 'src/domain/repositories/move.repository'; +import { IPersonRepository } from 'src/domain/repositories/person.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { AssetType } from 'src/infra/entities/asset.entity'; +import { ExifEntity } from 'src/infra/entities/exif.entity'; +import { SystemConfigKey } from 'src/infra/entities/system-config.entity'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { fileStub } from 'test/fixtures/file.stub'; +import { probeStub } from 'test/fixtures/media.stub'; +import { newAlbumRepositoryMock } from 'test/repositories/album.repository.mock'; +import { newAssetRepositoryMock } from 'test/repositories/asset.repository.mock'; +import { newCommunicationRepositoryMock } from 'test/repositories/communication.repository.mock'; +import { newCryptoRepositoryMock } from 'test/repositories/crypto.repository.mock'; +import { newDatabaseRepositoryMock } from 'test/repositories/database.repository.mock'; +import { newJobRepositoryMock } from 'test/repositories/job.repository.mock'; +import { newMediaRepositoryMock } from 'test/repositories/media.repository.mock'; +import { newMetadataRepositoryMock } from 'test/repositories/metadata.repository.mock'; +import { newMoveRepositoryMock } from 'test/repositories/move.repository.mock'; +import { newPersonRepositoryMock } from 'test/repositories/person.repository.mock'; +import { newStorageRepositoryMock } from 'test/repositories/storage.repository.mock'; +import { newSystemConfigRepositoryMock } from 'test/repositories/system-config.repository.mock'; describe(MetadataService.name, () => { let albumMock: jest.Mocked; diff --git a/server/src/domain/metadata/metadata.service.ts b/server/src/domain/metadata/metadata.service.ts index 75838330d2..4f45b98533 100644 --- a/server/src/domain/metadata/metadata.service.ts +++ b/server/src/domain/metadata/metadata.service.ts @@ -1,5 +1,3 @@ -import { AssetEntity, AssetType, ExifEntity } from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; import { Inject, Injectable } from '@nestjs/common'; import { ExifDateTime, Tags } from 'exiftool-vendored'; import { firstDateTime } from 'exiftool-vendored/dist/FirstDateTime'; @@ -8,29 +6,26 @@ import { Duration } from 'luxon'; import { constants } from 'node:fs/promises'; import path from 'node:path'; import { Subscription } from 'rxjs'; -import { handlePromiseError, usePagination } from '../domain.util'; -import { IBaseJob, IEntityJob, ISidecarWriteJob, JOBS_ASSET_PAGINATION_SIZE, JobName, QueueName } from '../job'; -import { - ClientEvent, - DatabaseLock, - IAlbumRepository, - IAssetRepository, - ICommunicationRepository, - ICryptoRepository, - IDatabaseRepository, - IJobRepository, - IMediaRepository, - IMetadataRepository, - IMoveRepository, - IPersonRepository, - IStorageRepository, - ISystemConfigRepository, - ImmichTags, - JobStatus, - WithoutProperty, -} from '../repositories'; -import { StorageCore } from '../storage'; -import { FeatureFlag, SystemConfigCore } from '../system-config'; +import { handlePromiseError, usePagination } from 'src/domain/domain.util'; +import { JOBS_ASSET_PAGINATION_SIZE, JobName, QueueName } from 'src/domain/job/job.constants'; +import { IBaseJob, IEntityJob, ISidecarWriteJob } from 'src/domain/job/job.interface'; +import { IAlbumRepository } from 'src/domain/repositories/album.repository'; +import { IAssetRepository, WithoutProperty } from 'src/domain/repositories/asset.repository'; +import { ClientEvent, ICommunicationRepository } from 'src/domain/repositories/communication.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { DatabaseLock, IDatabaseRepository } from 'src/domain/repositories/database.repository'; +import { IJobRepository, JobStatus } from 'src/domain/repositories/job.repository'; +import { IMediaRepository } from 'src/domain/repositories/media.repository'; +import { IMetadataRepository, ImmichTags } from 'src/domain/repositories/metadata.repository'; +import { IMoveRepository } from 'src/domain/repositories/move.repository'; +import { IPersonRepository } from 'src/domain/repositories/person.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { StorageCore } from 'src/domain/storage/storage.core'; +import { FeatureFlag, SystemConfigCore } from 'src/domain/system-config/system-config.core'; +import { AssetEntity, AssetType } from 'src/infra/entities/asset.entity'; +import { ExifEntity } from 'src/infra/entities/exif.entity'; +import { ImmichLogger } from 'src/infra/logger'; /** look for a date from these tags (in order) */ const EXIF_DATE_TAGS: Array = [ diff --git a/server/src/domain/partner/index.ts b/server/src/domain/partner/index.ts deleted file mode 100644 index b25925e896..0000000000 --- a/server/src/domain/partner/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './partner.dto'; -export * from './partner.service'; diff --git a/server/src/domain/partner/partner.dto.ts b/server/src/domain/partner/partner.dto.ts index 17afcad5d0..c197d20797 100644 --- a/server/src/domain/partner/partner.dto.ts +++ b/server/src/domain/partner/partner.dto.ts @@ -1,5 +1,5 @@ import { IsNotEmpty } from 'class-validator'; -import { UserResponseDto } from '../user'; +import { UserResponseDto } from 'src/domain/user/response-dto/user-response.dto'; export class UpdatePartnerDto { @IsNotEmpty() diff --git a/server/src/domain/partner/partner.service.spec.ts b/server/src/domain/partner/partner.service.spec.ts index 6e9c10c5c7..b1b7fb097e 100644 --- a/server/src/domain/partner/partner.service.spec.ts +++ b/server/src/domain/partner/partner.service.spec.ts @@ -1,9 +1,12 @@ -import { UserAvatarColor } from '@app/infra/entities'; import { BadRequestException } from '@nestjs/common'; -import { authStub, newPartnerRepositoryMock, partnerStub } from '@test'; -import { IAccessRepository, IPartnerRepository, PartnerDirection } from '../repositories'; -import { PartnerResponseDto } from './partner.dto'; -import { PartnerService } from './partner.service'; +import { PartnerResponseDto } from 'src/domain/partner/partner.dto'; +import { PartnerService } from 'src/domain/partner/partner.service'; +import { IAccessRepository } from 'src/domain/repositories/access.repository'; +import { IPartnerRepository, PartnerDirection } from 'src/domain/repositories/partner.repository'; +import { UserAvatarColor } from 'src/infra/entities/user.entity'; +import { authStub } from 'test/fixtures/auth.stub'; +import { partnerStub } from 'test/fixtures/partner.stub'; +import { newPartnerRepositoryMock } from 'test/repositories/partner.repository.mock'; const responseDto = { admin: { diff --git a/server/src/domain/partner/partner.service.ts b/server/src/domain/partner/partner.service.ts index a3f9a9f3df..74cafbcbae 100644 --- a/server/src/domain/partner/partner.service.ts +++ b/server/src/domain/partner/partner.service.ts @@ -1,10 +1,11 @@ -import { PartnerEntity } from '@app/infra/entities'; import { BadRequestException, Inject, Injectable } from '@nestjs/common'; -import { AccessCore, Permission } from '../access'; -import { AuthDto } from '../auth'; -import { IAccessRepository, IPartnerRepository, PartnerDirection, PartnerIds } from '../repositories'; -import { mapUser } from '../user'; -import { PartnerResponseDto, UpdatePartnerDto } from './partner.dto'; +import { AccessCore, Permission } from 'src/domain/access/access.core'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { PartnerResponseDto, UpdatePartnerDto } from 'src/domain/partner/partner.dto'; +import { IAccessRepository } from 'src/domain/repositories/access.repository'; +import { IPartnerRepository, PartnerDirection, PartnerIds } from 'src/domain/repositories/partner.repository'; +import { mapUser } from 'src/domain/user/response-dto/user-response.dto'; +import { PartnerEntity } from 'src/infra/entities/partner.entity'; @Injectable() export class PartnerService { diff --git a/server/src/domain/person/index.ts b/server/src/domain/person/index.ts deleted file mode 100644 index 14a960467a..0000000000 --- a/server/src/domain/person/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './person.dto'; -export * from './person.service'; diff --git a/server/src/domain/person/person.dto.ts b/server/src/domain/person/person.dto.ts index a00971c6be..9ac66332f8 100644 --- a/server/src/domain/person/person.dto.ts +++ b/server/src/domain/person/person.dto.ts @@ -1,9 +1,10 @@ -import { AssetFaceEntity, PersonEntity } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { Type } from 'class-transformer'; import { IsArray, IsNotEmpty, IsString, MaxDate, ValidateNested } from 'class-validator'; -import { AuthDto } from '../auth'; -import { Optional, ValidateBoolean, ValidateDate, ValidateUUID } from '../domain.util'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { Optional, ValidateBoolean, ValidateDate, ValidateUUID } from 'src/domain/domain.util'; +import { AssetFaceEntity } from 'src/infra/entities/asset-face.entity'; +import { PersonEntity } from 'src/infra/entities/person.entity'; export class PersonCreateDto { /** diff --git a/server/src/domain/person/person.service.spec.ts b/server/src/domain/person/person.service.spec.ts index 08b5875a57..b0aa3c33ac 100644 --- a/server/src/domain/person/person.service.spec.ts +++ b/server/src/domain/person/person.service.spec.ts @@ -1,44 +1,37 @@ -import { AssetFaceEntity, Colorspace, SystemConfigKey } from '@app/infra/entities'; import { BadRequestException, NotFoundException } from '@nestjs/common'; -import { - IAccessRepositoryMock, - assetStub, - authStub, - faceStub, - newAccessRepositoryMock, - newAssetRepositoryMock, - newCryptoRepositoryMock, - newJobRepositoryMock, - newMachineLearningRepositoryMock, - newMediaRepositoryMock, - newMoveRepositoryMock, - newPersonRepositoryMock, - newSearchRepositoryMock, - newStorageRepositoryMock, - newSystemConfigRepositoryMock, - personStub, -} from '@test'; +import { BulkIdErrorReason } from 'src/domain/asset/response-dto/asset-ids-response.dto'; +import { CacheControl, ImmichFileResponse } from 'src/domain/domain.util'; +import { JobName } from 'src/domain/job/job.constants'; +import { PersonResponseDto, mapFaces, mapPerson } from 'src/domain/person/person.dto'; +import { PersonService } from 'src/domain/person/person.service'; +import { IAssetRepository, WithoutProperty } from 'src/domain/repositories/asset.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { IJobRepository, JobStatus } from 'src/domain/repositories/job.repository'; +import { IMachineLearningRepository } from 'src/domain/repositories/machine-learning.repository'; +import { IMediaRepository } from 'src/domain/repositories/media.repository'; +import { IMoveRepository } from 'src/domain/repositories/move.repository'; +import { IPersonRepository } from 'src/domain/repositories/person.repository'; +import { FaceSearchResult, ISearchRepository } from 'src/domain/repositories/search.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { AssetFaceEntity } from 'src/infra/entities/asset-face.entity'; +import { Colorspace, SystemConfigKey } from 'src/infra/entities/system-config.entity'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { authStub } from 'test/fixtures/auth.stub'; +import { faceStub } from 'test/fixtures/face.stub'; +import { personStub } from 'test/fixtures/person.stub'; +import { IAccessRepositoryMock, newAccessRepositoryMock } from 'test/repositories/access.repository.mock'; +import { newAssetRepositoryMock } from 'test/repositories/asset.repository.mock'; +import { newCryptoRepositoryMock } from 'test/repositories/crypto.repository.mock'; +import { newJobRepositoryMock } from 'test/repositories/job.repository.mock'; +import { newMachineLearningRepositoryMock } from 'test/repositories/machine-learning.repository.mock'; +import { newMediaRepositoryMock } from 'test/repositories/media.repository.mock'; +import { newMoveRepositoryMock } from 'test/repositories/move.repository.mock'; +import { newPersonRepositoryMock } from 'test/repositories/person.repository.mock'; +import { newSearchRepositoryMock } from 'test/repositories/search.repository.mock'; +import { newStorageRepositoryMock } from 'test/repositories/storage.repository.mock'; +import { newSystemConfigRepositoryMock } from 'test/repositories/system-config.repository.mock'; import { IsNull } from 'typeorm'; -import { BulkIdErrorReason } from '../asset'; -import { CacheControl, ImmichFileResponse } from '../domain.util'; -import { JobName } from '../job'; -import { - FaceSearchResult, - IAssetRepository, - ICryptoRepository, - IJobRepository, - IMachineLearningRepository, - IMediaRepository, - IMoveRepository, - IPersonRepository, - ISearchRepository, - IStorageRepository, - ISystemConfigRepository, - JobStatus, - WithoutProperty, -} from '../repositories'; -import { PersonResponseDto, mapFaces, mapPerson } from './person.dto'; -import { PersonService } from './person.service'; const responseDto: PersonResponseDto = { id: 'person-1', diff --git a/server/src/domain/person/person.service.ts b/server/src/domain/person/person.service.ts index 1a2233f3c8..1928191a3e 100644 --- a/server/src/domain/person/person.service.ts +++ b/server/src/domain/person/person.service.ts @@ -1,35 +1,13 @@ -import { PersonEntity } from '@app/infra/entities'; -import { PersonPathType } from '@app/infra/entities/move.entity'; -import { ImmichLogger } from '@app/infra/logger'; import { BadRequestException, Inject, Injectable, NotFoundException } from '@nestjs/common'; -import { IsNull } from 'typeorm'; -import { AccessCore, Permission } from '../access'; -import { AssetResponseDto, BulkIdErrorReason, BulkIdResponseDto, mapAsset } from '../asset'; -import { AuthDto } from '../auth'; -import { mimeTypes } from '../domain.constant'; -import { CacheControl, ImmichFileResponse, usePagination } from '../domain.util'; -import { IBaseJob, IDeferrableJob, IEntityJob, JOBS_ASSET_PAGINATION_SIZE, JobName, QueueName } from '../job'; -import { FACE_THUMBNAIL_SIZE } from '../media'; -import { - CropOptions, - IAccessRepository, - IAssetRepository, - ICryptoRepository, - IJobRepository, - IMachineLearningRepository, - IMediaRepository, - IMoveRepository, - IPersonRepository, - ISearchRepository, - IStorageRepository, - ISystemConfigRepository, - JobItem, - JobStatus, - UpdateFacesData, - WithoutProperty, -} from '../repositories'; -import { StorageCore } from '../storage'; -import { SystemConfigCore } from '../system-config'; +import { AccessCore, Permission } from 'src/domain/access/access.core'; +import { BulkIdErrorReason, BulkIdResponseDto } from 'src/domain/asset/response-dto/asset-ids-response.dto'; +import { AssetResponseDto, mapAsset } from 'src/domain/asset/response-dto/asset-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { mimeTypes } from 'src/domain/domain.constant'; +import { CacheControl, ImmichFileResponse, usePagination } from 'src/domain/domain.util'; +import { JOBS_ASSET_PAGINATION_SIZE, JobName, QueueName } from 'src/domain/job/job.constants'; +import { IBaseJob, IDeferrableJob, IEntityJob } from 'src/domain/job/job.interface'; +import { FACE_THUMBNAIL_SIZE } from 'src/domain/media/media.constant'; import { AssetFaceResponseDto, AssetFaceUpdateDto, @@ -44,7 +22,24 @@ import { PersonUpdateDto, mapFaces, mapPerson, -} from './person.dto'; +} from 'src/domain/person/person.dto'; +import { IAccessRepository } from 'src/domain/repositories/access.repository'; +import { IAssetRepository, WithoutProperty } from 'src/domain/repositories/asset.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { IJobRepository, JobItem, JobStatus } from 'src/domain/repositories/job.repository'; +import { IMachineLearningRepository } from 'src/domain/repositories/machine-learning.repository'; +import { CropOptions, IMediaRepository } from 'src/domain/repositories/media.repository'; +import { IMoveRepository } from 'src/domain/repositories/move.repository'; +import { IPersonRepository, UpdateFacesData } from 'src/domain/repositories/person.repository'; +import { ISearchRepository } from 'src/domain/repositories/search.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { StorageCore } from 'src/domain/storage/storage.core'; +import { SystemConfigCore } from 'src/domain/system-config/system-config.core'; +import { PersonPathType } from 'src/infra/entities/move.entity'; +import { PersonEntity } from 'src/infra/entities/person.entity'; +import { ImmichLogger } from 'src/infra/logger'; +import { IsNull } from 'typeorm'; @Injectable() export class PersonService { @@ -64,7 +59,7 @@ export class PersonService { @Inject(IStorageRepository) private storageRepository: IStorageRepository, @Inject(IJobRepository) private jobRepository: IJobRepository, @Inject(ISearchRepository) private smartInfoRepository: ISearchRepository, - @Inject(ICryptoRepository) private cryptoRepository: ICryptoRepository, + @Inject(ICryptoRepository) cryptoRepository: ICryptoRepository, ) { this.access = AccessCore.create(accessRepository); this.configCore = SystemConfigCore.create(configRepository); diff --git a/server/src/domain/repositories/activity.repository.ts b/server/src/domain/repositories/activity.repository.ts index 6f5476a289..39eb5da6b5 100644 --- a/server/src/domain/repositories/activity.repository.ts +++ b/server/src/domain/repositories/activity.repository.ts @@ -1,5 +1,5 @@ -import { ActivityEntity } from '@app/infra/entities/activity.entity'; -import { ActivitySearch } from '@app/infra/repositories'; +import { ActivityEntity } from 'src/infra/entities/activity.entity'; +import { ActivitySearch } from 'src/infra/repositories/activity.repository'; export const IActivityRepository = 'IActivityRepository'; diff --git a/server/src/domain/repositories/album.repository.ts b/server/src/domain/repositories/album.repository.ts index eb4d4bf3d4..2133094129 100644 --- a/server/src/domain/repositories/album.repository.ts +++ b/server/src/domain/repositories/album.repository.ts @@ -1,4 +1,4 @@ -import { AlbumEntity } from '@app/infra/entities'; +import { AlbumEntity } from 'src/infra/entities/album.entity'; export const IAlbumRepository = 'IAlbumRepository'; diff --git a/server/src/domain/repositories/api-key.repository.ts b/server/src/domain/repositories/api-key.repository.ts index 60f26f2358..ff6d97dd55 100644 --- a/server/src/domain/repositories/api-key.repository.ts +++ b/server/src/domain/repositories/api-key.repository.ts @@ -1,4 +1,4 @@ -import { APIKeyEntity } from '@app/infra/entities'; +import { APIKeyEntity } from 'src/infra/entities/api-key.entity'; export const IKeyRepository = 'IKeyRepository'; diff --git a/server/src/domain/repositories/asset-stack.repository.ts b/server/src/domain/repositories/asset-stack.repository.ts index 66201ea3af..32c45b0d19 100644 --- a/server/src/domain/repositories/asset-stack.repository.ts +++ b/server/src/domain/repositories/asset-stack.repository.ts @@ -1,4 +1,4 @@ -import { AssetStackEntity } from '@app/infra/entities/asset-stack.entity'; +import { AssetStackEntity } from 'src/infra/entities/asset-stack.entity'; export const IAssetStackRepository = 'IAssetStackRepository'; diff --git a/server/src/domain/repositories/asset.repository.ts b/server/src/domain/repositories/asset.repository.ts index c504bbb7f2..e8bbdeb389 100644 --- a/server/src/domain/repositories/asset.repository.ts +++ b/server/src/domain/repositories/asset.repository.ts @@ -1,7 +1,11 @@ -import { AssetSearchOptions, ReverseGeocodeResult, SearchExploreItem } from '@app/domain'; -import { AssetEntity, AssetJobStatusEntity, AssetOrder, AssetType, ExifEntity } from '@app/infra/entities'; +import { Paginated, PaginationOptions } from 'src/domain/domain.util'; +import { ReverseGeocodeResult } from 'src/domain/repositories/metadata.repository'; +import { AssetSearchOptions, SearchExploreItem } from 'src/domain/repositories/search.repository'; +import { AssetOrder } from 'src/infra/entities/album.entity'; +import { AssetJobStatusEntity } from 'src/infra/entities/asset-job-status.entity'; +import { AssetEntity, AssetType } from 'src/infra/entities/asset.entity'; +import { ExifEntity } from 'src/infra/entities/exif.entity'; import { FindOptionsRelations, FindOptionsSelect } from 'typeorm'; -import { Paginated, PaginationOptions } from '../domain.util'; export type AssetStats = Record; diff --git a/server/src/domain/repositories/audit.repository.ts b/server/src/domain/repositories/audit.repository.ts index 774ab1e422..36112bfb8e 100644 --- a/server/src/domain/repositories/audit.repository.ts +++ b/server/src/domain/repositories/audit.repository.ts @@ -1,4 +1,4 @@ -import { AuditEntity, DatabaseAction, EntityType } from '@app/infra/entities'; +import { AuditEntity, DatabaseAction, EntityType } from 'src/infra/entities/audit.entity'; export const IAuditRepository = 'IAuditRepository'; diff --git a/server/src/domain/repositories/communication.repository.ts b/server/src/domain/repositories/communication.repository.ts index 3efbbcb5ef..38315a9bb9 100644 --- a/server/src/domain/repositories/communication.repository.ts +++ b/server/src/domain/repositories/communication.repository.ts @@ -1,5 +1,6 @@ -import { AssetResponseDto, ReleaseNotification, ServerVersionResponseDto } from '@app/domain'; -import { SystemConfig } from '@app/infra/entities'; +import { AssetResponseDto } from 'src/domain/asset/response-dto/asset-response.dto'; +import { ReleaseNotification, ServerVersionResponseDto } from 'src/domain/server-info/server-info.dto'; +import { SystemConfig } from 'src/infra/entities/system-config.entity'; export const ICommunicationRepository = 'ICommunicationRepository'; diff --git a/server/src/domain/repositories/database.repository.ts b/server/src/domain/repositories/database.repository.ts index 55911e7ce5..e87775c3ec 100644 --- a/server/src/domain/repositories/database.repository.ts +++ b/server/src/domain/repositories/database.repository.ts @@ -1,4 +1,4 @@ -import { Version } from '../domain.constant'; +import { Version } from 'src/domain/domain.constant'; export enum DatabaseExtension { CUBE = 'cube', diff --git a/server/src/domain/repositories/index.ts b/server/src/domain/repositories/index.ts deleted file mode 100644 index 636abd2bea..0000000000 --- a/server/src/domain/repositories/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -export * from './access.repository'; -export * from './activity.repository'; -export * from './album.repository'; -export * from './api-key.repository'; -export * from './asset-stack.repository'; -export * from './asset.repository'; -export * from './audit.repository'; -export * from './communication.repository'; -export * from './crypto.repository'; -export * from './database.repository'; -export * from './job.repository'; -export * from './library.repository'; -export * from './machine-learning.repository'; -export * from './media.repository'; -export * from './metadata.repository'; -export * from './move.repository'; -export * from './partner.repository'; -export * from './person.repository'; -export * from './search.repository'; -export * from './server-info.repository'; -export * from './shared-link.repository'; -export * from './storage.repository'; -export * from './system-config.repository'; -export * from './system-metadata.repository'; -export * from './tag.repository'; -export * from './user-token.repository'; -export * from './user.repository'; diff --git a/server/src/domain/repositories/job.repository.ts b/server/src/domain/repositories/job.repository.ts index 3d31dd16b2..023f6a8e9c 100644 --- a/server/src/domain/repositories/job.repository.ts +++ b/server/src/domain/repositories/job.repository.ts @@ -1,5 +1,4 @@ -import { JobName, QueueName } from '../job/job.constants'; - +import { JobName, QueueName } from 'src/domain/job/job.constants'; import { IAssetDeletionJob, IBaseJob, @@ -9,7 +8,7 @@ import { ILibraryFileJob, ILibraryRefreshJob, ISidecarWriteJob, -} from '../job/job.interface'; +} from 'src/domain/job/job.interface'; export interface JobCounts { active: number; diff --git a/server/src/domain/repositories/library.repository.ts b/server/src/domain/repositories/library.repository.ts index 395373bcc9..39b94f87cc 100644 --- a/server/src/domain/repositories/library.repository.ts +++ b/server/src/domain/repositories/library.repository.ts @@ -1,5 +1,5 @@ -import { LibraryEntity, LibraryType } from '@app/infra/entities'; -import { LibraryStatsResponseDto } from '../library/library.dto'; +import { LibraryStatsResponseDto } from 'src/domain/library/library.dto'; +import { LibraryEntity, LibraryType } from 'src/infra/entities/library.entity'; export const ILibraryRepository = 'ILibraryRepository'; diff --git a/server/src/domain/repositories/machine-learning.repository.ts b/server/src/domain/repositories/machine-learning.repository.ts index f327a7a701..d11e2e8f70 100644 --- a/server/src/domain/repositories/machine-learning.repository.ts +++ b/server/src/domain/repositories/machine-learning.repository.ts @@ -1,4 +1,4 @@ -import { CLIPConfig, RecognitionConfig } from '../smart-info/dto'; +import { CLIPConfig, RecognitionConfig } from 'src/domain/smart-info/dto/model-config.dto'; export const IMachineLearningRepository = 'IMachineLearningRepository'; diff --git a/server/src/domain/repositories/media.repository.ts b/server/src/domain/repositories/media.repository.ts index ed6f884493..09bcd7eeff 100644 --- a/server/src/domain/repositories/media.repository.ts +++ b/server/src/domain/repositories/media.repository.ts @@ -1,5 +1,5 @@ -import { TranscodeTarget, VideoCodec } from '@app/infra/entities'; import { Writable } from 'node:stream'; +import { TranscodeTarget, VideoCodec } from 'src/infra/entities/system-config.entity'; export const IMediaRepository = 'IMediaRepository'; diff --git a/server/src/domain/repositories/move.repository.ts b/server/src/domain/repositories/move.repository.ts index 20caa117fe..eb191021f3 100644 --- a/server/src/domain/repositories/move.repository.ts +++ b/server/src/domain/repositories/move.repository.ts @@ -1,4 +1,4 @@ -import { MoveEntity, PathType } from '@app/infra/entities'; +import { MoveEntity, PathType } from 'src/infra/entities/move.entity'; export const IMoveRepository = 'IMoveRepository'; diff --git a/server/src/domain/repositories/partner.repository.ts b/server/src/domain/repositories/partner.repository.ts index f0409b67ac..5606fc4953 100644 --- a/server/src/domain/repositories/partner.repository.ts +++ b/server/src/domain/repositories/partner.repository.ts @@ -1,4 +1,4 @@ -import { PartnerEntity } from '@app/infra/entities'; +import { PartnerEntity } from 'src/infra/entities/partner.entity'; export interface PartnerIds { sharedById: string; diff --git a/server/src/domain/repositories/person.repository.ts b/server/src/domain/repositories/person.repository.ts index 85c11fe921..93787f7b90 100644 --- a/server/src/domain/repositories/person.repository.ts +++ b/server/src/domain/repositories/person.repository.ts @@ -1,6 +1,8 @@ -import { AssetEntity, AssetFaceEntity, PersonEntity } from '@app/infra/entities'; +import { Paginated, PaginationOptions } from 'src/domain/domain.util'; +import { AssetFaceEntity } from 'src/infra/entities/asset-face.entity'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { PersonEntity } from 'src/infra/entities/person.entity'; import { FindManyOptions, FindOptionsRelations, FindOptionsSelect } from 'typeorm'; -import { Paginated, PaginationOptions } from '../domain.util'; export const IPersonRepository = 'IPersonRepository'; diff --git a/server/src/domain/repositories/search.repository.ts b/server/src/domain/repositories/search.repository.ts index bd4face86c..3dc9c1ea50 100644 --- a/server/src/domain/repositories/search.repository.ts +++ b/server/src/domain/repositories/search.repository.ts @@ -1,5 +1,8 @@ -import { AssetEntity, AssetFaceEntity, AssetType, GeodataPlacesEntity, SmartInfoEntity } from '@app/infra/entities'; -import { Paginated } from '../domain.util'; +import { Paginated } from 'src/domain/domain.util'; +import { AssetFaceEntity } from 'src/infra/entities/asset-face.entity'; +import { AssetEntity, AssetType } from 'src/infra/entities/asset.entity'; +import { GeodataPlacesEntity } from 'src/infra/entities/geodata-places.entity'; +import { SmartInfoEntity } from 'src/infra/entities/smart-info.entity'; export const ISearchRepository = 'ISearchRepository'; diff --git a/server/src/domain/repositories/shared-link.repository.ts b/server/src/domain/repositories/shared-link.repository.ts index 0f0255d0a3..0d5e8eca71 100644 --- a/server/src/domain/repositories/shared-link.repository.ts +++ b/server/src/domain/repositories/shared-link.repository.ts @@ -1,4 +1,4 @@ -import { SharedLinkEntity } from '@app/infra/entities'; +import { SharedLinkEntity } from 'src/infra/entities/shared-link.entity'; export const ISharedLinkRepository = 'ISharedLinkRepository'; diff --git a/server/src/domain/repositories/storage.repository.ts b/server/src/domain/repositories/storage.repository.ts index a052596c02..505e535b08 100644 --- a/server/src/domain/repositories/storage.repository.ts +++ b/server/src/domain/repositories/storage.repository.ts @@ -2,7 +2,7 @@ import { WatchOptions } from 'chokidar'; import { Stats } from 'node:fs'; import { FileReadOptions } from 'node:fs/promises'; import { Readable } from 'node:stream'; -import { CrawlOptionsDto } from '../library'; +import { CrawlOptionsDto } from 'src/domain/library/library.dto'; export interface ImmichReadStream { stream: Readable; diff --git a/server/src/domain/repositories/system-config.repository.ts b/server/src/domain/repositories/system-config.repository.ts index d154f6efff..86b3114856 100644 --- a/server/src/domain/repositories/system-config.repository.ts +++ b/server/src/domain/repositories/system-config.repository.ts @@ -1,4 +1,4 @@ -import { SystemConfigEntity } from '@app/infra/entities'; +import { SystemConfigEntity } from 'src/infra/entities/system-config.entity'; export const ISystemConfigRepository = 'ISystemConfigRepository'; diff --git a/server/src/domain/repositories/system-metadata.repository.ts b/server/src/domain/repositories/system-metadata.repository.ts index 4d571953bc..d28713226e 100644 --- a/server/src/domain/repositories/system-metadata.repository.ts +++ b/server/src/domain/repositories/system-metadata.repository.ts @@ -1,4 +1,4 @@ -import { SystemMetadata } from '@app/infra/entities'; +import { SystemMetadata } from 'src/infra/entities/system-metadata.entity'; export const ISystemMetadataRepository = 'ISystemMetadataRepository'; diff --git a/server/src/domain/repositories/tag.repository.ts b/server/src/domain/repositories/tag.repository.ts index 4e6f583b42..47c3f40fa7 100644 --- a/server/src/domain/repositories/tag.repository.ts +++ b/server/src/domain/repositories/tag.repository.ts @@ -1,4 +1,5 @@ -import { AssetEntity, TagEntity } from '@app/infra/entities'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { TagEntity } from 'src/infra/entities/tag.entity'; export const ITagRepository = 'ITagRepository'; diff --git a/server/src/domain/repositories/user-token.repository.ts b/server/src/domain/repositories/user-token.repository.ts index 713b3f1ef8..2d342a2fcc 100644 --- a/server/src/domain/repositories/user-token.repository.ts +++ b/server/src/domain/repositories/user-token.repository.ts @@ -1,4 +1,4 @@ -import { UserTokenEntity } from '@app/infra/entities'; +import { UserTokenEntity } from 'src/infra/entities/user-token.entity'; export const IUserTokenRepository = 'IUserTokenRepository'; diff --git a/server/src/domain/repositories/user.repository.ts b/server/src/domain/repositories/user.repository.ts index efd950318f..be5ef165d5 100644 --- a/server/src/domain/repositories/user.repository.ts +++ b/server/src/domain/repositories/user.repository.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/infra/entities'; +import { UserEntity } from 'src/infra/entities/user.entity'; export interface UserListFilter { withDeleted?: boolean; diff --git a/server/src/domain/search/dto/index.ts b/server/src/domain/search/dto/index.ts deleted file mode 100644 index cd914d0ea7..0000000000 --- a/server/src/domain/search/dto/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './search.dto'; diff --git a/server/src/domain/search/dto/search-suggestion.dto.ts b/server/src/domain/search/dto/search-suggestion.dto.ts index 824a1066c4..f2f70062a0 100644 --- a/server/src/domain/search/dto/search-suggestion.dto.ts +++ b/server/src/domain/search/dto/search-suggestion.dto.ts @@ -1,6 +1,6 @@ import { ApiProperty } from '@nestjs/swagger'; import { IsEnum, IsNotEmpty, IsString } from 'class-validator'; -import { Optional } from '../../domain.util'; +import { Optional } from 'src/domain/domain.util'; export enum SearchSuggestionType { COUNTRY = 'country', diff --git a/server/src/domain/search/dto/search.dto.ts b/server/src/domain/search/dto/search.dto.ts index 1bc67266a3..0dcaa22fb5 100644 --- a/server/src/domain/search/dto/search.dto.ts +++ b/server/src/domain/search/dto/search.dto.ts @@ -1,8 +1,10 @@ -import { AssetOrder, AssetType, GeodataPlacesEntity } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { Type } from 'class-transformer'; import { IsEnum, IsInt, IsNotEmpty, IsString, Max, Min } from 'class-validator'; -import { Optional, ValidateBoolean, ValidateDate, ValidateUUID } from '../../domain.util'; +import { Optional, ValidateBoolean, ValidateDate, ValidateUUID } from 'src/domain/domain.util'; +import { AssetOrder } from 'src/infra/entities/album.entity'; +import { AssetType } from 'src/infra/entities/asset.entity'; +import { GeodataPlacesEntity } from 'src/infra/entities/geodata-places.entity'; class BaseSearchDto { @ValidateUUID({ optional: true }) diff --git a/server/src/domain/search/index.ts b/server/src/domain/search/index.ts deleted file mode 100644 index 717439d3cc..0000000000 --- a/server/src/domain/search/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './dto'; -export * from './response-dto'; -export * from './search.service'; diff --git a/server/src/domain/search/response-dto/index.ts b/server/src/domain/search/response-dto/index.ts deleted file mode 100644 index f48856bca8..0000000000 --- a/server/src/domain/search/response-dto/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './search-explore.response.dto'; -export * from './search-response.dto'; diff --git a/server/src/domain/search/response-dto/search-explore.response.dto.ts b/server/src/domain/search/response-dto/search-explore.response.dto.ts index 37398d9dec..33689b9797 100644 --- a/server/src/domain/search/response-dto/search-explore.response.dto.ts +++ b/server/src/domain/search/response-dto/search-explore.response.dto.ts @@ -1,4 +1,4 @@ -import { AssetResponseDto } from '../../asset'; +import { AssetResponseDto } from 'src/domain/asset/response-dto/asset-response.dto'; class SearchExploreItem { value!: string; diff --git a/server/src/domain/search/response-dto/search-response.dto.ts b/server/src/domain/search/response-dto/search-response.dto.ts index 9dd65e7cc3..53563a9ac8 100644 --- a/server/src/domain/search/response-dto/search-response.dto.ts +++ b/server/src/domain/search/response-dto/search-response.dto.ts @@ -1,6 +1,6 @@ import { ApiProperty } from '@nestjs/swagger'; -import { AlbumResponseDto } from '../../album'; -import { AssetResponseDto } from '../../asset'; +import { AlbumResponseDto } from 'src/domain/album/album-response.dto'; +import { AssetResponseDto } from 'src/domain/asset/response-dto/asset-response.dto'; class SearchFacetCountResponseDto { @ApiProperty({ type: 'integer' }) diff --git a/server/src/domain/search/search.service.spec.ts b/server/src/domain/search/search.service.spec.ts index b6edf1ece9..ae5e94a76e 100644 --- a/server/src/domain/search/search.service.spec.ts +++ b/server/src/domain/search/search.service.spec.ts @@ -1,28 +1,24 @@ -import { SystemConfigKey } from '@app/infra/entities'; -import { - assetStub, - authStub, - newAssetRepositoryMock, - newMachineLearningRepositoryMock, - newMetadataRepositoryMock, - newPartnerRepositoryMock, - newPersonRepositoryMock, - newSearchRepositoryMock, - newSystemConfigRepositoryMock, - personStub, -} from '@test'; -import { mapAsset } from '../asset'; -import { - IAssetRepository, - IMachineLearningRepository, - IMetadataRepository, - IPartnerRepository, - IPersonRepository, - ISearchRepository, - ISystemConfigRepository, -} from '../repositories'; -import { SearchDto } from './dto'; -import { SearchService } from './search.service'; +import { mapAsset } from 'src/domain/asset/response-dto/asset-response.dto'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { IMachineLearningRepository } from 'src/domain/repositories/machine-learning.repository'; +import { IMetadataRepository } from 'src/domain/repositories/metadata.repository'; +import { IPartnerRepository } from 'src/domain/repositories/partner.repository'; +import { IPersonRepository } from 'src/domain/repositories/person.repository'; +import { ISearchRepository } from 'src/domain/repositories/search.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { SearchDto } from 'src/domain/search/dto/search.dto'; +import { SearchService } from 'src/domain/search/search.service'; +import { SystemConfigKey } from 'src/infra/entities/system-config.entity'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { authStub } from 'test/fixtures/auth.stub'; +import { personStub } from 'test/fixtures/person.stub'; +import { newAssetRepositoryMock } from 'test/repositories/asset.repository.mock'; +import { newMachineLearningRepositoryMock } from 'test/repositories/machine-learning.repository.mock'; +import { newMetadataRepositoryMock } from 'test/repositories/metadata.repository.mock'; +import { newPartnerRepositoryMock } from 'test/repositories/partner.repository.mock'; +import { newPersonRepositoryMock } from 'test/repositories/person.repository.mock'; +import { newSearchRepositoryMock } from 'test/repositories/search.repository.mock'; +import { newSystemConfigRepositoryMock } from 'test/repositories/system-config.repository.mock'; jest.useFakeTimers(); diff --git a/server/src/domain/search/search.service.ts b/server/src/domain/search/search.service.ts index 4b15dfd51c..bb7e31bfaf 100644 --- a/server/src/domain/search/search.service.ts +++ b/server/src/domain/search/search.service.ts @@ -1,20 +1,15 @@ -import { AssetEntity, AssetOrder } from '@app/infra/entities'; import { Inject, Injectable } from '@nestjs/common'; -import { AssetResponseDto, mapAsset } from '../asset'; -import { AuthDto } from '../auth'; -import { PersonResponseDto } from '../person'; -import { - IAssetRepository, - IMachineLearningRepository, - IMetadataRepository, - IPartnerRepository, - IPersonRepository, - ISearchRepository, - ISystemConfigRepository, - SearchExploreItem, - SearchStrategy, -} from '../repositories'; -import { FeatureFlag, SystemConfigCore } from '../system-config'; +import { AssetResponseDto, mapAsset } from 'src/domain/asset/response-dto/asset-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { PersonResponseDto } from 'src/domain/person/person.dto'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { IMachineLearningRepository } from 'src/domain/repositories/machine-learning.repository'; +import { IMetadataRepository } from 'src/domain/repositories/metadata.repository'; +import { IPartnerRepository } from 'src/domain/repositories/partner.repository'; +import { IPersonRepository } from 'src/domain/repositories/person.repository'; +import { ISearchRepository, SearchExploreItem, SearchStrategy } from 'src/domain/repositories/search.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { SearchSuggestionRequestDto, SearchSuggestionType } from 'src/domain/search/dto/search-suggestion.dto'; import { MetadataSearchDto, PlacesResponseDto, @@ -23,9 +18,11 @@ import { SearchPlacesDto, SmartSearchDto, mapPlaces, -} from './dto'; -import { SearchSuggestionRequestDto, SearchSuggestionType } from './dto/search-suggestion.dto'; -import { SearchResponseDto } from './response-dto'; +} from 'src/domain/search/dto/search.dto'; +import { SearchResponseDto } from 'src/domain/search/response-dto/search-response.dto'; +import { FeatureFlag, SystemConfigCore } from 'src/domain/system-config/system-config.core'; +import { AssetOrder } from 'src/infra/entities/album.entity'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; @Injectable() export class SearchService { diff --git a/server/src/domain/server-info/index.ts b/server/src/domain/server-info/index.ts deleted file mode 100644 index 74a46a52b8..0000000000 --- a/server/src/domain/server-info/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './server-info.dto'; -export * from './server-info.service'; diff --git a/server/src/domain/server-info/server-info.dto.ts b/server/src/domain/server-info/server-info.dto.ts index 99d4f1566b..07f99a874d 100644 --- a/server/src/domain/server-info/server-info.dto.ts +++ b/server/src/domain/server-info/server-info.dto.ts @@ -1,7 +1,8 @@ -import { FeatureFlags, IVersion, type VersionType } from '@app/domain'; import { ApiProperty, ApiResponseProperty } from '@nestjs/swagger'; import type { DateTime } from 'luxon'; -import { SystemConfigThemeDto } from '../system-config/dto/system-config-theme.dto'; +import { IVersion, VersionType } from 'src/domain/domain.constant'; +import { SystemConfigThemeDto } from 'src/domain/system-config/dto/system-config-theme.dto'; +import { FeatureFlags } from 'src/domain/system-config/system-config.core'; export class ServerPingResponse { @ApiResponseProperty({ type: String, example: 'pong' }) diff --git a/server/src/domain/server-info/server-info.service.spec.ts b/server/src/domain/server-info/server-info.service.spec.ts index 8c90f8107f..41bc8fb6f8 100644 --- a/server/src/domain/server-info/server-info.service.spec.ts +++ b/server/src/domain/server-info/server-info.service.spec.ts @@ -1,22 +1,18 @@ -import { SystemMetadataKey } from '@app/infra/entities'; -import { - newCommunicationRepositoryMock, - newServerInfoRepositoryMock, - newStorageRepositoryMock, - newSystemConfigRepositoryMock, - newSystemMetadataRepositoryMock, - newUserRepositoryMock, -} from '@test'; -import { serverVersion } from '../domain.constant'; -import { - ICommunicationRepository, - IServerInfoRepository, - IStorageRepository, - ISystemConfigRepository, - ISystemMetadataRepository, - IUserRepository, -} from '../repositories'; -import { ServerInfoService } from './server-info.service'; +import { serverVersion } from 'src/domain/domain.constant'; +import { ICommunicationRepository } from 'src/domain/repositories/communication.repository'; +import { IServerInfoRepository } from 'src/domain/repositories/server-info.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { ISystemMetadataRepository } from 'src/domain/repositories/system-metadata.repository'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { ServerInfoService } from 'src/domain/server-info/server-info.service'; +import { SystemMetadataKey } from 'src/infra/entities/system-metadata.entity'; +import { newCommunicationRepositoryMock } from 'test/repositories/communication.repository.mock'; +import { newStorageRepositoryMock } from 'test/repositories/storage.repository.mock'; +import { newSystemConfigRepositoryMock } from 'test/repositories/system-config.repository.mock'; +import { newServerInfoRepositoryMock } from 'test/repositories/system-info.repository.mock'; +import { newSystemMetadataRepositoryMock } from 'test/repositories/system-metadata.repository.mock'; +import { newUserRepositoryMock } from 'test/repositories/user.repository.mock'; describe(ServerInfoService.name, () => { let sut: ServerInfoService; diff --git a/server/src/domain/server-info/server-info.service.ts b/server/src/domain/server-info/server-info.service.ts index 04b3c4b6e6..77c675b87e 100644 --- a/server/src/domain/server-info/server-info.service.ts +++ b/server/src/domain/server-info/server-info.service.ts @@ -1,21 +1,13 @@ -import { SystemMetadataKey } from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; import { Inject, Injectable } from '@nestjs/common'; import { DateTime } from 'luxon'; -import { Version, isDev, mimeTypes, serverVersion } from '../domain.constant'; -import { asHumanReadable } from '../domain.util'; -import { - ClientEvent, - ICommunicationRepository, - IServerInfoRepository, - IStorageRepository, - ISystemConfigRepository, - ISystemMetadataRepository, - IUserRepository, - UserStatsQueryResponse, -} from '../repositories'; -import { StorageCore, StorageFolder } from '../storage'; -import { SystemConfigCore } from '../system-config'; +import { Version, isDev, mimeTypes, serverVersion } from 'src/domain/domain.constant'; +import { asHumanReadable } from 'src/domain/domain.util'; +import { ClientEvent, ICommunicationRepository } from 'src/domain/repositories/communication.repository'; +import { IServerInfoRepository } from 'src/domain/repositories/server-info.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { ISystemMetadataRepository } from 'src/domain/repositories/system-metadata.repository'; +import { IUserRepository, UserStatsQueryResponse } from 'src/domain/repositories/user.repository'; import { ServerConfigDto, ServerFeaturesDto, @@ -24,7 +16,11 @@ import { ServerPingResponse, ServerStatsResponseDto, UsageByUserDto, -} from './server-info.dto'; +} from 'src/domain/server-info/server-info.dto'; +import { StorageCore, StorageFolder } from 'src/domain/storage/storage.core'; +import { SystemConfigCore } from 'src/domain/system-config/system-config.core'; +import { SystemMetadataKey } from 'src/infra/entities/system-metadata.entity'; +import { ImmichLogger } from 'src/infra/logger'; @Injectable() export class ServerInfoService { diff --git a/server/src/domain/shared-link/index.ts b/server/src/domain/shared-link/index.ts deleted file mode 100644 index 0b47208507..0000000000 --- a/server/src/domain/shared-link/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './shared-link-response.dto'; -export * from './shared-link.dto'; -export * from './shared-link.service'; diff --git a/server/src/domain/shared-link/shared-link-response.dto.ts b/server/src/domain/shared-link/shared-link-response.dto.ts index b16a578f41..034b45f1c1 100644 --- a/server/src/domain/shared-link/shared-link-response.dto.ts +++ b/server/src/domain/shared-link/shared-link-response.dto.ts @@ -1,8 +1,8 @@ -import { SharedLinkEntity, SharedLinkType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import _ from 'lodash'; -import { AlbumResponseDto, mapAlbumWithoutAssets } from '../album'; -import { AssetResponseDto, mapAsset } from '../asset'; +import { AlbumResponseDto, mapAlbumWithoutAssets } from 'src/domain/album/album-response.dto'; +import { AssetResponseDto, mapAsset } from 'src/domain/asset/response-dto/asset-response.dto'; +import { SharedLinkEntity, SharedLinkType } from 'src/infra/entities/shared-link.entity'; export class SharedLinkResponseDto { id!: string; diff --git a/server/src/domain/shared-link/shared-link.dto.ts b/server/src/domain/shared-link/shared-link.dto.ts index 550ed70ea1..ea529979c9 100644 --- a/server/src/domain/shared-link/shared-link.dto.ts +++ b/server/src/domain/shared-link/shared-link.dto.ts @@ -1,7 +1,7 @@ -import { SharedLinkType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { IsEnum, IsString } from 'class-validator'; -import { Optional, ValidateBoolean, ValidateDate, ValidateUUID } from '../domain.util'; +import { Optional, ValidateBoolean, ValidateDate, ValidateUUID } from 'src/domain/domain.util'; +import { SharedLinkType } from 'src/infra/entities/shared-link.entity'; export class SharedLinkCreateDto { @IsEnum(SharedLinkType) diff --git a/server/src/domain/shared-link/shared-link.service.spec.ts b/server/src/domain/shared-link/shared-link.service.spec.ts index f0d0715a35..6e2da5a64b 100644 --- a/server/src/domain/shared-link/shared-link.service.spec.ts +++ b/server/src/domain/shared-link/shared-link.service.spec.ts @@ -1,20 +1,17 @@ -import { SharedLinkType } from '@app/infra/entities'; import { BadRequestException, ForbiddenException, UnauthorizedException } from '@nestjs/common'; -import { - IAccessRepositoryMock, - albumStub, - assetStub, - authStub, - newAccessRepositoryMock, - newCryptoRepositoryMock, - newSharedLinkRepositoryMock, - sharedLinkResponseStub, - sharedLinkStub, -} from '@test'; import _ from 'lodash'; -import { AssetIdErrorReason } from '../asset'; -import { ICryptoRepository, ISharedLinkRepository } from '../repositories'; -import { SharedLinkService } from './shared-link.service'; +import { AssetIdErrorReason } from 'src/domain/asset/response-dto/asset-ids-response.dto'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { ISharedLinkRepository } from 'src/domain/repositories/shared-link.repository'; +import { SharedLinkService } from 'src/domain/shared-link/shared-link.service'; +import { SharedLinkType } from 'src/infra/entities/shared-link.entity'; +import { albumStub } from 'test/fixtures/album.stub'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { authStub } from 'test/fixtures/auth.stub'; +import { sharedLinkResponseStub, sharedLinkStub } from 'test/fixtures/shared-link.stub'; +import { IAccessRepositoryMock, newAccessRepositoryMock } from 'test/repositories/access.repository.mock'; +import { newCryptoRepositoryMock } from 'test/repositories/crypto.repository.mock'; +import { newSharedLinkRepositoryMock } from 'test/repositories/shared-link.repository.mock'; describe(SharedLinkService.name, () => { let sut: SharedLinkService; diff --git a/server/src/domain/shared-link/shared-link.service.ts b/server/src/domain/shared-link/shared-link.service.ts index 54e6f60521..a5a28b374f 100644 --- a/server/src/domain/shared-link/shared-link.service.ts +++ b/server/src/domain/shared-link/shared-link.service.ts @@ -1,12 +1,20 @@ -import { AssetEntity, SharedLinkEntity, SharedLinkType } from '@app/infra/entities'; import { BadRequestException, ForbiddenException, Inject, Injectable, UnauthorizedException } from '@nestjs/common'; -import { AccessCore, Permission } from '../access'; -import { AssetIdErrorReason, AssetIdsDto, AssetIdsResponseDto } from '../asset'; -import { AuthDto } from '../auth'; -import { OpenGraphTags } from '../domain.util'; -import { IAccessRepository, ICryptoRepository, ISharedLinkRepository } from '../repositories'; -import { SharedLinkResponseDto, mapSharedLink, mapSharedLinkWithoutMetadata } from './shared-link-response.dto'; -import { SharedLinkCreateDto, SharedLinkEditDto, SharedLinkPasswordDto } from './shared-link.dto'; +import { AccessCore, Permission } from 'src/domain/access/access.core'; +import { AssetIdsDto } from 'src/domain/asset/dto/asset-ids.dto'; +import { AssetIdErrorReason, AssetIdsResponseDto } from 'src/domain/asset/response-dto/asset-ids-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { OpenGraphTags } from 'src/domain/domain.util'; +import { IAccessRepository } from 'src/domain/repositories/access.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { ISharedLinkRepository } from 'src/domain/repositories/shared-link.repository'; +import { + SharedLinkResponseDto, + mapSharedLink, + mapSharedLinkWithoutMetadata, +} from 'src/domain/shared-link/shared-link-response.dto'; +import { SharedLinkCreateDto, SharedLinkEditDto, SharedLinkPasswordDto } from 'src/domain/shared-link/shared-link.dto'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { SharedLinkEntity, SharedLinkType } from 'src/infra/entities/shared-link.entity'; @Injectable() export class SharedLinkService { diff --git a/server/src/domain/smart-info/dto/index.ts b/server/src/domain/smart-info/dto/index.ts deleted file mode 100644 index aa672a787c..0000000000 --- a/server/src/domain/smart-info/dto/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './model-config.dto'; diff --git a/server/src/domain/smart-info/dto/model-config.dto.ts b/server/src/domain/smart-info/dto/model-config.dto.ts index b9e27669f3..0b12e1cc61 100644 --- a/server/src/domain/smart-info/dto/model-config.dto.ts +++ b/server/src/domain/smart-info/dto/model-config.dto.ts @@ -1,8 +1,8 @@ import { ApiProperty } from '@nestjs/swagger'; import { Type } from 'class-transformer'; import { IsEnum, IsNotEmpty, IsNumber, IsString, Max, Min } from 'class-validator'; -import { Optional, ValidateBoolean } from '../../domain.util'; -import { CLIPMode, ModelType } from '../../repositories'; +import { Optional, ValidateBoolean } from 'src/domain/domain.util'; +import { CLIPMode, ModelType } from 'src/domain/repositories/machine-learning.repository'; export class ModelConfig { @ValidateBoolean() diff --git a/server/src/domain/smart-info/index.ts b/server/src/domain/smart-info/index.ts deleted file mode 100644 index a0cbeecf4d..0000000000 --- a/server/src/domain/smart-info/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './dto'; -export * from './smart-info.service'; diff --git a/server/src/domain/smart-info/smart-info.service.spec.ts b/server/src/domain/smart-info/smart-info.service.spec.ts index 712c2b6a77..e83e823db9 100644 --- a/server/src/domain/smart-info/smart-info.service.spec.ts +++ b/server/src/domain/smart-info/smart-info.service.spec.ts @@ -1,25 +1,21 @@ -import { AssetEntity, SystemConfigKey } from '@app/infra/entities'; -import { - assetStub, - newAssetRepositoryMock, - newDatabaseRepositoryMock, - newJobRepositoryMock, - newMachineLearningRepositoryMock, - newSearchRepositoryMock, - newSystemConfigRepositoryMock, -} from '@test'; -import { JobName } from '../job'; -import { - IAssetRepository, - IDatabaseRepository, - IJobRepository, - IMachineLearningRepository, - ISearchRepository, - ISystemConfigRepository, - WithoutProperty, -} from '../repositories'; -import { cleanModelName, getCLIPModelInfo } from './smart-info.constant'; -import { SmartInfoService } from './smart-info.service'; +import { JobName } from 'src/domain/job/job.constants'; +import { IAssetRepository, WithoutProperty } from 'src/domain/repositories/asset.repository'; +import { IDatabaseRepository } from 'src/domain/repositories/database.repository'; +import { IJobRepository } from 'src/domain/repositories/job.repository'; +import { IMachineLearningRepository } from 'src/domain/repositories/machine-learning.repository'; +import { ISearchRepository } from 'src/domain/repositories/search.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { cleanModelName, getCLIPModelInfo } from 'src/domain/smart-info/smart-info.constant'; +import { SmartInfoService } from 'src/domain/smart-info/smart-info.service'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { SystemConfigKey } from 'src/infra/entities/system-config.entity'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { newAssetRepositoryMock } from 'test/repositories/asset.repository.mock'; +import { newDatabaseRepositoryMock } from 'test/repositories/database.repository.mock'; +import { newJobRepositoryMock } from 'test/repositories/job.repository.mock'; +import { newMachineLearningRepositoryMock } from 'test/repositories/machine-learning.repository.mock'; +import { newSearchRepositoryMock } from 'test/repositories/search.repository.mock'; +import { newSystemConfigRepositoryMock } from 'test/repositories/system-config.repository.mock'; const asset = { id: 'asset-1', diff --git a/server/src/domain/smart-info/smart-info.service.ts b/server/src/domain/smart-info/smart-info.service.ts index b7dd1a91f0..8f20f56d50 100644 --- a/server/src/domain/smart-info/smart-info.service.ts +++ b/server/src/domain/smart-info/smart-info.service.ts @@ -1,19 +1,15 @@ -import { ImmichLogger } from '@app/infra/logger'; import { Inject, Injectable } from '@nestjs/common'; -import { usePagination } from '../domain.util'; -import { IBaseJob, IEntityJob, JOBS_ASSET_PAGINATION_SIZE, JobName, QueueName } from '../job'; -import { - DatabaseLock, - IAssetRepository, - IDatabaseRepository, - IJobRepository, - IMachineLearningRepository, - ISearchRepository, - ISystemConfigRepository, - JobStatus, - WithoutProperty, -} from '../repositories'; -import { SystemConfigCore } from '../system-config'; +import { usePagination } from 'src/domain/domain.util'; +import { JOBS_ASSET_PAGINATION_SIZE, JobName, QueueName } from 'src/domain/job/job.constants'; +import { IBaseJob, IEntityJob } from 'src/domain/job/job.interface'; +import { IAssetRepository, WithoutProperty } from 'src/domain/repositories/asset.repository'; +import { DatabaseLock, IDatabaseRepository } from 'src/domain/repositories/database.repository'; +import { IJobRepository, JobStatus } from 'src/domain/repositories/job.repository'; +import { IMachineLearningRepository } from 'src/domain/repositories/machine-learning.repository'; +import { ISearchRepository } from 'src/domain/repositories/search.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { SystemConfigCore } from 'src/domain/system-config/system-config.core'; +import { ImmichLogger } from 'src/infra/logger'; @Injectable() export class SmartInfoService { diff --git a/server/src/domain/storage-template/index.ts b/server/src/domain/storage-template/index.ts deleted file mode 100644 index f90e363890..0000000000 --- a/server/src/domain/storage-template/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './storage-template.service'; diff --git a/server/src/domain/storage-template/storage-template.service.spec.ts b/server/src/domain/storage-template/storage-template.service.spec.ts index a81e27c8f9..f737090350 100644 --- a/server/src/domain/storage-template/storage-template.service.spec.ts +++ b/server/src/domain/storage-template/storage-template.service.spec.ts @@ -1,34 +1,30 @@ -import { - IAlbumRepository, - IAssetRepository, - ICryptoRepository, - IDatabaseRepository, - IMoveRepository, - IPersonRepository, - IStorageRepository, - ISystemConfigRepository, - IUserRepository, - JobStatus, - StorageTemplateService, - defaults, -} from '@app/domain'; -import { AssetPathType, SystemConfig, SystemConfigKey } from '@app/infra/entities'; -import { - assetStub, - newAlbumRepositoryMock, - newAssetRepositoryMock, - newCryptoRepositoryMock, - newDatabaseRepositoryMock, - newMoveRepositoryMock, - newPersonRepositoryMock, - newStorageRepositoryMock, - newSystemConfigRepositoryMock, - newUserRepositoryMock, - userStub, -} from '@test'; import { when } from 'jest-when'; import { Stats } from 'node:fs'; -import { SystemConfigCore } from '../system-config'; +import { IAlbumRepository } from 'src/domain/repositories/album.repository'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { IDatabaseRepository } from 'src/domain/repositories/database.repository'; +import { JobStatus } from 'src/domain/repositories/job.repository'; +import { IMoveRepository } from 'src/domain/repositories/move.repository'; +import { IPersonRepository } from 'src/domain/repositories/person.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { StorageTemplateService } from 'src/domain/storage-template/storage-template.service'; +import { SystemConfigCore, defaults } from 'src/domain/system-config/system-config.core'; +import { AssetPathType } from 'src/infra/entities/move.entity'; +import { SystemConfig, SystemConfigKey } from 'src/infra/entities/system-config.entity'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { userStub } from 'test/fixtures/user.stub'; +import { newAlbumRepositoryMock } from 'test/repositories/album.repository.mock'; +import { newAssetRepositoryMock } from 'test/repositories/asset.repository.mock'; +import { newCryptoRepositoryMock } from 'test/repositories/crypto.repository.mock'; +import { newDatabaseRepositoryMock } from 'test/repositories/database.repository.mock'; +import { newMoveRepositoryMock } from 'test/repositories/move.repository.mock'; +import { newPersonRepositoryMock } from 'test/repositories/person.repository.mock'; +import { newStorageRepositoryMock } from 'test/repositories/storage.repository.mock'; +import { newSystemConfigRepositoryMock } from 'test/repositories/system-config.repository.mock'; +import { newUserRepositoryMock } from 'test/repositories/user.repository.mock'; describe(StorageTemplateService.name, () => { let sut: StorageTemplateService; diff --git a/server/src/domain/storage-template/storage-template.service.ts b/server/src/domain/storage-template/storage-template.service.ts index ffdbfbefbd..8028eb359b 100644 --- a/server/src/domain/storage-template/storage-template.service.ts +++ b/server/src/domain/storage-template/storage-template.service.ts @@ -1,29 +1,24 @@ -import { AssetEntity, AssetPathType, AssetType, SystemConfig } from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; import { Inject, Injectable } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; import handlebar from 'handlebars'; -import * as luxon from 'luxon'; +import { DateTime } from 'luxon'; import path from 'node:path'; import sanitize from 'sanitize-filename'; -import { getLivePhotoMotionFilename, usePagination } from '../domain.util'; -import { IEntityJob, JOBS_ASSET_PAGINATION_SIZE } from '../job'; -import { - DatabaseLock, - IAlbumRepository, - IAssetRepository, - ICryptoRepository, - IDatabaseRepository, - IMoveRepository, - IPersonRepository, - IStorageRepository, - ISystemConfigRepository, - IUserRepository, - InternalEvent, - InternalEventMap, - JobStatus, -} from '../repositories'; -import { StorageCore, StorageFolder } from '../storage'; +import { getLivePhotoMotionFilename, usePagination } from 'src/domain/domain.util'; +import { JOBS_ASSET_PAGINATION_SIZE } from 'src/domain/job/job.constants'; +import { IEntityJob } from 'src/domain/job/job.interface'; +import { IAlbumRepository } from 'src/domain/repositories/album.repository'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { InternalEvent, InternalEventMap } from 'src/domain/repositories/communication.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { DatabaseLock, IDatabaseRepository } from 'src/domain/repositories/database.repository'; +import { JobStatus } from 'src/domain/repositories/job.repository'; +import { IMoveRepository } from 'src/domain/repositories/move.repository'; +import { IPersonRepository } from 'src/domain/repositories/person.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { StorageCore, StorageFolder } from 'src/domain/storage/storage.core'; import { supportedDayTokens, supportedHourTokens, @@ -32,8 +27,12 @@ import { supportedSecondTokens, supportedWeekTokens, supportedYearTokens, -} from '../system-config'; -import { SystemConfigCore } from '../system-config/system-config.core'; +} from 'src/domain/system-config/system-config.constants'; +import { SystemConfigCore } from 'src/domain/system-config/system-config.core'; +import { AssetEntity, AssetType } from 'src/infra/entities/asset.entity'; +import { AssetPathType } from 'src/infra/entities/move.entity'; +import { SystemConfig } from 'src/infra/entities/system-config.entity'; +import { ImmichLogger } from 'src/infra/logger'; export interface MoveAssetMetadata { storageLabel: string | null; @@ -312,7 +311,7 @@ export class StorageTemplateService { const systemTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; const zone = asset.exifInfo?.timeZone || systemTimeZone; - const dt = luxon.DateTime.fromJSDate(asset.fileCreatedAt, { zone }); + const dt = DateTime.fromJSDate(asset.fileCreatedAt, { zone }); const dateTokens = [ ...supportedYearTokens, diff --git a/server/src/domain/storage/index.ts b/server/src/domain/storage/index.ts deleted file mode 100644 index bdea086bd0..0000000000 --- a/server/src/domain/storage/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './storage.core'; -export * from './storage.service'; diff --git a/server/src/domain/storage/storage.core.ts b/server/src/domain/storage/storage.core.ts index 5cf65ad7cc..1768227eaf 100644 --- a/server/src/domain/storage/storage.core.ts +++ b/server/src/domain/storage/storage.core.ts @@ -1,16 +1,16 @@ -import { SystemConfigCore } from '@app/domain/system-config'; -import { AssetEntity, AssetPathType, PathType, PersonEntity, PersonPathType } from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; import { dirname, join, resolve } from 'node:path'; -import { APP_MEDIA_LOCATION } from '../domain.constant'; -import { - IAssetRepository, - ICryptoRepository, - IMoveRepository, - IPersonRepository, - IStorageRepository, - ISystemConfigRepository, -} from '../repositories'; +import { APP_MEDIA_LOCATION } from 'src/domain/domain.constant'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { IMoveRepository } from 'src/domain/repositories/move.repository'; +import { IPersonRepository } from 'src/domain/repositories/person.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { SystemConfigCore } from 'src/domain/system-config/system-config.core'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { AssetPathType, PathType, PersonPathType } from 'src/infra/entities/move.entity'; +import { PersonEntity } from 'src/infra/entities/person.entity'; +import { ImmichLogger } from 'src/infra/logger'; export enum StorageFolder { ENCODED_VIDEO = 'encoded-video', @@ -46,8 +46,8 @@ export class StorageCore { private moveRepository: IMoveRepository, private personRepository: IPersonRepository, private cryptoRepository: ICryptoRepository, - private systemConfigRepository: ISystemConfigRepository, private repository: IStorageRepository, + systemConfigRepository: ISystemConfigRepository, ) { this.configCore = SystemConfigCore.create(systemConfigRepository); } @@ -66,8 +66,8 @@ export class StorageCore { moveRepository, personRepository, cryptoRepository, - configRepository, repository, + configRepository, ); } diff --git a/server/src/domain/storage/storage.service.spec.ts b/server/src/domain/storage/storage.service.spec.ts index 7858910860..9181af76ea 100644 --- a/server/src/domain/storage/storage.service.spec.ts +++ b/server/src/domain/storage/storage.service.spec.ts @@ -1,6 +1,6 @@ -import { newStorageRepositoryMock } from '@test'; -import { IStorageRepository } from '../repositories'; -import { StorageService } from './storage.service'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { StorageService } from 'src/domain/storage/storage.service'; +import { newStorageRepositoryMock } from 'test/repositories/storage.repository.mock'; describe(StorageService.name, () => { let sut: StorageService; diff --git a/server/src/domain/storage/storage.service.ts b/server/src/domain/storage/storage.service.ts index 95c3118814..08010231e6 100644 --- a/server/src/domain/storage/storage.service.ts +++ b/server/src/domain/storage/storage.service.ts @@ -1,8 +1,9 @@ -import { ImmichLogger } from '@app/infra/logger'; import { Inject, Injectable } from '@nestjs/common'; -import { IDeleteFilesJob } from '../job'; -import { IStorageRepository, JobStatus } from '../repositories'; -import { StorageCore, StorageFolder } from './storage.core'; +import { IDeleteFilesJob } from 'src/domain/job/job.interface'; +import { JobStatus } from 'src/domain/repositories/job.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { StorageCore, StorageFolder } from 'src/domain/storage/storage.core'; +import { ImmichLogger } from 'src/infra/logger'; @Injectable() export class StorageService { diff --git a/server/src/domain/system-config/dto/index.ts b/server/src/domain/system-config/dto/index.ts deleted file mode 100644 index 652e34cc50..0000000000 --- a/server/src/domain/system-config/dto/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export * from './system-config-ffmpeg.dto'; -export * from './system-config-library.dto'; -export * from './system-config-oauth.dto'; -export * from './system-config-password-login.dto'; -export * from './system-config-storage-template.dto'; -export * from './system-config-thumbnail.dto'; -export * from './system-config-trash.dto'; -export * from './system-config.dto'; diff --git a/server/src/domain/system-config/dto/system-config-ffmpeg.dto.ts b/server/src/domain/system-config/dto/system-config-ffmpeg.dto.ts index 3a219888fb..99077176bb 100644 --- a/server/src/domain/system-config/dto/system-config-ffmpeg.dto.ts +++ b/server/src/domain/system-config/dto/system-config-ffmpeg.dto.ts @@ -1,8 +1,15 @@ -import { AudioCodec, CQMode, ToneMapping, TranscodeHWAccel, TranscodePolicy, VideoCodec } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { Type } from 'class-transformer'; import { IsEnum, IsInt, IsString, Max, Min } from 'class-validator'; -import { ValidateBoolean } from '../../domain.util'; +import { ValidateBoolean } from 'src/domain/domain.util'; +import { + AudioCodec, + CQMode, + ToneMapping, + TranscodeHWAccel, + TranscodePolicy, + VideoCodec, +} from 'src/infra/entities/system-config.entity'; export class SystemConfigFFmpegDto { @IsInt() diff --git a/server/src/domain/system-config/dto/system-config-job.dto.ts b/server/src/domain/system-config/dto/system-config-job.dto.ts index 3307811d78..2769da3276 100644 --- a/server/src/domain/system-config/dto/system-config-job.dto.ts +++ b/server/src/domain/system-config/dto/system-config-job.dto.ts @@ -1,7 +1,7 @@ import { ApiProperty } from '@nestjs/swagger'; import { Type } from 'class-transformer'; import { IsInt, IsObject, IsPositive, ValidateNested } from 'class-validator'; -import { ConcurrentQueueName, QueueName } from '../../job'; +import { ConcurrentQueueName, QueueName } from 'src/domain/job/job.constants'; export class JobSettingsDto { @IsInt() diff --git a/server/src/domain/system-config/dto/system-config-library.dto.ts b/server/src/domain/system-config/dto/system-config-library.dto.ts index 85ab626345..f322423dff 100644 --- a/server/src/domain/system-config/dto/system-config-library.dto.ts +++ b/server/src/domain/system-config/dto/system-config-library.dto.ts @@ -9,7 +9,7 @@ import { ValidatorConstraint, ValidatorConstraintInterface, } from 'class-validator'; -import { ValidateBoolean, validateCronExpression } from '../../domain.util'; +import { ValidateBoolean, validateCronExpression } from 'src/domain/domain.util'; const isEnabled = (config: SystemConfigLibraryScanDto) => config.enabled; diff --git a/server/src/domain/system-config/dto/system-config-logging.dto.ts b/server/src/domain/system-config/dto/system-config-logging.dto.ts index 09f78fc862..0f1664ee39 100644 --- a/server/src/domain/system-config/dto/system-config-logging.dto.ts +++ b/server/src/domain/system-config/dto/system-config-logging.dto.ts @@ -1,7 +1,7 @@ -import { LogLevel } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { IsEnum } from 'class-validator'; -import { ValidateBoolean } from '../../domain.util'; +import { ValidateBoolean } from 'src/domain/domain.util'; +import { LogLevel } from 'src/infra/entities/system-config.entity'; export class SystemConfigLoggingDto { @ValidateBoolean() diff --git a/server/src/domain/system-config/dto/system-config-machine-learning.dto.ts b/server/src/domain/system-config/dto/system-config-machine-learning.dto.ts index 435e688268..1b33d5920f 100644 --- a/server/src/domain/system-config/dto/system-config-machine-learning.dto.ts +++ b/server/src/domain/system-config/dto/system-config-machine-learning.dto.ts @@ -1,7 +1,7 @@ import { Type } from 'class-transformer'; import { IsObject, IsUrl, ValidateIf, ValidateNested } from 'class-validator'; -import { ValidateBoolean } from '../../domain.util'; -import { CLIPConfig, RecognitionConfig } from '../../smart-info/dto/model-config.dto'; +import { ValidateBoolean } from 'src/domain/domain.util'; +import { CLIPConfig, RecognitionConfig } from 'src/domain/smart-info/dto/model-config.dto'; export class SystemConfigMachineLearningDto { @ValidateBoolean() diff --git a/server/src/domain/system-config/dto/system-config-map.dto.ts b/server/src/domain/system-config/dto/system-config-map.dto.ts index 9e21e2d5de..fb8aac5935 100644 --- a/server/src/domain/system-config/dto/system-config-map.dto.ts +++ b/server/src/domain/system-config/dto/system-config-map.dto.ts @@ -1,5 +1,5 @@ import { IsString } from 'class-validator'; -import { ValidateBoolean } from '../../domain.util'; +import { ValidateBoolean } from 'src/domain/domain.util'; export class SystemConfigMapDto { @ValidateBoolean() diff --git a/server/src/domain/system-config/dto/system-config-new-version-check.dto.ts b/server/src/domain/system-config/dto/system-config-new-version-check.dto.ts index 379f5643de..27afe1e680 100644 --- a/server/src/domain/system-config/dto/system-config-new-version-check.dto.ts +++ b/server/src/domain/system-config/dto/system-config-new-version-check.dto.ts @@ -1,4 +1,4 @@ -import { ValidateBoolean } from '../../domain.util'; +import { ValidateBoolean } from 'src/domain/domain.util'; export class SystemConfigNewVersionCheckDto { @ValidateBoolean() diff --git a/server/src/domain/system-config/dto/system-config-oauth.dto.ts b/server/src/domain/system-config/dto/system-config-oauth.dto.ts index 99779bdfe4..13465b7722 100644 --- a/server/src/domain/system-config/dto/system-config-oauth.dto.ts +++ b/server/src/domain/system-config/dto/system-config-oauth.dto.ts @@ -1,5 +1,5 @@ import { IsNotEmpty, IsNumber, IsString, IsUrl, Min, ValidateIf } from 'class-validator'; -import { ValidateBoolean } from '../../domain.util'; +import { ValidateBoolean } from 'src/domain/domain.util'; const isEnabled = (config: SystemConfigOAuthDto) => config.enabled; const isOverrideEnabled = (config: SystemConfigOAuthDto) => config.mobileOverrideEnabled; diff --git a/server/src/domain/system-config/dto/system-config-password-login.dto.ts b/server/src/domain/system-config/dto/system-config-password-login.dto.ts index 279bcc5a61..3d98ae0459 100644 --- a/server/src/domain/system-config/dto/system-config-password-login.dto.ts +++ b/server/src/domain/system-config/dto/system-config-password-login.dto.ts @@ -1,4 +1,4 @@ -import { ValidateBoolean } from '../../domain.util'; +import { ValidateBoolean } from 'src/domain/domain.util'; export class SystemConfigPasswordLoginDto { @ValidateBoolean() diff --git a/server/src/domain/system-config/dto/system-config-reverse-geocoding.dto.ts b/server/src/domain/system-config/dto/system-config-reverse-geocoding.dto.ts index 11e0ae289d..ad4bcaab64 100644 --- a/server/src/domain/system-config/dto/system-config-reverse-geocoding.dto.ts +++ b/server/src/domain/system-config/dto/system-config-reverse-geocoding.dto.ts @@ -1,4 +1,4 @@ -import { ValidateBoolean } from '../../domain.util'; +import { ValidateBoolean } from 'src/domain/domain.util'; export class SystemConfigReverseGeocodingDto { @ValidateBoolean() diff --git a/server/src/domain/system-config/dto/system-config-storage-template.dto.ts b/server/src/domain/system-config/dto/system-config-storage-template.dto.ts index 615fd8521c..c35dcd4769 100644 --- a/server/src/domain/system-config/dto/system-config-storage-template.dto.ts +++ b/server/src/domain/system-config/dto/system-config-storage-template.dto.ts @@ -1,5 +1,5 @@ import { IsNotEmpty, IsString } from 'class-validator'; -import { ValidateBoolean } from '../../domain.util'; +import { ValidateBoolean } from 'src/domain/domain.util'; export class SystemConfigStorageTemplateDto { @ValidateBoolean() diff --git a/server/src/domain/system-config/dto/system-config-thumbnail.dto.ts b/server/src/domain/system-config/dto/system-config-thumbnail.dto.ts index c389ef77a2..2f156894f7 100644 --- a/server/src/domain/system-config/dto/system-config-thumbnail.dto.ts +++ b/server/src/domain/system-config/dto/system-config-thumbnail.dto.ts @@ -1,7 +1,7 @@ -import { Colorspace } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { Type } from 'class-transformer'; import { IsEnum, IsInt, Max, Min } from 'class-validator'; +import { Colorspace } from 'src/infra/entities/system-config.entity'; export class SystemConfigThumbnailDto { @IsInt() diff --git a/server/src/domain/system-config/dto/system-config-trash.dto.ts b/server/src/domain/system-config/dto/system-config-trash.dto.ts index 4824107032..8765b4ff19 100644 --- a/server/src/domain/system-config/dto/system-config-trash.dto.ts +++ b/server/src/domain/system-config/dto/system-config-trash.dto.ts @@ -1,7 +1,7 @@ import { ApiProperty } from '@nestjs/swagger'; import { Type } from 'class-transformer'; import { IsInt, Min } from 'class-validator'; -import { ValidateBoolean } from '../../domain.util'; +import { ValidateBoolean } from 'src/domain/domain.util'; export class SystemConfigTrashDto { @ValidateBoolean() diff --git a/server/src/domain/system-config/dto/system-config.dto.ts b/server/src/domain/system-config/dto/system-config.dto.ts index 4906e293e9..4f97975bc2 100644 --- a/server/src/domain/system-config/dto/system-config.dto.ts +++ b/server/src/domain/system-config/dto/system-config.dto.ts @@ -1,22 +1,22 @@ -import { SystemConfig } from '@app/infra/entities'; import { Type } from 'class-transformer'; import { IsObject, ValidateNested } from 'class-validator'; -import { SystemConfigFFmpegDto } from './system-config-ffmpeg.dto'; -import { SystemConfigJobDto } from './system-config-job.dto'; -import { SystemConfigLibraryDto } from './system-config-library.dto'; -import { SystemConfigLoggingDto } from './system-config-logging.dto'; -import { SystemConfigMachineLearningDto } from './system-config-machine-learning.dto'; -import { SystemConfigMapDto } from './system-config-map.dto'; -import { SystemConfigNewVersionCheckDto } from './system-config-new-version-check.dto'; -import { SystemConfigOAuthDto } from './system-config-oauth.dto'; -import { SystemConfigPasswordLoginDto } from './system-config-password-login.dto'; -import { SystemConfigReverseGeocodingDto } from './system-config-reverse-geocoding.dto'; -import { SystemConfigServerDto } from './system-config-server.dto'; -import { SystemConfigStorageTemplateDto } from './system-config-storage-template.dto'; -import { SystemConfigThemeDto } from './system-config-theme.dto'; -import { SystemConfigThumbnailDto } from './system-config-thumbnail.dto'; -import { SystemConfigTrashDto } from './system-config-trash.dto'; -import { SystemConfigUserDto } from './system-config-user.dto'; +import { SystemConfigFFmpegDto } from 'src/domain/system-config/dto/system-config-ffmpeg.dto'; +import { SystemConfigJobDto } from 'src/domain/system-config/dto/system-config-job.dto'; +import { SystemConfigLibraryDto } from 'src/domain/system-config/dto/system-config-library.dto'; +import { SystemConfigLoggingDto } from 'src/domain/system-config/dto/system-config-logging.dto'; +import { SystemConfigMachineLearningDto } from 'src/domain/system-config/dto/system-config-machine-learning.dto'; +import { SystemConfigMapDto } from 'src/domain/system-config/dto/system-config-map.dto'; +import { SystemConfigNewVersionCheckDto } from 'src/domain/system-config/dto/system-config-new-version-check.dto'; +import { SystemConfigOAuthDto } from 'src/domain/system-config/dto/system-config-oauth.dto'; +import { SystemConfigPasswordLoginDto } from 'src/domain/system-config/dto/system-config-password-login.dto'; +import { SystemConfigReverseGeocodingDto } from 'src/domain/system-config/dto/system-config-reverse-geocoding.dto'; +import { SystemConfigServerDto } from 'src/domain/system-config/dto/system-config-server.dto'; +import { SystemConfigStorageTemplateDto } from 'src/domain/system-config/dto/system-config-storage-template.dto'; +import { SystemConfigThemeDto } from 'src/domain/system-config/dto/system-config-theme.dto'; +import { SystemConfigThumbnailDto } from 'src/domain/system-config/dto/system-config-thumbnail.dto'; +import { SystemConfigTrashDto } from 'src/domain/system-config/dto/system-config-trash.dto'; +import { SystemConfigUserDto } from 'src/domain/system-config/dto/system-config-user.dto'; +import { SystemConfig } from 'src/infra/entities/system-config.entity'; export class SystemConfigDto implements SystemConfig { @Type(() => SystemConfigFFmpegDto) diff --git a/server/src/domain/system-config/index.ts b/server/src/domain/system-config/index.ts deleted file mode 100644 index fb71613dd8..0000000000 --- a/server/src/domain/system-config/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './dto'; -export * from './response-dto'; -export * from './system-config.constants'; -export * from './system-config.core'; -export * from './system-config.service'; diff --git a/server/src/domain/system-config/response-dto/index.ts b/server/src/domain/system-config/response-dto/index.ts deleted file mode 100644 index 9cb60bece7..0000000000 --- a/server/src/domain/system-config/response-dto/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './system-config-template-storage-option.dto'; diff --git a/server/src/domain/system-config/system-config.core.ts b/server/src/domain/system-config/system-config.core.ts index 93a4937cb3..999ca3e5be 100644 --- a/server/src/domain/system-config/system-config.core.ts +++ b/server/src/domain/system-config/system-config.core.ts @@ -1,7 +1,17 @@ +import { BadRequestException, ForbiddenException, Injectable } from '@nestjs/common'; +import { CronExpression } from '@nestjs/schedule'; +import { plainToInstance } from 'class-transformer'; +import { validate } from 'class-validator'; +import { load as loadYaml } from 'js-yaml'; +import * as _ from 'lodash'; +import { Subject } from 'rxjs'; +import { QueueName } from 'src/domain/job/job.constants'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { SystemConfigDto } from 'src/domain/system-config/dto/system-config.dto'; import { AudioCodec, - Colorspace, CQMode, + Colorspace, LogLevel, SystemConfig, SystemConfigEntity, @@ -11,18 +21,8 @@ import { TranscodeHWAccel, TranscodePolicy, VideoCodec, -} from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; -import { BadRequestException, ForbiddenException, Injectable } from '@nestjs/common'; -import { CronExpression } from '@nestjs/schedule'; -import { plainToInstance } from 'class-transformer'; -import { validate } from 'class-validator'; -import { load as loadYaml } from 'js-yaml'; -import * as _ from 'lodash'; -import { Subject } from 'rxjs'; -import { QueueName } from '../job/job.constants'; -import { ISystemConfigRepository } from '../repositories'; -import { SystemConfigDto } from './dto'; +} from 'src/infra/entities/system-config.entity'; +import { ImmichLogger } from 'src/infra/logger'; export type SystemConfigValidator = (config: SystemConfig, newConfig: SystemConfig) => void | Promise; diff --git a/server/src/domain/system-config/system-config.service.spec.ts b/server/src/domain/system-config/system-config.service.spec.ts index fd9c164638..ccaea8421c 100644 --- a/server/src/domain/system-config/system-config.service.spec.ts +++ b/server/src/domain/system-config/system-config.service.spec.ts @@ -1,7 +1,14 @@ +import { BadRequestException } from '@nestjs/common'; +import { QueueName } from 'src/domain/job/job.constants'; +import { ICommunicationRepository, ServerEvent } from 'src/domain/repositories/communication.repository'; +import { ISearchRepository } from 'src/domain/repositories/search.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { defaults } from 'src/domain/system-config/system-config.core'; +import { SystemConfigService } from 'src/domain/system-config/system-config.service'; import { AudioCodec, - Colorspace, CQMode, + Colorspace, LogLevel, SystemConfig, SystemConfigEntity, @@ -10,14 +17,10 @@ import { TranscodeHWAccel, TranscodePolicy, VideoCodec, -} from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; -import { BadRequestException } from '@nestjs/common'; -import { newCommunicationRepositoryMock, newSystemConfigRepositoryMock } from '@test'; -import { QueueName } from '../job'; -import { ICommunicationRepository, ISearchRepository, ISystemConfigRepository, ServerEvent } from '../repositories'; -import { defaults } from './system-config.core'; -import { SystemConfigService } from './system-config.service'; +} from 'src/infra/entities/system-config.entity'; +import { ImmichLogger } from 'src/infra/logger'; +import { newCommunicationRepositoryMock } from 'test/repositories/communication.repository.mock'; +import { newSystemConfigRepositoryMock } from 'test/repositories/system-config.repository.mock'; const updates: SystemConfigEntity[] = [ { key: SystemConfigKey.FFMPEG_CRF, value: 30 }, diff --git a/server/src/domain/system-config/system-config.service.ts b/server/src/domain/system-config/system-config.service.ts index 7e68cf0b9b..2c4e1eacce 100644 --- a/server/src/domain/system-config/system-config.service.ts +++ b/server/src/domain/system-config/system-config.service.ts @@ -1,5 +1,3 @@ -import { LogLevel, SystemConfig } from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; import { BadRequestException, Inject, Injectable } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; import { instanceToPlain } from 'class-transformer'; @@ -7,14 +5,14 @@ import _ from 'lodash'; import { ClientEvent, ICommunicationRepository, - ISearchRepository, - ISystemConfigRepository, InternalEvent, InternalEventMap, ServerEvent, -} from '../repositories'; -import { SystemConfigDto, mapConfig } from './dto/system-config.dto'; -import { SystemConfigTemplateStorageOptionDto } from './response-dto/system-config-template-storage-option.dto'; +} from 'src/domain/repositories/communication.repository'; +import { ISearchRepository } from 'src/domain/repositories/search.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { SystemConfigDto, mapConfig } from 'src/domain/system-config/dto/system-config.dto'; +import { SystemConfigTemplateStorageOptionDto } from 'src/domain/system-config/response-dto/system-config-template-storage-option.dto'; import { supportedDayTokens, supportedHourTokens, @@ -24,8 +22,10 @@ import { supportedSecondTokens, supportedWeekTokens, supportedYearTokens, -} from './system-config.constants'; -import { SystemConfigCore } from './system-config.core'; +} from 'src/domain/system-config/system-config.constants'; +import { SystemConfigCore } from 'src/domain/system-config/system-config.core'; +import { LogLevel, SystemConfig } from 'src/infra/entities/system-config.entity'; +import { ImmichLogger } from 'src/infra/logger'; @Injectable() export class SystemConfigService { diff --git a/server/src/domain/tag/index.ts b/server/src/domain/tag/index.ts deleted file mode 100644 index 38e9b389f8..0000000000 --- a/server/src/domain/tag/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './tag-response.dto'; -export * from './tag.dto'; -export * from './tag.service'; diff --git a/server/src/domain/tag/tag-response.dto.ts b/server/src/domain/tag/tag-response.dto.ts index a533b15c9c..04ee9540b8 100644 --- a/server/src/domain/tag/tag-response.dto.ts +++ b/server/src/domain/tag/tag-response.dto.ts @@ -1,5 +1,5 @@ -import { TagEntity, TagType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; +import { TagEntity, TagType } from 'src/infra/entities/tag.entity'; export class TagResponseDto { id!: string; diff --git a/server/src/domain/tag/tag.dto.ts b/server/src/domain/tag/tag.dto.ts index 900aac9bd6..e0c27294a0 100644 --- a/server/src/domain/tag/tag.dto.ts +++ b/server/src/domain/tag/tag.dto.ts @@ -1,7 +1,7 @@ -import { TagType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { IsEnum, IsNotEmpty, IsString } from 'class-validator'; -import { Optional } from '../domain.util'; +import { Optional } from 'src/domain/domain.util'; +import { TagType } from 'src/infra/entities/tag.entity'; export class CreateTagDto { @IsString() diff --git a/server/src/domain/tag/tag.service.spec.ts b/server/src/domain/tag/tag.service.spec.ts index e987beb6a7..ae578068a9 100644 --- a/server/src/domain/tag/tag.service.spec.ts +++ b/server/src/domain/tag/tag.service.spec.ts @@ -1,10 +1,13 @@ -import { TagType } from '@app/infra/entities'; import { BadRequestException } from '@nestjs/common'; -import { assetStub, authStub, newTagRepositoryMock, tagResponseStub, tagStub } from '@test'; import { when } from 'jest-when'; -import { AssetIdErrorReason } from '../asset'; -import { ITagRepository } from '../repositories'; -import { TagService } from './tag.service'; +import { AssetIdErrorReason } from 'src/domain/asset/response-dto/asset-ids-response.dto'; +import { ITagRepository } from 'src/domain/repositories/tag.repository'; +import { TagService } from 'src/domain/tag/tag.service'; +import { TagType } from 'src/infra/entities/tag.entity'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { authStub } from 'test/fixtures/auth.stub'; +import { tagResponseStub, tagStub } from 'test/fixtures/tag.stub'; +import { newTagRepositoryMock } from 'test/repositories/tag.repository.mock'; describe(TagService.name, () => { let sut: TagService; diff --git a/server/src/domain/tag/tag.service.ts b/server/src/domain/tag/tag.service.ts index 38f1de1bcb..3a7a5b5797 100644 --- a/server/src/domain/tag/tag.service.ts +++ b/server/src/domain/tag/tag.service.ts @@ -1,9 +1,11 @@ import { BadRequestException, Inject, Injectable } from '@nestjs/common'; -import { AssetIdErrorReason, AssetIdsDto, AssetIdsResponseDto, AssetResponseDto, mapAsset } from '../asset'; -import { AuthDto } from '../auth'; -import { ITagRepository } from '../repositories'; -import { TagResponseDto, mapTag } from './tag-response.dto'; -import { CreateTagDto, UpdateTagDto } from './tag.dto'; +import { AssetIdsDto } from 'src/domain/asset/dto/asset-ids.dto'; +import { AssetIdErrorReason, AssetIdsResponseDto } from 'src/domain/asset/response-dto/asset-ids-response.dto'; +import { AssetResponseDto, mapAsset } from 'src/domain/asset/response-dto/asset-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { ITagRepository } from 'src/domain/repositories/tag.repository'; +import { TagResponseDto, mapTag } from 'src/domain/tag/tag-response.dto'; +import { CreateTagDto, UpdateTagDto } from 'src/domain/tag/tag.dto'; @Injectable() export class TagService { diff --git a/server/src/domain/trash/index.ts b/server/src/domain/trash/index.ts deleted file mode 100644 index 3cd00e1912..0000000000 --- a/server/src/domain/trash/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './trash.service'; diff --git a/server/src/domain/trash/trash.service.spec.ts b/server/src/domain/trash/trash.service.spec.ts index 81f4186e8d..90320326f5 100644 --- a/server/src/domain/trash/trash.service.spec.ts +++ b/server/src/domain/trash/trash.service.spec.ts @@ -1,16 +1,15 @@ import { BadRequestException } from '@nestjs/common'; -import { - IAccessRepositoryMock, - assetStub, - authStub, - newAccessRepositoryMock, - newAssetRepositoryMock, - newCommunicationRepositoryMock, - newJobRepositoryMock, -} from '@test'; -import { JobName } from '..'; -import { ClientEvent, IAssetRepository, ICommunicationRepository, IJobRepository } from '../repositories'; -import { TrashService } from './trash.service'; +import { JobName } from 'src/domain/job/job.constants'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { ClientEvent, ICommunicationRepository } from 'src/domain/repositories/communication.repository'; +import { IJobRepository } from 'src/domain/repositories/job.repository'; +import { TrashService } from 'src/domain/trash/trash.service'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { authStub } from 'test/fixtures/auth.stub'; +import { IAccessRepositoryMock, newAccessRepositoryMock } from 'test/repositories/access.repository.mock'; +import { newAssetRepositoryMock } from 'test/repositories/asset.repository.mock'; +import { newCommunicationRepositoryMock } from 'test/repositories/communication.repository.mock'; +import { newJobRepositoryMock } from 'test/repositories/job.repository.mock'; describe(TrashService.name, () => { let sut: TrashService; diff --git a/server/src/domain/trash/trash.service.ts b/server/src/domain/trash/trash.service.ts index 30fd6843e2..230ce77f33 100644 --- a/server/src/domain/trash/trash.service.ts +++ b/server/src/domain/trash/trash.service.ts @@ -1,17 +1,14 @@ import { Inject } from '@nestjs/common'; import { DateTime } from 'luxon'; -import { AccessCore, Permission } from '../access'; -import { BulkIdsDto } from '../asset'; -import { AuthDto } from '../auth'; -import { usePagination } from '../domain.util'; -import { JOBS_ASSET_PAGINATION_SIZE, JobName } from '../job'; -import { - ClientEvent, - IAccessRepository, - IAssetRepository, - ICommunicationRepository, - IJobRepository, -} from '../repositories'; +import { AccessCore, Permission } from 'src/domain/access/access.core'; +import { BulkIdsDto } from 'src/domain/asset/response-dto/asset-ids-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { usePagination } from 'src/domain/domain.util'; +import { JOBS_ASSET_PAGINATION_SIZE, JobName } from 'src/domain/job/job.constants'; +import { IAccessRepository } from 'src/domain/repositories/access.repository'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { ClientEvent, ICommunicationRepository } from 'src/domain/repositories/communication.repository'; +import { IJobRepository } from 'src/domain/repositories/job.repository'; export class TrashService { private access: AccessCore; diff --git a/server/src/domain/user/dto/create-profile-image.dto.ts b/server/src/domain/user/dto/create-profile-image.dto.ts index c7a1dc68ba..37a7d13409 100644 --- a/server/src/domain/user/dto/create-profile-image.dto.ts +++ b/server/src/domain/user/dto/create-profile-image.dto.ts @@ -1,5 +1,5 @@ import { ApiProperty } from '@nestjs/swagger'; -import { UploadFieldName } from '../../asset/asset.service'; +import { UploadFieldName } from 'src/domain/asset/asset.service'; export class CreateProfileImageDto { @ApiProperty({ type: 'string', format: 'binary' }) diff --git a/server/src/domain/user/dto/create-user.dto.spec.ts b/server/src/domain/user/dto/create-user.dto.spec.ts index 4e571d38a4..28abc44ad2 100644 --- a/server/src/domain/user/dto/create-user.dto.spec.ts +++ b/server/src/domain/user/dto/create-user.dto.spec.ts @@ -1,6 +1,6 @@ import { plainToInstance } from 'class-transformer'; import { validate } from 'class-validator'; -import { CreateAdminDto, CreateUserDto, CreateUserOAuthDto } from './create-user.dto'; +import { CreateAdminDto, CreateUserDto, CreateUserOAuthDto } from 'src/domain/user/dto/create-user.dto'; describe('create user DTO', () => { it('validates the email', async () => { diff --git a/server/src/domain/user/dto/create-user.dto.ts b/server/src/domain/user/dto/create-user.dto.ts index f0cc7938c6..aa295cb2b5 100644 --- a/server/src/domain/user/dto/create-user.dto.ts +++ b/server/src/domain/user/dto/create-user.dto.ts @@ -1,7 +1,7 @@ import { ApiProperty } from '@nestjs/swagger'; import { Transform } from 'class-transformer'; import { IsEmail, IsNotEmpty, IsNumber, IsPositive, IsString } from 'class-validator'; -import { Optional, ValidateBoolean, toEmail, toSanitized } from '../../domain.util'; +import { Optional, ValidateBoolean, toEmail, toSanitized } from 'src/domain/domain.util'; export class CreateUserDto { @IsEmail({ require_tld: false }) diff --git a/server/src/domain/user/dto/delete-user.dto.ts b/server/src/domain/user/dto/delete-user.dto.ts index 88f55f4af5..09b1c5bf35 100644 --- a/server/src/domain/user/dto/delete-user.dto.ts +++ b/server/src/domain/user/dto/delete-user.dto.ts @@ -1,4 +1,4 @@ -import { ValidateBoolean } from '../../domain.util'; +import { ValidateBoolean } from 'src/domain/domain.util'; export class DeleteUserDto { @ValidateBoolean({ optional: true }) diff --git a/server/src/domain/user/dto/index.ts b/server/src/domain/user/dto/index.ts deleted file mode 100644 index 2d166de368..0000000000 --- a/server/src/domain/user/dto/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './create-profile-image.dto'; -export * from './create-user.dto'; -export * from './delete-user.dto'; -export * from './update-user.dto'; diff --git a/server/src/domain/user/dto/update-user.dto.spec.ts b/server/src/domain/user/dto/update-user.dto.spec.ts index 8e9013f291..0ad407be31 100644 --- a/server/src/domain/user/dto/update-user.dto.spec.ts +++ b/server/src/domain/user/dto/update-user.dto.spec.ts @@ -1,6 +1,6 @@ import { plainToInstance } from 'class-transformer'; import { validate } from 'class-validator'; -import { UpdateUserDto } from './update-user.dto'; +import { UpdateUserDto } from 'src/domain/user/dto/update-user.dto'; describe('update user DTO', () => { it('should allow emails without a tld', async () => { diff --git a/server/src/domain/user/dto/update-user.dto.ts b/server/src/domain/user/dto/update-user.dto.ts index e8cce22141..605017e548 100644 --- a/server/src/domain/user/dto/update-user.dto.ts +++ b/server/src/domain/user/dto/update-user.dto.ts @@ -1,8 +1,8 @@ -import { UserAvatarColor } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { Transform } from 'class-transformer'; import { IsEmail, IsEnum, IsNotEmpty, IsNumber, IsPositive, IsString, IsUUID } from 'class-validator'; -import { Optional, ValidateBoolean, toEmail, toSanitized } from '../../domain.util'; +import { Optional, ValidateBoolean, toEmail, toSanitized } from 'src/domain/domain.util'; +import { UserAvatarColor } from 'src/infra/entities/user.entity'; export class UpdateUserDto { @Optional() diff --git a/server/src/domain/user/index.ts b/server/src/domain/user/index.ts deleted file mode 100644 index 7248591973..0000000000 --- a/server/src/domain/user/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './dto'; -export * from './response-dto'; -export * from './user.core'; -export * from './user.service'; diff --git a/server/src/domain/user/response-dto/index.ts b/server/src/domain/user/response-dto/index.ts deleted file mode 100644 index 8c550a4ff7..0000000000 --- a/server/src/domain/user/response-dto/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './create-profile-image-response.dto'; -export * from './user-response.dto'; diff --git a/server/src/domain/user/response-dto/user-response.dto.ts b/server/src/domain/user/response-dto/user-response.dto.ts index bd437ea344..b2a5d12cf5 100644 --- a/server/src/domain/user/response-dto/user-response.dto.ts +++ b/server/src/domain/user/response-dto/user-response.dto.ts @@ -1,6 +1,6 @@ -import { UserAvatarColor, UserEntity, UserStatus } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { IsEnum } from 'class-validator'; +import { UserAvatarColor, UserEntity, UserStatus } from 'src/infra/entities/user.entity'; export const getRandomAvatarColor = (user: UserEntity): UserAvatarColor => { const values = Object.values(UserAvatarColor); diff --git a/server/src/domain/user/user.core.ts b/server/src/domain/user/user.core.ts index 6134e97cea..0f9022a426 100644 --- a/server/src/domain/user/user.core.ts +++ b/server/src/domain/user/user.core.ts @@ -1,8 +1,11 @@ -import { LibraryType, UserEntity } from '@app/infra/entities'; import { BadRequestException, ForbiddenException } from '@nestjs/common'; import sanitize from 'sanitize-filename'; -import { ICryptoRepository, ILibraryRepository, IUserRepository } from '../repositories'; -import { UserResponseDto } from './response-dto'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { ILibraryRepository } from 'src/domain/repositories/library.repository'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { UserResponseDto } from 'src/domain/user/response-dto/user-response.dto'; +import { LibraryType } from 'src/infra/entities/library.entity'; +import { UserEntity } from 'src/infra/entities/user.entity'; const SALT_ROUNDS = 10; diff --git a/server/src/domain/user/user.service.spec.ts b/server/src/domain/user/user.service.spec.ts index d0e56e4cd3..8fed91c71c 100644 --- a/server/src/domain/user/user.service.spec.ts +++ b/server/src/domain/user/user.service.spec.ts @@ -1,37 +1,33 @@ -import { UserEntity, UserStatus } from '@app/infra/entities'; import { BadRequestException, ForbiddenException, InternalServerErrorException, NotFoundException, } from '@nestjs/common'; -import { - authStub, - newAlbumRepositoryMock, - newCryptoRepositoryMock, - newJobRepositoryMock, - newLibraryRepositoryMock, - newStorageRepositoryMock, - newSystemConfigRepositoryMock, - newUserRepositoryMock, - systemConfigStub, - userStub, -} from '@test'; import { when } from 'jest-when'; -import { CacheControl, ImmichFileResponse } from '../domain.util'; -import { JobName } from '../job'; -import { - IAlbumRepository, - ICryptoRepository, - IJobRepository, - ILibraryRepository, - IStorageRepository, - ISystemConfigRepository, - IUserRepository, -} from '../repositories'; -import { UpdateUserDto } from './dto/update-user.dto'; -import { mapUser } from './response-dto'; -import { UserService } from './user.service'; +import { CacheControl, ImmichFileResponse } from 'src/domain/domain.util'; +import { JobName } from 'src/domain/job/job.constants'; +import { IAlbumRepository } from 'src/domain/repositories/album.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { IJobRepository } from 'src/domain/repositories/job.repository'; +import { ILibraryRepository } from 'src/domain/repositories/library.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { UpdateUserDto } from 'src/domain/user/dto/update-user.dto'; +import { mapUser } from 'src/domain/user/response-dto/user-response.dto'; +import { UserService } from 'src/domain/user/user.service'; +import { UserEntity, UserStatus } from 'src/infra/entities/user.entity'; +import { authStub } from 'test/fixtures/auth.stub'; +import { systemConfigStub } from 'test/fixtures/system-config.stub'; +import { userStub } from 'test/fixtures/user.stub'; +import { newAlbumRepositoryMock } from 'test/repositories/album.repository.mock'; +import { newCryptoRepositoryMock } from 'test/repositories/crypto.repository.mock'; +import { newJobRepositoryMock } from 'test/repositories/job.repository.mock'; +import { newLibraryRepositoryMock } from 'test/repositories/library.repository.mock'; +import { newStorageRepositoryMock } from 'test/repositories/storage.repository.mock'; +import { newSystemConfigRepositoryMock } from 'test/repositories/system-config.repository.mock'; +import { newUserRepositoryMock } from 'test/repositories/user.repository.mock'; const makeDeletedAt = (daysAgo: number) => { const deletedAt = new Date(); diff --git a/server/src/domain/user/user.service.ts b/server/src/domain/user/user.service.ts index a1db1fb04e..18f485b003 100644 --- a/server/src/domain/user/user.service.ts +++ b/server/src/domain/user/user.service.ts @@ -1,27 +1,30 @@ -import { UserEntity, UserStatus } from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; import { BadRequestException, ForbiddenException, Inject, Injectable, NotFoundException } from '@nestjs/common'; import { DateTime } from 'luxon'; import { randomBytes } from 'node:crypto'; -import { AuthDto } from '../auth'; -import { CacheControl, ImmichFileResponse } from '../domain.util'; -import { IEntityJob, JobName } from '../job'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { CacheControl, ImmichFileResponse } from 'src/domain/domain.util'; +import { JobName } from 'src/domain/job/job.constants'; +import { IEntityJob } from 'src/domain/job/job.interface'; +import { IAlbumRepository } from 'src/domain/repositories/album.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { IJobRepository, JobStatus } from 'src/domain/repositories/job.repository'; +import { ILibraryRepository } from 'src/domain/repositories/library.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { IUserRepository, UserFindOptions } from 'src/domain/repositories/user.repository'; +import { StorageCore, StorageFolder } from 'src/domain/storage/storage.core'; +import { SystemConfigCore } from 'src/domain/system-config/system-config.core'; +import { CreateUserDto } from 'src/domain/user/dto/create-user.dto'; +import { DeleteUserDto } from 'src/domain/user/dto/delete-user.dto'; +import { UpdateUserDto } from 'src/domain/user/dto/update-user.dto'; import { - IAlbumRepository, - ICryptoRepository, - IJobRepository, - ILibraryRepository, - IStorageRepository, - ISystemConfigRepository, - IUserRepository, - JobStatus, - UserFindOptions, -} from '../repositories'; -import { StorageCore, StorageFolder } from '../storage'; -import { SystemConfigCore } from '../system-config/system-config.core'; -import { CreateUserDto, DeleteUserDto, UpdateUserDto } from './dto'; -import { CreateProfileImageResponseDto, UserResponseDto, mapCreateProfileImageResponse, mapUser } from './response-dto'; -import { UserCore } from './user.core'; + CreateProfileImageResponseDto, + mapCreateProfileImageResponse, +} from 'src/domain/user/response-dto/create-profile-image-response.dto'; +import { UserResponseDto, mapUser } from 'src/domain/user/response-dto/user-response.dto'; +import { UserCore } from 'src/domain/user/user.core'; +import { UserEntity, UserStatus } from 'src/infra/entities/user.entity'; +import { ImmichLogger } from 'src/infra/logger'; @Injectable() export class UserService { diff --git a/server/src/immich-admin/app.module.ts b/server/src/immich-admin/app.module.ts index b350aec83e..277b39a902 100644 --- a/server/src/immich-admin/app.module.ts +++ b/server/src/immich-admin/app.module.ts @@ -1,10 +1,13 @@ -import { DomainModule } from '@app/domain'; -import { InfraModule } from '@app/infra'; import { Module } from '@nestjs/common'; -import { ListUsersCommand } from './commands/list-users.command'; -import { DisableOAuthLogin, EnableOAuthLogin } from './commands/oauth-login'; -import { DisablePasswordLoginCommand, EnablePasswordLoginCommand } from './commands/password-login'; -import { PromptPasswordQuestions, ResetAdminPasswordCommand } from './commands/reset-admin-password.command'; +import { DomainModule } from 'src/domain/domain.module'; +import { ListUsersCommand } from 'src/immich-admin/commands/list-users.command'; +import { DisableOAuthLogin, EnableOAuthLogin } from 'src/immich-admin/commands/oauth-login'; +import { DisablePasswordLoginCommand, EnablePasswordLoginCommand } from 'src/immich-admin/commands/password-login'; +import { + PromptPasswordQuestions, + ResetAdminPasswordCommand, +} from 'src/immich-admin/commands/reset-admin-password.command'; +import { InfraModule } from 'src/infra/infra.module'; @Module({ imports: [InfraModule, DomainModule], diff --git a/server/src/immich-admin/commands/list-users.command.ts b/server/src/immich-admin/commands/list-users.command.ts index 15ab0a2405..8ab882396e 100644 --- a/server/src/immich-admin/commands/list-users.command.ts +++ b/server/src/immich-admin/commands/list-users.command.ts @@ -1,6 +1,6 @@ -import { UserService } from '@app/domain'; import { Command, CommandRunner } from 'nest-commander'; -import { CLI_USER } from '../constants'; +import { UserService } from 'src/domain/user/user.service'; +import { CLI_USER } from 'src/immich-admin/constants'; @Command({ name: 'list-users', diff --git a/server/src/immich-admin/commands/oauth-login.ts b/server/src/immich-admin/commands/oauth-login.ts index 23747bf03a..12562fae18 100644 --- a/server/src/immich-admin/commands/oauth-login.ts +++ b/server/src/immich-admin/commands/oauth-login.ts @@ -1,5 +1,5 @@ -import { SystemConfigService } from '@app/domain'; import { Command, CommandRunner } from 'nest-commander'; +import { SystemConfigService } from 'src/domain/system-config/system-config.service'; @Command({ name: 'enable-oauth-login', diff --git a/server/src/immich-admin/commands/password-login.ts b/server/src/immich-admin/commands/password-login.ts index e6eea2c725..953a1293ad 100644 --- a/server/src/immich-admin/commands/password-login.ts +++ b/server/src/immich-admin/commands/password-login.ts @@ -1,5 +1,5 @@ -import { SystemConfigService } from '@app/domain'; import { Command, CommandRunner } from 'nest-commander'; +import { SystemConfigService } from 'src/domain/system-config/system-config.service'; @Command({ name: 'enable-password-login', diff --git a/server/src/immich-admin/commands/reset-admin-password.command.ts b/server/src/immich-admin/commands/reset-admin-password.command.ts index d19ddf4338..ce0a897a88 100644 --- a/server/src/immich-admin/commands/reset-admin-password.command.ts +++ b/server/src/immich-admin/commands/reset-admin-password.command.ts @@ -1,5 +1,6 @@ -import { UserResponseDto, UserService } from '@app/domain'; import { Command, CommandRunner, InquirerService, Question, QuestionSet } from 'nest-commander'; +import { UserResponseDto } from 'src/domain/user/response-dto/user-response.dto'; +import { UserService } from 'src/domain/user/user.service'; @Command({ name: 'reset-admin-password', diff --git a/server/src/immich-admin/constants.ts b/server/src/immich-admin/constants.ts index 44fbfdf772..237f66e637 100644 --- a/server/src/immich-admin/constants.ts +++ b/server/src/immich-admin/constants.ts @@ -1,5 +1,5 @@ -import { AuthDto } from '@app/domain'; -import { UserEntity } from '@app/infra/entities'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { UserEntity } from 'src/infra/entities/user.entity'; export const CLI_USER: AuthDto = { user: { diff --git a/server/src/immich-admin/main.ts b/server/src/immich-admin/main.ts index f14aac20f8..0b569dd9ad 100755 --- a/server/src/immich-admin/main.ts +++ b/server/src/immich-admin/main.ts @@ -1,6 +1,6 @@ -import { LogLevel } from '@app/infra/entities'; import { CommandFactory } from 'nest-commander'; -import { AppModule } from './app.module'; +import { AppModule } from 'src/immich-admin/app.module'; +import { LogLevel } from 'src/infra/entities/system-config.entity'; export async function bootstrap() { process.env.LOG_LEVEL = LogLevel.WARN; diff --git a/server/src/immich/api-v1/asset/asset-repository.ts b/server/src/immich/api-v1/asset/asset-repository.ts index 18feb65dce..12a6278758 100644 --- a/server/src/immich/api-v1/asset/asset-repository.ts +++ b/server/src/immich/api-v1/asset/asset-repository.ts @@ -1,14 +1,15 @@ -import { AssetEntity, ExifEntity } from '@app/infra/entities'; -import { OptionalBetween } from '@app/infra/infra.utils'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; +import { AssetSearchDto } from 'src/immich/api-v1/asset/dto/asset-search.dto'; +import { CheckExistingAssetsDto } from 'src/immich/api-v1/asset/dto/check-existing-assets.dto'; +import { SearchPropertiesDto } from 'src/immich/api-v1/asset/dto/search-properties.dto'; +import { CuratedLocationsResponseDto } from 'src/immich/api-v1/asset/response-dto/curated-locations-response.dto'; +import { CuratedObjectsResponseDto } from 'src/immich/api-v1/asset/response-dto/curated-objects-response.dto'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { ExifEntity } from 'src/infra/entities/exif.entity'; +import { OptionalBetween } from 'src/infra/infra.utils'; import { In } from 'typeorm/find-options/operator/In.js'; import { Repository } from 'typeorm/repository/Repository.js'; -import { AssetSearchDto } from './dto/asset-search.dto'; -import { CheckExistingAssetsDto } from './dto/check-existing-assets.dto'; -import { SearchPropertiesDto } from './dto/search-properties.dto'; -import { CuratedLocationsResponseDto } from './response-dto/curated-locations-response.dto'; -import { CuratedObjectsResponseDto } from './response-dto/curated-objects-response.dto'; export interface AssetCheck { id: string; checksum: Buffer; diff --git a/server/src/immich/api-v1/asset/asset.controller.ts b/server/src/immich/api-v1/asset/asset.controller.ts index 37b5614908..3faf33641d 100644 --- a/server/src/immich/api-v1/asset/asset.controller.ts +++ b/server/src/immich/api-v1/asset/asset.controller.ts @@ -1,4 +1,3 @@ -import { AssetResponseDto, AuthDto } from '@app/domain'; import { Body, Controller, @@ -16,23 +15,30 @@ import { } from '@nestjs/common'; import { ApiBody, ApiConsumes, ApiHeader, ApiTags } from '@nestjs/swagger'; import { NextFunction, Response } from 'express'; -import { Auth, Authenticated, FileResponse, SharedLinkRoute } from '../../app.guard'; -import { sendFile } from '../../app.utils'; -import { UUIDParamDto } from '../../controllers/dto/uuid-param.dto'; -import { FileUploadInterceptor, ImmichFile, Route, mapToUploadFile } from '../../interceptors'; -import FileNotEmptyValidator from '../validation/file-not-empty-validator'; -import { AssetService as AssetServiceV1 } from './asset.service'; -import { AssetBulkUploadCheckDto } from './dto/asset-check.dto'; -import { AssetSearchDto } from './dto/asset-search.dto'; -import { CheckExistingAssetsDto } from './dto/check-existing-assets.dto'; -import { CreateAssetDto } from './dto/create-asset.dto'; -import { GetAssetThumbnailDto } from './dto/get-asset-thumbnail.dto'; -import { ServeFileDto } from './dto/serve-file.dto'; -import { AssetBulkUploadCheckResponseDto } from './response-dto/asset-check-response.dto'; -import { AssetFileUploadResponseDto } from './response-dto/asset-file-upload-response.dto'; -import { CheckExistingAssetsResponseDto } from './response-dto/check-existing-assets-response.dto'; -import { CuratedLocationsResponseDto } from './response-dto/curated-locations-response.dto'; -import { CuratedObjectsResponseDto } from './response-dto/curated-objects-response.dto'; +import { AssetResponseDto } from 'src/domain/asset/response-dto/asset-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { AssetService as AssetServiceV1 } from 'src/immich/api-v1/asset/asset.service'; +import { AssetBulkUploadCheckDto } from 'src/immich/api-v1/asset/dto/asset-check.dto'; +import { AssetSearchDto } from 'src/immich/api-v1/asset/dto/asset-search.dto'; +import { CheckExistingAssetsDto } from 'src/immich/api-v1/asset/dto/check-existing-assets.dto'; +import { CreateAssetDto } from 'src/immich/api-v1/asset/dto/create-asset.dto'; +import { GetAssetThumbnailDto } from 'src/immich/api-v1/asset/dto/get-asset-thumbnail.dto'; +import { ServeFileDto } from 'src/immich/api-v1/asset/dto/serve-file.dto'; +import { AssetBulkUploadCheckResponseDto } from 'src/immich/api-v1/asset/response-dto/asset-check-response.dto'; +import { AssetFileUploadResponseDto } from 'src/immich/api-v1/asset/response-dto/asset-file-upload-response.dto'; +import { CheckExistingAssetsResponseDto } from 'src/immich/api-v1/asset/response-dto/check-existing-assets-response.dto'; +import { CuratedLocationsResponseDto } from 'src/immich/api-v1/asset/response-dto/curated-locations-response.dto'; +import { CuratedObjectsResponseDto } from 'src/immich/api-v1/asset/response-dto/curated-objects-response.dto'; +import FileNotEmptyValidator from 'src/immich/api-v1/validation/file-not-empty-validator'; +import { Auth, Authenticated, FileResponse, SharedLinkRoute } from 'src/immich/app.guard'; +import { sendFile } from 'src/immich/app.utils'; +import { UUIDParamDto } from 'src/immich/controllers/dto/uuid-param.dto'; +import { + FileUploadInterceptor, + ImmichFile, + Route, + mapToUploadFile, +} from 'src/immich/interceptors/file-upload.interceptor'; interface UploadFiles { assetData: ImmichFile[]; diff --git a/server/src/immich/api-v1/asset/asset.service.spec.ts b/server/src/immich/api-v1/asset/asset.service.spec.ts index 9f0aa371e8..fff1c0e1ec 100644 --- a/server/src/immich/api-v1/asset/asset.service.spec.ts +++ b/server/src/immich/api-v1/asset/asset.service.spec.ts @@ -1,30 +1,26 @@ -import { - IAssetRepository, - IJobRepository, - ILibraryRepository, - IStorageRepository, - IUserRepository, - JobName, -} from '@app/domain'; -import { ASSET_CHECKSUM_CONSTRAINT, AssetEntity, AssetType, ExifEntity } from '@app/infra/entities'; -import { - IAccessRepositoryMock, - assetStub, - authStub, - fileStub, - newAccessRepositoryMock, - newAssetRepositoryMock, - newJobRepositoryMock, - newLibraryRepositoryMock, - newStorageRepositoryMock, - newUserRepositoryMock, -} from '@test'; import { when } from 'jest-when'; +import { JobName } from 'src/domain/job/job.constants'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { IJobRepository } from 'src/domain/repositories/job.repository'; +import { ILibraryRepository } from 'src/domain/repositories/library.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { IAssetRepositoryV1 } from 'src/immich/api-v1/asset/asset-repository'; +import { AssetService } from 'src/immich/api-v1/asset/asset.service'; +import { CreateAssetDto } from 'src/immich/api-v1/asset/dto/create-asset.dto'; +import { AssetRejectReason, AssetUploadAction } from 'src/immich/api-v1/asset/response-dto/asset-check-response.dto'; +import { ASSET_CHECKSUM_CONSTRAINT, AssetEntity, AssetType } from 'src/infra/entities/asset.entity'; +import { ExifEntity } from 'src/infra/entities/exif.entity'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { authStub } from 'test/fixtures/auth.stub'; +import { fileStub } from 'test/fixtures/file.stub'; +import { IAccessRepositoryMock, newAccessRepositoryMock } from 'test/repositories/access.repository.mock'; +import { newAssetRepositoryMock } from 'test/repositories/asset.repository.mock'; +import { newJobRepositoryMock } from 'test/repositories/job.repository.mock'; +import { newLibraryRepositoryMock } from 'test/repositories/library.repository.mock'; +import { newStorageRepositoryMock } from 'test/repositories/storage.repository.mock'; +import { newUserRepositoryMock } from 'test/repositories/user.repository.mock'; import { QueryFailedError } from 'typeorm'; -import { IAssetRepositoryV1 } from './asset-repository'; -import { AssetService } from './asset.service'; -import { CreateAssetDto } from './dto/create-asset.dto'; -import { AssetRejectReason, AssetUploadAction } from './response-dto/asset-check-response.dto'; const _getCreateAssetDto = (): CreateAssetDto => { const createAssetDto = new CreateAssetDto(); diff --git a/server/src/immich/api-v1/asset/asset.service.ts b/server/src/immich/api-v1/asset/asset.service.ts index 821a7de82a..78f7fa24fa 100644 --- a/server/src/immich/api-v1/asset/asset.service.ts +++ b/server/src/immich/api-v1/asset/asset.service.ts @@ -1,24 +1,3 @@ -import { - AccessCore, - AssetResponseDto, - AuthDto, - CacheControl, - IAccessRepository, - IAssetRepository, - IJobRepository, - ILibraryRepository, - IStorageRepository, - IUserRepository, - ImmichFileResponse, - JobName, - Permission, - UploadFile, - getLivePhotoMotionFilename, - mapAsset, - mimeTypes, -} from '@app/domain'; -import { ASSET_CHECKSUM_CONSTRAINT, AssetEntity, AssetType, LibraryType } from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; import { BadRequestException, Inject, @@ -26,23 +5,39 @@ import { InternalServerErrorException, NotFoundException, } from '@nestjs/common'; -import { QueryFailedError } from 'typeorm'; -import { IAssetRepositoryV1 } from './asset-repository'; -import { AssetBulkUploadCheckDto } from './dto/asset-check.dto'; -import { AssetSearchDto } from './dto/asset-search.dto'; -import { CheckExistingAssetsDto } from './dto/check-existing-assets.dto'; -import { CreateAssetDto } from './dto/create-asset.dto'; -import { GetAssetThumbnailDto, GetAssetThumbnailFormatEnum } from './dto/get-asset-thumbnail.dto'; -import { ServeFileDto } from './dto/serve-file.dto'; +import { AccessCore, Permission } from 'src/domain/access/access.core'; +import { UploadFile } from 'src/domain/asset/asset.service'; +import { AssetResponseDto, mapAsset } from 'src/domain/asset/response-dto/asset-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { mimeTypes } from 'src/domain/domain.constant'; +import { CacheControl, ImmichFileResponse, getLivePhotoMotionFilename } from 'src/domain/domain.util'; +import { JobName } from 'src/domain/job/job.constants'; +import { IAccessRepository } from 'src/domain/repositories/access.repository'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { IJobRepository } from 'src/domain/repositories/job.repository'; +import { ILibraryRepository } from 'src/domain/repositories/library.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { IAssetRepositoryV1 } from 'src/immich/api-v1/asset/asset-repository'; +import { AssetBulkUploadCheckDto } from 'src/immich/api-v1/asset/dto/asset-check.dto'; +import { AssetSearchDto } from 'src/immich/api-v1/asset/dto/asset-search.dto'; +import { CheckExistingAssetsDto } from 'src/immich/api-v1/asset/dto/check-existing-assets.dto'; +import { CreateAssetDto } from 'src/immich/api-v1/asset/dto/create-asset.dto'; +import { GetAssetThumbnailDto, GetAssetThumbnailFormatEnum } from 'src/immich/api-v1/asset/dto/get-asset-thumbnail.dto'; +import { ServeFileDto } from 'src/immich/api-v1/asset/dto/serve-file.dto'; import { AssetBulkUploadCheckResponseDto, AssetRejectReason, AssetUploadAction, -} from './response-dto/asset-check-response.dto'; -import { AssetFileUploadResponseDto } from './response-dto/asset-file-upload-response.dto'; -import { CheckExistingAssetsResponseDto } from './response-dto/check-existing-assets-response.dto'; -import { CuratedLocationsResponseDto } from './response-dto/curated-locations-response.dto'; -import { CuratedObjectsResponseDto } from './response-dto/curated-objects-response.dto'; +} from 'src/immich/api-v1/asset/response-dto/asset-check-response.dto'; +import { AssetFileUploadResponseDto } from 'src/immich/api-v1/asset/response-dto/asset-file-upload-response.dto'; +import { CheckExistingAssetsResponseDto } from 'src/immich/api-v1/asset/response-dto/check-existing-assets-response.dto'; +import { CuratedLocationsResponseDto } from 'src/immich/api-v1/asset/response-dto/curated-locations-response.dto'; +import { CuratedObjectsResponseDto } from 'src/immich/api-v1/asset/response-dto/curated-objects-response.dto'; +import { ASSET_CHECKSUM_CONSTRAINT, AssetEntity, AssetType } from 'src/infra/entities/asset.entity'; +import { LibraryType } from 'src/infra/entities/library.entity'; +import { ImmichLogger } from 'src/infra/logger'; +import { QueryFailedError } from 'typeorm'; @Injectable() export class AssetService { diff --git a/server/src/immich/api-v1/asset/dto/asset-search.dto.ts b/server/src/immich/api-v1/asset/dto/asset-search.dto.ts index 7190184881..499ec7499a 100644 --- a/server/src/immich/api-v1/asset/dto/asset-search.dto.ts +++ b/server/src/immich/api-v1/asset/dto/asset-search.dto.ts @@ -1,7 +1,7 @@ -import { Optional, ValidateBoolean, ValidateDate } from '@app/domain'; import { ApiProperty } from '@nestjs/swagger'; import { Type } from 'class-transformer'; import { IsInt, IsUUID } from 'class-validator'; +import { Optional, ValidateBoolean, ValidateDate } from 'src/domain/domain.util'; export class AssetSearchDto { @ValidateBoolean({ optional: true }) diff --git a/server/src/immich/api-v1/asset/dto/check-existing-assets.dto.spec.ts b/server/src/immich/api-v1/asset/dto/check-existing-assets.dto.spec.ts index dd0eca03fa..a634ba42e4 100644 --- a/server/src/immich/api-v1/asset/dto/check-existing-assets.dto.spec.ts +++ b/server/src/immich/api-v1/asset/dto/check-existing-assets.dto.spec.ts @@ -1,6 +1,6 @@ import { plainToInstance } from 'class-transformer'; import { validateSync } from 'class-validator'; -import { CheckExistingAssetsDto } from './check-existing-assets.dto'; +import { CheckExistingAssetsDto } from 'src/immich/api-v1/asset/dto/check-existing-assets.dto'; describe('CheckExistingAssetsDto', () => { it('should fail with an empty list', () => { diff --git a/server/src/immich/api-v1/asset/dto/create-asset.dto.ts b/server/src/immich/api-v1/asset/dto/create-asset.dto.ts index 1b140d69f8..90b2d22451 100644 --- a/server/src/immich/api-v1/asset/dto/create-asset.dto.ts +++ b/server/src/immich/api-v1/asset/dto/create-asset.dto.ts @@ -1,6 +1,7 @@ -import { Optional, UploadFieldName, ValidateBoolean, ValidateDate, ValidateUUID } from '@app/domain'; import { ApiProperty } from '@nestjs/swagger'; import { IsNotEmpty, IsString } from 'class-validator'; +import { UploadFieldName } from 'src/domain/asset/asset.service'; +import { Optional, ValidateBoolean, ValidateDate, ValidateUUID } from 'src/domain/domain.util'; export class CreateAssetDto { @ValidateUUID({ optional: true }) diff --git a/server/src/immich/api-v1/asset/dto/get-asset-thumbnail.dto.ts b/server/src/immich/api-v1/asset/dto/get-asset-thumbnail.dto.ts index da5661e0d0..65c6a7debb 100644 --- a/server/src/immich/api-v1/asset/dto/get-asset-thumbnail.dto.ts +++ b/server/src/immich/api-v1/asset/dto/get-asset-thumbnail.dto.ts @@ -1,6 +1,6 @@ -import { Optional } from '@app/domain'; import { ApiProperty } from '@nestjs/swagger'; import { IsEnum } from 'class-validator'; +import { Optional } from 'src/domain/domain.util'; export enum GetAssetThumbnailFormatEnum { JPEG = 'JPEG', diff --git a/server/src/immich/api-v1/asset/dto/serve-file.dto.ts b/server/src/immich/api-v1/asset/dto/serve-file.dto.ts index 72e2286014..cc8d8fd15d 100644 --- a/server/src/immich/api-v1/asset/dto/serve-file.dto.ts +++ b/server/src/immich/api-v1/asset/dto/serve-file.dto.ts @@ -1,5 +1,5 @@ -import { ValidateBoolean } from '@app/domain'; import { ApiProperty } from '@nestjs/swagger'; +import { ValidateBoolean } from 'src/domain/domain.util'; export class ServeFileDto { @ValidateBoolean({ optional: true }) diff --git a/server/src/immich/app.guard.ts b/server/src/immich/app.guard.ts index bd07d107b1..e465f1d401 100644 --- a/server/src/immich/app.guard.ts +++ b/server/src/immich/app.guard.ts @@ -1,5 +1,3 @@ -import { AuthDto, AuthService, IMMICH_API_KEY_NAME, LoginDetails } from '@app/domain'; -import { ImmichLogger } from '@app/infra/logger'; import { CanActivate, ExecutionContext, @@ -11,6 +9,10 @@ import { import { Reflector } from '@nestjs/core'; import { ApiBearerAuth, ApiCookieAuth, ApiOkResponse, ApiQuery, ApiSecurity } from '@nestjs/swagger'; import { Request } from 'express'; +import { IMMICH_API_KEY_NAME } from 'src/domain/auth/auth.constant'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { AuthService, LoginDetails } from 'src/domain/auth/auth.service'; +import { ImmichLogger } from 'src/infra/logger'; import { UAParser } from 'ua-parser-js'; export enum Metadata { diff --git a/server/src/immich/app.module.ts b/server/src/immich/app.module.ts index 662f45f7c8..ba263622f8 100644 --- a/server/src/immich/app.module.ts +++ b/server/src/immich/app.module.ts @@ -1,40 +1,39 @@ -import { DomainModule } from '@app/domain'; -import { InfraModule } from '@app/infra'; -import { AssetEntity, ExifEntity } from '@app/infra/entities'; import { Module, OnModuleInit, ValidationPipe } from '@nestjs/common'; import { APP_GUARD, APP_INTERCEPTOR, APP_PIPE } from '@nestjs/core'; import { ScheduleModule } from '@nestjs/schedule'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { AssetRepositoryV1, IAssetRepositoryV1 } from './api-v1/asset/asset-repository'; -import { AssetController as AssetControllerV1 } from './api-v1/asset/asset.controller'; -import { AssetService } from './api-v1/asset/asset.service'; -import { AppGuard } from './app.guard'; -import { AppService } from './app.service'; -import { - APIKeyController, - ActivityController, - AlbumController, - AppController, - AssetController, - AssetsController, - AuditController, - AuthController, - DownloadController, - FaceController, - JobController, - LibraryController, - OAuthController, - PartnerController, - PersonController, - SearchController, - ServerInfoController, - SharedLinkController, - SystemConfigController, - TagController, - TrashController, - UserController, -} from './controllers'; -import { ErrorInterceptor, FileUploadInterceptor } from './interceptors'; +import { DomainModule } from 'src/domain/domain.module'; +import { AssetRepositoryV1, IAssetRepositoryV1 } from 'src/immich/api-v1/asset/asset-repository'; +import { AssetController as AssetControllerV1 } from 'src/immich/api-v1/asset/asset.controller'; +import { AssetService as AssetServiceV1 } from 'src/immich/api-v1/asset/asset.service'; +import { AppGuard } from 'src/immich/app.guard'; +import { AppService } from 'src/immich/app.service'; +import { ActivityController } from 'src/immich/controllers/activity.controller'; +import { AlbumController } from 'src/immich/controllers/album.controller'; +import { APIKeyController } from 'src/immich/controllers/api-key.controller'; +import { AppController } from 'src/immich/controllers/app.controller'; +import { AssetController, AssetsController } from 'src/immich/controllers/asset.controller'; +import { AuditController } from 'src/immich/controllers/audit.controller'; +import { AuthController } from 'src/immich/controllers/auth.controller'; +import { DownloadController } from 'src/immich/controllers/download.controller'; +import { FaceController } from 'src/immich/controllers/face.controller'; +import { JobController } from 'src/immich/controllers/job.controller'; +import { LibraryController } from 'src/immich/controllers/library.controller'; +import { OAuthController } from 'src/immich/controllers/oauth.controller'; +import { PartnerController } from 'src/immich/controllers/partner.controller'; +import { PersonController } from 'src/immich/controllers/person.controller'; +import { SearchController } from 'src/immich/controllers/search.controller'; +import { ServerInfoController } from 'src/immich/controllers/server-info.controller'; +import { SharedLinkController } from 'src/immich/controllers/shared-link.controller'; +import { SystemConfigController } from 'src/immich/controllers/system-config.controller'; +import { TagController } from 'src/immich/controllers/tag.controller'; +import { TrashController } from 'src/immich/controllers/trash.controller'; +import { UserController } from 'src/immich/controllers/user.controller'; +import { ErrorInterceptor } from 'src/immich/interceptors/error.interceptor'; +import { FileUploadInterceptor } from 'src/immich/interceptors/file-upload.interceptor'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { ExifEntity } from 'src/infra/entities/exif.entity'; +import { InfraModule } from 'src/infra/infra.module'; @Module({ imports: [ @@ -75,7 +74,7 @@ import { ErrorInterceptor, FileUploadInterceptor } from './interceptors'; { provide: APP_GUARD, useClass: AppGuard }, { provide: IAssetRepositoryV1, useClass: AssetRepositoryV1 }, AppService, - AssetService, + AssetServiceV1, FileUploadInterceptor, ], }) diff --git a/server/src/immich/app.service.ts b/server/src/immich/app.service.ts index adfb9d8780..8cbb6cf235 100644 --- a/server/src/immich/app.service.ts +++ b/server/src/immich/app.service.ts @@ -1,21 +1,18 @@ -import { - AuthService, - DatabaseService, - JobService, - ONE_HOUR, - OpenGraphTags, - ServerInfoService, - SharedLinkService, - StorageService, - SystemConfigService, - WEB_ROOT, -} from '@app/domain'; -import { ImmichLogger } from '@app/infra/logger'; import { Injectable } from '@nestjs/common'; import { Cron, CronExpression, Interval } from '@nestjs/schedule'; import { NextFunction, Request, Response } from 'express'; import { readFileSync } from 'node:fs'; import { join } from 'node:path'; +import { AuthService } from 'src/domain/auth/auth.service'; +import { DatabaseService } from 'src/domain/database/database.service'; +import { ONE_HOUR, WEB_ROOT } from 'src/domain/domain.constant'; +import { OpenGraphTags } from 'src/domain/domain.util'; +import { JobService } from 'src/domain/job/job.service'; +import { ServerInfoService } from 'src/domain/server-info/server-info.service'; +import { SharedLinkService } from 'src/domain/shared-link/shared-link.service'; +import { StorageService } from 'src/domain/storage/storage.service'; +import { SystemConfigService } from 'src/domain/system-config/system-config.service'; +import { ImmichLogger } from 'src/infra/logger'; const render = (index: string, meta: OpenGraphTags) => { const tags = ` diff --git a/server/src/immich/app.utils.ts b/server/src/immich/app.utils.ts index 26aca2a9bb..4d78ffb242 100644 --- a/server/src/immich/app.utils.ts +++ b/server/src/immich/app.utils.ts @@ -1,14 +1,3 @@ -import { - CacheControl, - IMMICH_ACCESS_COOKIE, - IMMICH_API_KEY_HEADER, - IMMICH_API_KEY_NAME, - ImmichFileResponse, - ImmichReadStream, - isConnectionAborted, - serverVersion, -} from '@app/domain'; -import { ImmichLogger } from '@app/infra/logger'; import { HttpException, INestApplication, StreamableFile } from '@nestjs/common'; import { DocumentBuilder, @@ -24,7 +13,12 @@ import { writeFileSync } from 'node:fs'; import { access, constants } from 'node:fs/promises'; import path, { isAbsolute } from 'node:path'; import { promisify } from 'node:util'; -import { Metadata } from './app.guard'; +import { IMMICH_ACCESS_COOKIE, IMMICH_API_KEY_HEADER, IMMICH_API_KEY_NAME } from 'src/domain/auth/auth.constant'; +import { serverVersion } from 'src/domain/domain.constant'; +import { CacheControl, ImmichFileResponse, isConnectionAborted } from 'src/domain/domain.util'; +import { ImmichReadStream } from 'src/domain/repositories/storage.repository'; +import { Metadata } from 'src/immich/app.guard'; +import { ImmichLogger } from 'src/infra/logger'; type SendFile = Parameters; type SendFileOptions = SendFile[1]; diff --git a/server/src/immich/controllers/activity.controller.ts b/server/src/immich/controllers/activity.controller.ts index 0808c7d4d4..c79a564077 100644 --- a/server/src/immich/controllers/activity.controller.ts +++ b/server/src/immich/controllers/activity.controller.ts @@ -1,17 +1,17 @@ -import { AuthDto } from '@app/domain'; -import { - ActivityDto, - ActivitySearchDto, - ActivityService, - ActivityCreateDto as CreateDto, - ActivityResponseDto as ResponseDto, - ActivityStatisticsResponseDto as StatsResponseDto, -} from '@app/domain/activity'; import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param, Post, Query, Res } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import { Response } from 'express'; -import { Auth, Authenticated } from '../app.guard'; -import { UUIDParamDto } from './dto/uuid-param.dto'; +import { + ActivityCreateDto, + ActivityDto, + ActivityResponseDto, + ActivitySearchDto, + ActivityStatisticsResponseDto, +} from 'src/domain/activity/activity.dto'; +import { ActivityService } from 'src/domain/activity/activity.service'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { Auth, Authenticated } from 'src/immich/app.guard'; +import { UUIDParamDto } from 'src/immich/controllers/dto/uuid-param.dto'; @ApiTags('Activity') @Controller('activity') @@ -20,21 +20,21 @@ export class ActivityController { constructor(private service: ActivityService) {} @Get() - getActivities(@Auth() auth: AuthDto, @Query() dto: ActivitySearchDto): Promise { + getActivities(@Auth() auth: AuthDto, @Query() dto: ActivitySearchDto): Promise { return this.service.getAll(auth, dto); } @Get('statistics') - getActivityStatistics(@Auth() auth: AuthDto, @Query() dto: ActivityDto): Promise { + getActivityStatistics(@Auth() auth: AuthDto, @Query() dto: ActivityDto): Promise { return this.service.getStatistics(auth, dto); } @Post() async createActivity( @Auth() auth: AuthDto, - @Body() dto: CreateDto, + @Body() dto: ActivityCreateDto, @Res({ passthrough: true }) res: Response, - ): Promise { + ): Promise { const { duplicate, value } = await this.service.create(auth, dto); if (duplicate) { res.status(HttpStatus.OK); diff --git a/server/src/immich/controllers/album.controller.ts b/server/src/immich/controllers/album.controller.ts index ea1c5a428b..8981de2124 100644 --- a/server/src/immich/controllers/album.controller.ts +++ b/server/src/immich/controllers/album.controller.ts @@ -1,21 +1,17 @@ -import { - AddUsersDto, - AlbumCountResponseDto, - AlbumInfoDto, - AlbumResponseDto, - AlbumService, - AuthDto, - BulkIdResponseDto, - BulkIdsDto, - CreateAlbumDto as CreateDto, - GetAlbumsDto, - UpdateAlbumDto as UpdateDto, -} from '@app/domain'; import { Body, Controller, Delete, Get, Param, Patch, Post, Put, Query } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; -import { ParseMeUUIDPipe } from '../api-v1/validation/parse-me-uuid-pipe'; -import { Auth, Authenticated, SharedLinkRoute } from '../app.guard'; -import { UUIDParamDto } from './dto/uuid-param.dto'; +import { AlbumCountResponseDto, AlbumResponseDto } from 'src/domain/album/album-response.dto'; +import { AlbumService } from 'src/domain/album/album.service'; +import { AddUsersDto } from 'src/domain/album/dto/album-add-users.dto'; +import { CreateAlbumDto } from 'src/domain/album/dto/album-create.dto'; +import { UpdateAlbumDto } from 'src/domain/album/dto/album-update.dto'; +import { AlbumInfoDto } from 'src/domain/album/dto/album.dto'; +import { GetAlbumsDto } from 'src/domain/album/dto/get-albums.dto'; +import { BulkIdResponseDto, BulkIdsDto } from 'src/domain/asset/response-dto/asset-ids-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { ParseMeUUIDPipe } from 'src/immich/api-v1/validation/parse-me-uuid-pipe'; +import { Auth, Authenticated, SharedLinkRoute } from 'src/immich/app.guard'; +import { UUIDParamDto } from 'src/immich/controllers/dto/uuid-param.dto'; @ApiTags('Album') @Controller('album') @@ -34,7 +30,7 @@ export class AlbumController { } @Post() - createAlbum(@Auth() auth: AuthDto, @Body() dto: CreateDto): Promise { + createAlbum(@Auth() auth: AuthDto, @Body() dto: CreateAlbumDto): Promise { return this.service.create(auth, dto); } @@ -52,7 +48,7 @@ export class AlbumController { updateAlbumInfo( @Auth() auth: AuthDto, @Param() { id }: UUIDParamDto, - @Body() dto: UpdateDto, + @Body() dto: UpdateAlbumDto, ): Promise { return this.service.update(auth, id, dto); } diff --git a/server/src/immich/controllers/api-key.controller.ts b/server/src/immich/controllers/api-key.controller.ts index 5b50725334..b9b449610c 100644 --- a/server/src/immich/controllers/api-key.controller.ts +++ b/server/src/immich/controllers/api-key.controller.ts @@ -1,15 +1,15 @@ +import { Body, Controller, Delete, Get, Param, Post, Put } from '@nestjs/common'; +import { ApiTags } from '@nestjs/swagger'; import { APIKeyCreateDto, APIKeyCreateResponseDto, APIKeyResponseDto, - APIKeyService, APIKeyUpdateDto, - AuthDto, -} from '@app/domain'; -import { Body, Controller, Delete, Get, Param, Post, Put } from '@nestjs/common'; -import { ApiTags } from '@nestjs/swagger'; -import { Auth, Authenticated } from '../app.guard'; -import { UUIDParamDto } from './dto/uuid-param.dto'; +} from 'src/domain/api-key/api-key.dto'; +import { APIKeyService } from 'src/domain/api-key/api-key.service'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { Auth, Authenticated } from 'src/immich/app.guard'; +import { UUIDParamDto } from 'src/immich/controllers/dto/uuid-param.dto'; @ApiTags('API Key') @Controller('api-key') diff --git a/server/src/immich/controllers/app.controller.ts b/server/src/immich/controllers/app.controller.ts index 68a61c34c5..0e916cd25e 100644 --- a/server/src/immich/controllers/app.controller.ts +++ b/server/src/immich/controllers/app.controller.ts @@ -1,7 +1,7 @@ -import { SystemConfigService } from '@app/domain'; import { Controller, Get, Header } from '@nestjs/common'; import { ApiExcludeEndpoint } from '@nestjs/swagger'; -import { PublicRoute } from '../app.guard'; +import { SystemConfigService } from 'src/domain/system-config/system-config.service'; +import { PublicRoute } from 'src/immich/app.guard'; @Controller() export class AppController { diff --git a/server/src/immich/controllers/asset.controller.ts b/server/src/immich/controllers/asset.controller.ts index 39a36b1759..d085dbe570 100644 --- a/server/src/immich/controllers/asset.controller.ts +++ b/server/src/immich/controllers/asset.controller.ts @@ -1,31 +1,28 @@ +import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param, Post, Put, Query } from '@nestjs/common'; +import { ApiOperation, ApiTags } from '@nestjs/swagger'; +import { AssetService } from 'src/domain/asset/asset.service'; +import { AssetJobsDto } from 'src/domain/asset/dto/asset-ids.dto'; +import { UpdateStackParentDto } from 'src/domain/asset/dto/asset-stack.dto'; +import { AssetStatsDto, AssetStatsResponseDto } from 'src/domain/asset/dto/asset-statistics.dto'; import { AssetBulkDeleteDto, AssetBulkUpdateDto, - AssetJobsDto, - AssetResponseDto, - AssetService, - AssetStatsDto, - AssetStatsResponseDto, - AuthDto, DeviceIdDto, - MapMarkerDto, - MapMarkerResponseDto, - MemoryLaneDto, - MemoryLaneResponseDto, - MetadataSearchDto, RandomAssetsDto, - SearchService, - TimeBucketAssetDto, - TimeBucketDto, - TimeBucketResponseDto, - UpdateAssetDto as UpdateDto, - UpdateStackParentDto, -} from '@app/domain'; -import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param, Post, Put, Query } from '@nestjs/common'; -import { ApiOperation, ApiTags } from '@nestjs/swagger'; -import { Auth, Authenticated, SharedLinkRoute } from '../app.guard'; -import { Route } from '../interceptors'; -import { UUIDParamDto } from './dto/uuid-param.dto'; + UpdateAssetDto, +} from 'src/domain/asset/dto/asset.dto'; +import { MapMarkerDto } from 'src/domain/asset/dto/map-marker.dto'; +import { MemoryLaneDto } from 'src/domain/asset/dto/memory-lane.dto'; +import { TimeBucketAssetDto, TimeBucketDto } from 'src/domain/asset/dto/time-bucket.dto'; +import { AssetResponseDto, MemoryLaneResponseDto } from 'src/domain/asset/response-dto/asset-response.dto'; +import { MapMarkerResponseDto } from 'src/domain/asset/response-dto/map-marker-response.dto'; +import { TimeBucketResponseDto } from 'src/domain/asset/response-dto/time-bucket-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { MetadataSearchDto } from 'src/domain/search/dto/search.dto'; +import { SearchService } from 'src/domain/search/search.service'; +import { Auth, Authenticated, SharedLinkRoute } from 'src/immich/app.guard'; +import { UUIDParamDto } from 'src/immich/controllers/dto/uuid-param.dto'; +import { Route } from 'src/immich/interceptors/file-upload.interceptor'; @ApiTags('Asset') @Controller('assets') @@ -120,7 +117,11 @@ export class AssetController { } @Put(':id') - updateAsset(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto, @Body() dto: UpdateDto): Promise { + updateAsset( + @Auth() auth: AuthDto, + @Param() { id }: UUIDParamDto, + @Body() dto: UpdateAssetDto, + ): Promise { return this.service.update(auth, id, dto); } } diff --git a/server/src/immich/controllers/audit.controller.ts b/server/src/immich/controllers/audit.controller.ts index 09b707b8a7..468257d26e 100644 --- a/server/src/immich/controllers/audit.controller.ts +++ b/server/src/immich/controllers/audit.controller.ts @@ -1,16 +1,16 @@ +import { Body, Controller, Get, Post, Query } from '@nestjs/common'; +import { ApiTags } from '@nestjs/swagger'; import { AuditDeletesDto, AuditDeletesResponseDto, - AuditService, - AuthDto, FileChecksumDto, FileChecksumResponseDto, FileReportDto, FileReportFixDto, -} from '@app/domain'; -import { Body, Controller, Get, Post, Query } from '@nestjs/common'; -import { ApiTags } from '@nestjs/swagger'; -import { AdminRoute, Auth, Authenticated } from '../app.guard'; +} from 'src/domain/audit/audit.dto'; +import { AuditService } from 'src/domain/audit/audit.service'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { AdminRoute, Auth, Authenticated } from 'src/immich/app.guard'; @ApiTags('Audit') @Controller('audit') diff --git a/server/src/immich/controllers/auth.controller.ts b/server/src/immich/controllers/auth.controller.ts index ac1fea2bcb..b2dece148d 100644 --- a/server/src/immich/controllers/auth.controller.ts +++ b/server/src/immich/controllers/auth.controller.ts @@ -1,25 +1,21 @@ -import { - AuthDeviceResponseDto, - AuthDto, - AuthService, - ChangePasswordDto, - IMMICH_ACCESS_COOKIE, - IMMICH_AUTH_TYPE_COOKIE, - IMMICH_IS_AUTHENTICATED, - LoginCredentialDto, - LoginDetails, - LoginResponseDto, - LogoutResponseDto, - SignUpDto, - UserResponseDto, - ValidateAccessTokenResponseDto, - mapUser, -} from '@app/domain'; import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param, Post, Req, Res } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import { Request, Response } from 'express'; -import { Auth, Authenticated, GetLoginDetails, PublicRoute } from '../app.guard'; -import { UUIDParamDto } from './dto/uuid-param.dto'; +import { IMMICH_ACCESS_COOKIE, IMMICH_AUTH_TYPE_COOKIE, IMMICH_IS_AUTHENTICATED } from 'src/domain/auth/auth.constant'; +import { + AuthDeviceResponseDto, + AuthDto, + ChangePasswordDto, + LoginCredentialDto, + LoginResponseDto, + LogoutResponseDto, + SignUpDto, + ValidateAccessTokenResponseDto, +} from 'src/domain/auth/auth.dto'; +import { AuthService, LoginDetails } from 'src/domain/auth/auth.service'; +import { UserResponseDto, mapUser } from 'src/domain/user/response-dto/user-response.dto'; +import { Auth, Authenticated, GetLoginDetails, PublicRoute } from 'src/immich/app.guard'; +import { UUIDParamDto } from 'src/immich/controllers/dto/uuid-param.dto'; @ApiTags('Authentication') @Controller('auth') diff --git a/server/src/immich/controllers/download.controller.ts b/server/src/immich/controllers/download.controller.ts index 743797f745..41849a41d3 100644 --- a/server/src/immich/controllers/download.controller.ts +++ b/server/src/immich/controllers/download.controller.ts @@ -1,10 +1,13 @@ -import { AssetIdsDto, AuthDto, DownloadInfoDto, DownloadResponseDto, DownloadService } from '@app/domain'; import { Body, Controller, HttpCode, HttpStatus, Next, Param, Post, Res, StreamableFile } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import { NextFunction, Response } from 'express'; -import { Auth, Authenticated, FileResponse, SharedLinkRoute } from '../app.guard'; -import { asStreamableFile, sendFile } from '../app.utils'; -import { UUIDParamDto } from './dto/uuid-param.dto'; +import { AssetIdsDto } from 'src/domain/asset/dto/asset-ids.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { DownloadInfoDto, DownloadResponseDto } from 'src/domain/download/download.dto'; +import { DownloadService } from 'src/domain/download/download.service'; +import { Auth, Authenticated, FileResponse, SharedLinkRoute } from 'src/immich/app.guard'; +import { asStreamableFile, sendFile } from 'src/immich/app.utils'; +import { UUIDParamDto } from 'src/immich/controllers/dto/uuid-param.dto'; @ApiTags('Download') @Controller('download') diff --git a/server/src/immich/controllers/face.controller.ts b/server/src/immich/controllers/face.controller.ts index f4014713b4..0fab1bb919 100644 --- a/server/src/immich/controllers/face.controller.ts +++ b/server/src/immich/controllers/face.controller.ts @@ -1,8 +1,10 @@ -import { AssetFaceResponseDto, AuthDto, FaceDto, PersonResponseDto, PersonService } from '@app/domain'; import { Body, Controller, Get, Param, Put, Query } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; -import { Auth, Authenticated } from '../app.guard'; -import { UUIDParamDto } from './dto/uuid-param.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { AssetFaceResponseDto, FaceDto, PersonResponseDto } from 'src/domain/person/person.dto'; +import { PersonService } from 'src/domain/person/person.service'; +import { Auth, Authenticated } from 'src/immich/app.guard'; +import { UUIDParamDto } from 'src/immich/controllers/dto/uuid-param.dto'; @ApiTags('Face') @Controller('face') diff --git a/server/src/immich/controllers/index.ts b/server/src/immich/controllers/index.ts deleted file mode 100644 index f4e4730917..0000000000 --- a/server/src/immich/controllers/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -export * from './activity.controller'; -export * from './album.controller'; -export * from './api-key.controller'; -export * from './app.controller'; -export * from './asset.controller'; -export * from './audit.controller'; -export * from './auth.controller'; -export * from './download.controller'; -export * from './face.controller'; -export * from './job.controller'; -export * from './library.controller'; -export * from './oauth.controller'; -export * from './partner.controller'; -export * from './person.controller'; -export * from './search.controller'; -export * from './server-info.controller'; -export * from './shared-link.controller'; -export * from './system-config.controller'; -export * from './tag.controller'; -export * from './trash.controller'; -export * from './user.controller'; diff --git a/server/src/immich/controllers/job.controller.ts b/server/src/immich/controllers/job.controller.ts index 413af44de2..e5a8aac540 100644 --- a/server/src/immich/controllers/job.controller.ts +++ b/server/src/immich/controllers/job.controller.ts @@ -1,7 +1,8 @@ -import { AllJobStatusResponseDto, JobCommandDto, JobIdParamDto, JobService, JobStatusDto } from '@app/domain'; import { Body, Controller, Get, Param, Put } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; -import { Authenticated } from '../app.guard'; +import { AllJobStatusResponseDto, JobCommandDto, JobIdParamDto, JobStatusDto } from 'src/domain/job/job.dto'; +import { JobService } from 'src/domain/job/job.service'; +import { Authenticated } from 'src/immich/app.guard'; @ApiTags('Job') @Controller('jobs') diff --git a/server/src/immich/controllers/library.controller.ts b/server/src/immich/controllers/library.controller.ts index 2b509645c3..d72461988c 100644 --- a/server/src/immich/controllers/library.controller.ts +++ b/server/src/immich/controllers/library.controller.ts @@ -1,18 +1,18 @@ -import { - CreateLibraryDto as CreateDto, - LibraryService, - LibraryStatsResponseDto, - LibraryResponseDto as ResponseDto, - ScanLibraryDto, - SearchLibraryDto, - UpdateLibraryDto as UpdateDto, - ValidateLibraryDto, - ValidateLibraryResponseDto, -} from '@app/domain'; import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param, Post, Put, Query } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; -import { AdminRoute, Authenticated } from '../app.guard'; -import { UUIDParamDto } from './dto/uuid-param.dto'; +import { + CreateLibraryDto, + LibraryResponseDto, + LibraryStatsResponseDto, + ScanLibraryDto, + SearchLibraryDto, + UpdateLibraryDto, + ValidateLibraryDto, + ValidateLibraryResponseDto, +} from 'src/domain/library/library.dto'; +import { LibraryService } from 'src/domain/library/library.service'; +import { AdminRoute, Authenticated } from 'src/immich/app.guard'; +import { UUIDParamDto } from 'src/immich/controllers/dto/uuid-param.dto'; @ApiTags('Library') @Controller('library') @@ -22,22 +22,22 @@ export class LibraryController { constructor(private service: LibraryService) {} @Get() - getAllLibraries(@Query() dto: SearchLibraryDto): Promise { + getAllLibraries(@Query() dto: SearchLibraryDto): Promise { return this.service.getAll(dto); } @Post() - createLibrary(@Body() dto: CreateDto): Promise { + createLibrary(@Body() dto: CreateLibraryDto): Promise { return this.service.create(dto); } @Put(':id') - updateLibrary(@Param() { id }: UUIDParamDto, @Body() dto: UpdateDto): Promise { + updateLibrary(@Param() { id }: UUIDParamDto, @Body() dto: UpdateLibraryDto): Promise { return this.service.update(id, dto); } @Get(':id') - getLibrary(@Param() { id }: UUIDParamDto): Promise { + getLibrary(@Param() { id }: UUIDParamDto): Promise { return this.service.get(id); } diff --git a/server/src/immich/controllers/oauth.controller.ts b/server/src/immich/controllers/oauth.controller.ts index c7a5717af4..8d7ce9478f 100644 --- a/server/src/immich/controllers/oauth.controller.ts +++ b/server/src/immich/controllers/oauth.controller.ts @@ -1,17 +1,16 @@ +import { Body, Controller, Get, HttpStatus, Post, Redirect, Req, Res } from '@nestjs/common'; +import { ApiTags } from '@nestjs/swagger'; +import { Request, Response } from 'express'; import { AuthDto, - AuthService, - LoginDetails, LoginResponseDto, OAuthAuthorizeResponseDto, OAuthCallbackDto, OAuthConfigDto, - UserResponseDto, -} from '@app/domain'; -import { Body, Controller, Get, HttpStatus, Post, Redirect, Req, Res } from '@nestjs/common'; -import { ApiTags } from '@nestjs/swagger'; -import { Request, Response } from 'express'; -import { Auth, Authenticated, GetLoginDetails, PublicRoute } from '../app.guard'; +} from 'src/domain/auth/auth.dto'; +import { AuthService, LoginDetails } from 'src/domain/auth/auth.service'; +import { UserResponseDto } from 'src/domain/user/response-dto/user-response.dto'; +import { Auth, Authenticated, GetLoginDetails, PublicRoute } from 'src/immich/app.guard'; @ApiTags('OAuth') @Controller('oauth') diff --git a/server/src/immich/controllers/partner.controller.ts b/server/src/immich/controllers/partner.controller.ts index 65d95438d7..43c388e10f 100644 --- a/server/src/immich/controllers/partner.controller.ts +++ b/server/src/immich/controllers/partner.controller.ts @@ -1,9 +1,11 @@ -import { AuthDto, PartnerDirection, PartnerService } from '@app/domain'; -import { PartnerResponseDto, UpdatePartnerDto } from '@app/domain/partner/partner.dto'; import { Body, Controller, Delete, Get, Param, Post, Put, Query } from '@nestjs/common'; import { ApiQuery, ApiTags } from '@nestjs/swagger'; -import { Auth, Authenticated } from '../app.guard'; -import { UUIDParamDto } from './dto/uuid-param.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { PartnerResponseDto, UpdatePartnerDto } from 'src/domain/partner/partner.dto'; +import { PartnerService } from 'src/domain/partner/partner.service'; +import { PartnerDirection } from 'src/domain/repositories/partner.repository'; +import { Auth, Authenticated } from 'src/immich/app.guard'; +import { UUIDParamDto } from 'src/immich/controllers/dto/uuid-param.dto'; @ApiTags('Partner') @Controller('partner') diff --git a/server/src/immich/controllers/person.controller.ts b/server/src/immich/controllers/person.controller.ts index 3408aa6ec0..c2b789678b 100644 --- a/server/src/immich/controllers/person.controller.ts +++ b/server/src/immich/controllers/person.controller.ts @@ -1,24 +1,24 @@ +import { Body, Controller, Get, Next, Param, Post, Put, Query, Res } from '@nestjs/common'; +import { ApiTags } from '@nestjs/swagger'; +import { NextFunction, Response } from 'express'; +import { BulkIdResponseDto } from 'src/domain/asset/response-dto/asset-ids-response.dto'; +import { AssetResponseDto } from 'src/domain/asset/response-dto/asset-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; import { AssetFaceUpdateDto, - AssetResponseDto, - AuthDto, - BulkIdResponseDto, MergePersonDto, PeopleResponseDto, PeopleUpdateDto, PersonCreateDto, PersonResponseDto, PersonSearchDto, - PersonService, PersonStatisticsResponseDto, PersonUpdateDto, -} from '@app/domain'; -import { Body, Controller, Get, Next, Param, Post, Put, Query, Res } from '@nestjs/common'; -import { ApiTags } from '@nestjs/swagger'; -import { NextFunction, Response } from 'express'; -import { Auth, Authenticated, FileResponse } from '../app.guard'; -import { sendFile } from '../app.utils'; -import { UUIDParamDto } from './dto/uuid-param.dto'; +} from 'src/domain/person/person.dto'; +import { PersonService } from 'src/domain/person/person.service'; +import { Auth, Authenticated, FileResponse } from 'src/immich/app.guard'; +import { sendFile } from 'src/immich/app.utils'; +import { UUIDParamDto } from 'src/immich/controllers/dto/uuid-param.dto'; @ApiTags('Person') @Controller('person') diff --git a/server/src/immich/controllers/search.controller.ts b/server/src/immich/controllers/search.controller.ts index a3527a66a0..4f8f19fd80 100644 --- a/server/src/immich/controllers/search.controller.ts +++ b/server/src/immich/controllers/search.controller.ts @@ -1,21 +1,21 @@ -import { - AssetResponseDto, - AuthDto, - MetadataSearchDto, - PersonResponseDto, - PlacesResponseDto, - SearchDto, - SearchExploreResponseDto, - SearchPeopleDto, - SearchPlacesDto, - SearchResponseDto, - SearchService, - SmartSearchDto, -} from '@app/domain'; -import { SearchSuggestionRequestDto } from '@app/domain/search/dto/search-suggestion.dto'; import { Body, Controller, Get, HttpCode, HttpStatus, Post, Query } from '@nestjs/common'; import { ApiOperation, ApiTags } from '@nestjs/swagger'; -import { Auth, Authenticated } from '../app.guard'; +import { AssetResponseDto } from 'src/domain/asset/response-dto/asset-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { PersonResponseDto } from 'src/domain/person/person.dto'; +import { SearchSuggestionRequestDto } from 'src/domain/search/dto/search-suggestion.dto'; +import { + MetadataSearchDto, + PlacesResponseDto, + SearchDto, + SearchPeopleDto, + SearchPlacesDto, + SmartSearchDto, +} from 'src/domain/search/dto/search.dto'; +import { SearchExploreResponseDto } from 'src/domain/search/response-dto/search-explore.response.dto'; +import { SearchResponseDto } from 'src/domain/search/response-dto/search-response.dto'; +import { SearchService } from 'src/domain/search/search.service'; +import { Auth, Authenticated } from 'src/immich/app.guard'; @ApiTags('Search') @Controller('search') diff --git a/server/src/immich/controllers/server-info.controller.ts b/server/src/immich/controllers/server-info.controller.ts index 4987a8984d..5ff3de55ef 100644 --- a/server/src/immich/controllers/server-info.controller.ts +++ b/server/src/immich/controllers/server-info.controller.ts @@ -1,17 +1,17 @@ +import { Controller, Get, HttpCode, HttpStatus, Post } from '@nestjs/common'; +import { ApiTags } from '@nestjs/swagger'; import { ServerConfigDto, ServerFeaturesDto, ServerInfoResponseDto, - ServerInfoService, ServerMediaTypesResponseDto, ServerPingResponse, ServerStatsResponseDto, ServerThemeDto, ServerVersionResponseDto, -} from '@app/domain'; -import { Controller, Get, HttpCode, HttpStatus, Post } from '@nestjs/common'; -import { ApiTags } from '@nestjs/swagger'; -import { AdminRoute, Authenticated, PublicRoute } from '../app.guard'; +} from 'src/domain/server-info/server-info.dto'; +import { ServerInfoService } from 'src/domain/server-info/server-info.service'; +import { AdminRoute, Authenticated, PublicRoute } from 'src/immich/app.guard'; @ApiTags('Server Info') @Controller('server-info') diff --git a/server/src/immich/controllers/shared-link.controller.ts b/server/src/immich/controllers/shared-link.controller.ts index d265d018d6..39e4c084e3 100644 --- a/server/src/immich/controllers/shared-link.controller.ts +++ b/server/src/immich/controllers/shared-link.controller.ts @@ -1,19 +1,15 @@ -import { - AssetIdsDto, - AssetIdsResponseDto, - AuthDto, - IMMICH_SHARED_LINK_ACCESS_COOKIE, - SharedLinkCreateDto, - SharedLinkEditDto, - SharedLinkPasswordDto, - SharedLinkResponseDto, - SharedLinkService, -} from '@app/domain'; import { Body, Controller, Delete, Get, Param, Patch, Post, Put, Query, Req, Res } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import { Request, Response } from 'express'; -import { Auth, Authenticated, SharedLinkRoute } from '../app.guard'; -import { UUIDParamDto } from './dto/uuid-param.dto'; +import { AssetIdsDto } from 'src/domain/asset/dto/asset-ids.dto'; +import { AssetIdsResponseDto } from 'src/domain/asset/response-dto/asset-ids-response.dto'; +import { IMMICH_SHARED_LINK_ACCESS_COOKIE } from 'src/domain/auth/auth.constant'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { SharedLinkResponseDto } from 'src/domain/shared-link/shared-link-response.dto'; +import { SharedLinkCreateDto, SharedLinkEditDto, SharedLinkPasswordDto } from 'src/domain/shared-link/shared-link.dto'; +import { SharedLinkService } from 'src/domain/shared-link/shared-link.service'; +import { Auth, Authenticated, SharedLinkRoute } from 'src/immich/app.guard'; +import { UUIDParamDto } from 'src/immich/controllers/dto/uuid-param.dto'; @ApiTags('Shared Link') @Controller('shared-link') diff --git a/server/src/immich/controllers/system-config.controller.ts b/server/src/immich/controllers/system-config.controller.ts index 73cf2c3c0a..6d1ea8f1d6 100644 --- a/server/src/immich/controllers/system-config.controller.ts +++ b/server/src/immich/controllers/system-config.controller.ts @@ -1,8 +1,10 @@ -import { SystemConfigDto, SystemConfigService, SystemConfigTemplateStorageOptionDto } from '@app/domain'; -import { MapThemeDto } from '@app/domain/system-config/system-config-map-theme.dto'; import { Body, Controller, Get, Put, Query } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; -import { AdminRoute, Authenticated } from '../app.guard'; +import { SystemConfigDto } from 'src/domain/system-config/dto/system-config.dto'; +import { SystemConfigTemplateStorageOptionDto } from 'src/domain/system-config/response-dto/system-config-template-storage-option.dto'; +import { MapThemeDto } from 'src/domain/system-config/system-config-map-theme.dto'; +import { SystemConfigService } from 'src/domain/system-config/system-config.service'; +import { AdminRoute, Authenticated } from 'src/immich/app.guard'; @ApiTags('System Config') @Controller('system-config') diff --git a/server/src/immich/controllers/tag.controller.ts b/server/src/immich/controllers/tag.controller.ts index 0d0c563d4a..511d7b1d13 100644 --- a/server/src/immich/controllers/tag.controller.ts +++ b/server/src/immich/controllers/tag.controller.ts @@ -1,17 +1,14 @@ -import { - AssetIdsDto, - AssetIdsResponseDto, - AssetResponseDto, - AuthDto, - CreateTagDto, - TagResponseDto, - TagService, - UpdateTagDto, -} from '@app/domain'; import { Body, Controller, Delete, Get, Param, Patch, Post, Put } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; -import { Auth, Authenticated } from '../app.guard'; -import { UUIDParamDto } from './dto/uuid-param.dto'; +import { AssetIdsDto } from 'src/domain/asset/dto/asset-ids.dto'; +import { AssetIdsResponseDto } from 'src/domain/asset/response-dto/asset-ids-response.dto'; +import { AssetResponseDto } from 'src/domain/asset/response-dto/asset-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { TagResponseDto } from 'src/domain/tag/tag-response.dto'; +import { CreateTagDto, UpdateTagDto } from 'src/domain/tag/tag.dto'; +import { TagService } from 'src/domain/tag/tag.service'; +import { Auth, Authenticated } from 'src/immich/app.guard'; +import { UUIDParamDto } from 'src/immich/controllers/dto/uuid-param.dto'; @ApiTags('Tag') @Controller('tag') diff --git a/server/src/immich/controllers/trash.controller.ts b/server/src/immich/controllers/trash.controller.ts index b618938170..44d68abbe4 100644 --- a/server/src/immich/controllers/trash.controller.ts +++ b/server/src/immich/controllers/trash.controller.ts @@ -1,7 +1,9 @@ -import { AuthDto, BulkIdsDto, TrashService } from '@app/domain'; import { Body, Controller, HttpCode, HttpStatus, Post } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; -import { Auth, Authenticated } from '../app.guard'; +import { BulkIdsDto } from 'src/domain/asset/response-dto/asset-ids-response.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { TrashService } from 'src/domain/trash/trash.service'; +import { Auth, Authenticated } from 'src/immich/app.guard'; @ApiTags('Trash') @Controller('trash') diff --git a/server/src/immich/controllers/user.controller.ts b/server/src/immich/controllers/user.controller.ts index 0b3828f5ca..10b16859ff 100644 --- a/server/src/immich/controllers/user.controller.ts +++ b/server/src/immich/controllers/user.controller.ts @@ -1,13 +1,3 @@ -import { - AuthDto, - CreateUserDto as CreateDto, - CreateProfileImageDto, - CreateProfileImageResponseDto, - DeleteUserDto, - UpdateUserDto as UpdateDto, - UserResponseDto, - UserService, -} from '@app/domain'; import { Body, Controller, @@ -26,10 +16,18 @@ import { } from '@nestjs/common'; import { ApiBody, ApiConsumes, ApiTags } from '@nestjs/swagger'; import { NextFunction, Response } from 'express'; -import { AdminRoute, Auth, Authenticated, FileResponse } from '../app.guard'; -import { sendFile } from '../app.utils'; -import { FileUploadInterceptor, Route } from '../interceptors'; -import { UUIDParamDto } from './dto/uuid-param.dto'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { CreateProfileImageDto } from 'src/domain/user/dto/create-profile-image.dto'; +import { CreateUserDto } from 'src/domain/user/dto/create-user.dto'; +import { DeleteUserDto } from 'src/domain/user/dto/delete-user.dto'; +import { UpdateUserDto } from 'src/domain/user/dto/update-user.dto'; +import { CreateProfileImageResponseDto } from 'src/domain/user/response-dto/create-profile-image-response.dto'; +import { UserResponseDto } from 'src/domain/user/response-dto/user-response.dto'; +import { UserService } from 'src/domain/user/user.service'; +import { AdminRoute, Auth, Authenticated, FileResponse } from 'src/immich/app.guard'; +import { sendFile } from 'src/immich/app.utils'; +import { UUIDParamDto } from 'src/immich/controllers/dto/uuid-param.dto'; +import { FileUploadInterceptor, Route } from 'src/immich/interceptors/file-upload.interceptor'; @ApiTags('User') @Controller(Route.USER) @@ -54,7 +52,7 @@ export class UserController { @AdminRoute() @Post() - createUser(@Body() createUserDto: CreateDto): Promise { + createUser(@Body() createUserDto: CreateUserDto): Promise { return this.service.create(createUserDto); } @@ -82,7 +80,7 @@ export class UserController { // TODO: replace with @Put(':id') @Put() - updateUser(@Auth() auth: AuthDto, @Body() updateUserDto: UpdateDto): Promise { + updateUser(@Auth() auth: AuthDto, @Body() updateUserDto: UpdateUserDto): Promise { return this.service.update(auth, updateUserDto); } diff --git a/server/src/immich/index.ts b/server/src/immich/index.ts deleted file mode 100644 index c590fa83ea..0000000000 --- a/server/src/immich/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './app.module'; -export * from './controllers'; diff --git a/server/src/immich/interceptors/error.interceptor.ts b/server/src/immich/interceptors/error.interceptor.ts index 5fabdbe55b..809464b374 100644 --- a/server/src/immich/interceptors/error.interceptor.ts +++ b/server/src/immich/interceptors/error.interceptor.ts @@ -1,4 +1,3 @@ -import { ImmichLogger } from '@app/infra/logger'; import { CallHandler, ExecutionContext, @@ -8,8 +7,9 @@ import { NestInterceptor, } from '@nestjs/common'; import { Observable, catchError, throwError } from 'rxjs'; -import { isConnectionAborted } from '../../domain'; -import { routeToErrorMessage } from '../app.utils'; +import { isConnectionAborted } from 'src/domain/domain.util'; +import { routeToErrorMessage } from 'src/immich/app.utils'; +import { ImmichLogger } from 'src/infra/logger'; @Injectable() export class ErrorInterceptor implements NestInterceptor { diff --git a/server/src/immich/interceptors/file-upload.interceptor.ts b/server/src/immich/interceptors/file-upload.interceptor.ts index a698dc8a63..9284ade39e 100644 --- a/server/src/immich/interceptors/file-upload.interceptor.ts +++ b/server/src/immich/interceptors/file-upload.interceptor.ts @@ -1,5 +1,3 @@ -import { AssetService, UploadFieldName, UploadFile } from '@app/domain'; -import { ImmichLogger } from '@app/infra/logger'; import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common'; import { PATH_METADATA } from '@nestjs/common/constants'; import { Reflector } from '@nestjs/core'; @@ -8,7 +6,9 @@ import { NextFunction, RequestHandler } from 'express'; import multer, { StorageEngine, diskStorage } from 'multer'; import { createHash, randomUUID } from 'node:crypto'; import { Observable } from 'rxjs'; -import { AuthRequest } from '../app.guard'; +import { AssetService, UploadFieldName, UploadFile } from 'src/domain/asset/asset.service'; +import { AuthRequest } from 'src/immich/app.guard'; +import { ImmichLogger } from 'src/infra/logger'; export enum Route { ASSET = 'asset', diff --git a/server/src/immich/interceptors/index.ts b/server/src/immich/interceptors/index.ts deleted file mode 100644 index 5811b32324..0000000000 --- a/server/src/immich/interceptors/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './error.interceptor'; -export * from './file-upload.interceptor'; diff --git a/server/src/immich/main.ts b/server/src/immich/main.ts index 60e323e6a5..adfe476a2f 100644 --- a/server/src/immich/main.ts +++ b/server/src/immich/main.ts @@ -1,16 +1,17 @@ -import { WEB_ROOT, envName, isDev, serverVersion } from '@app/domain'; -import { WebSocketAdapter, excludePaths } from '@app/infra'; -import { otelSDK } from '@app/infra/instrumentation'; -import { ImmichLogger } from '@app/infra/logger'; import { NestFactory } from '@nestjs/core'; import { NestExpressApplication } from '@nestjs/platform-express'; import { json } from 'body-parser'; import cookieParser from 'cookie-parser'; import { existsSync } from 'node:fs'; import sirv from 'sirv'; -import { AppModule } from './app.module'; -import { AppService } from './app.service'; -import { useSwagger } from './app.utils'; +import { WEB_ROOT, envName, isDev, serverVersion } from 'src/domain/domain.constant'; +import { AppModule } from 'src/immich/app.module'; +import { AppService } from 'src/immich/app.service'; +import { useSwagger } from 'src/immich/app.utils'; +import { excludePaths } from 'src/infra/infra.config'; +import { otelSDK } from 'src/infra/instrumentation'; +import { ImmichLogger } from 'src/infra/logger'; +import { WebSocketAdapter } from 'src/infra/websocket.adapter'; const logger = new ImmichLogger('ImmichServer'); const port = Number(process.env.SERVER_PORT) || 3001; diff --git a/server/src/infra/database.config.ts b/server/src/infra/database.config.ts index 773e79f8a0..ccb0f6a32e 100644 --- a/server/src/infra/database.config.ts +++ b/server/src/infra/database.config.ts @@ -1,4 +1,4 @@ -import { DatabaseExtension } from '@app/domain/repositories/database.repository'; +import { DatabaseExtension } from 'src/domain/repositories/database.repository'; import { DataSource } from 'typeorm'; import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions.js'; diff --git a/server/src/infra/entities/activity.entity.ts b/server/src/infra/entities/activity.entity.ts index 255a3a7084..4785955563 100644 --- a/server/src/infra/entities/activity.entity.ts +++ b/server/src/infra/entities/activity.entity.ts @@ -1,3 +1,6 @@ +import { AlbumEntity } from 'src/infra/entities/album.entity'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { UserEntity } from 'src/infra/entities/user.entity'; import { Check, Column, @@ -8,9 +11,6 @@ import { PrimaryGeneratedColumn, UpdateDateColumn, } from 'typeorm'; -import { AlbumEntity } from './album.entity'; -import { AssetEntity } from './asset.entity'; -import { UserEntity } from './user.entity'; @Entity('activity') @Index('IDX_activity_like', ['assetId', 'userId', 'albumId'], { unique: true, where: '("isLiked" = true)' }) diff --git a/server/src/infra/entities/album.entity.ts b/server/src/infra/entities/album.entity.ts index daa8fcbc36..ab15d401d4 100644 --- a/server/src/infra/entities/album.entity.ts +++ b/server/src/infra/entities/album.entity.ts @@ -1,3 +1,6 @@ +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { SharedLinkEntity } from 'src/infra/entities/shared-link.entity'; +import { UserEntity } from 'src/infra/entities/user.entity'; import { Column, CreateDateColumn, @@ -10,9 +13,6 @@ import { PrimaryGeneratedColumn, UpdateDateColumn, } from 'typeorm'; -import { AssetEntity } from './asset.entity'; -import { SharedLinkEntity } from './shared-link.entity'; -import { UserEntity } from './user.entity'; // ran into issues when importing the enum from `asset.dto.ts` export enum AssetOrder { diff --git a/server/src/infra/entities/api-key.entity.ts b/server/src/infra/entities/api-key.entity.ts index 0c8252fe43..0d1893398f 100644 --- a/server/src/infra/entities/api-key.entity.ts +++ b/server/src/infra/entities/api-key.entity.ts @@ -1,5 +1,5 @@ +import { UserEntity } from 'src/infra/entities/user.entity'; import { Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'; -import { UserEntity } from './user.entity'; @Entity('api_keys') export class APIKeyEntity { diff --git a/server/src/infra/entities/asset-face.entity.ts b/server/src/infra/entities/asset-face.entity.ts index 1561f67d00..afd2a263ac 100644 --- a/server/src/infra/entities/asset-face.entity.ts +++ b/server/src/infra/entities/asset-face.entity.ts @@ -1,6 +1,6 @@ +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { PersonEntity } from 'src/infra/entities/person.entity'; import { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; -import { AssetEntity } from './asset.entity'; -import { PersonEntity } from './person.entity'; @Entity('asset_faces', { synchronize: false }) @Index('IDX_asset_faces_assetId_personId', ['assetId', 'personId']) diff --git a/server/src/infra/entities/asset-job-status.entity.ts b/server/src/infra/entities/asset-job-status.entity.ts index f1965fbdb8..22d98e367d 100644 --- a/server/src/infra/entities/asset-job-status.entity.ts +++ b/server/src/infra/entities/asset-job-status.entity.ts @@ -1,5 +1,5 @@ +import { AssetEntity } from 'src/infra/entities/asset.entity'; import { Column, Entity, JoinColumn, OneToOne, PrimaryColumn } from 'typeorm'; -import { AssetEntity } from './asset.entity'; @Entity('asset_job_status') export class AssetJobStatusEntity { diff --git a/server/src/infra/entities/asset-stack.entity.ts b/server/src/infra/entities/asset-stack.entity.ts index d005fc0a59..372fac1e40 100644 --- a/server/src/infra/entities/asset-stack.entity.ts +++ b/server/src/infra/entities/asset-stack.entity.ts @@ -1,5 +1,5 @@ +import { AssetEntity } from 'src/infra/entities/asset.entity'; import { Column, Entity, JoinColumn, OneToMany, OneToOne, PrimaryGeneratedColumn } from 'typeorm'; -import { AssetEntity } from './asset.entity'; @Entity('asset_stack') export class AssetStackEntity { diff --git a/server/src/infra/entities/asset.entity.ts b/server/src/infra/entities/asset.entity.ts index 78a9617575..e82bbfb00d 100644 --- a/server/src/infra/entities/asset.entity.ts +++ b/server/src/infra/entities/asset.entity.ts @@ -1,3 +1,14 @@ +import { AlbumEntity } from 'src/infra/entities/album.entity'; +import { AssetFaceEntity } from 'src/infra/entities/asset-face.entity'; +import { AssetJobStatusEntity } from 'src/infra/entities/asset-job-status.entity'; +import { AssetStackEntity } from 'src/infra/entities/asset-stack.entity'; +import { ExifEntity } from 'src/infra/entities/exif.entity'; +import { LibraryEntity } from 'src/infra/entities/library.entity'; +import { SharedLinkEntity } from 'src/infra/entities/shared-link.entity'; +import { SmartInfoEntity } from 'src/infra/entities/smart-info.entity'; +import { SmartSearchEntity } from 'src/infra/entities/smart-search.entity'; +import { TagEntity } from 'src/infra/entities/tag.entity'; +import { UserEntity } from 'src/infra/entities/user.entity'; import { Column, CreateDateColumn, @@ -13,17 +24,6 @@ import { PrimaryGeneratedColumn, UpdateDateColumn, } from 'typeorm'; -import { AlbumEntity } from './album.entity'; -import { AssetFaceEntity } from './asset-face.entity'; -import { AssetJobStatusEntity } from './asset-job-status.entity'; -import { AssetStackEntity } from './asset-stack.entity'; -import { ExifEntity } from './exif.entity'; -import { LibraryEntity } from './library.entity'; -import { SharedLinkEntity } from './shared-link.entity'; -import { SmartInfoEntity } from './smart-info.entity'; -import { SmartSearchEntity } from './smart-search.entity'; -import { TagEntity } from './tag.entity'; -import { UserEntity } from './user.entity'; export const ASSET_CHECKSUM_CONSTRAINT = 'UQ_assets_owner_library_checksum'; diff --git a/server/src/infra/entities/exif.entity.ts b/server/src/infra/entities/exif.entity.ts index 639e24a50a..8ed645d11b 100644 --- a/server/src/infra/entities/exif.entity.ts +++ b/server/src/infra/entities/exif.entity.ts @@ -1,7 +1,7 @@ +import { AssetEntity } from 'src/infra/entities/asset.entity'; import { Index, JoinColumn, OneToOne, PrimaryColumn } from 'typeorm'; import { Column } from 'typeorm/decorator/columns/Column.js'; import { Entity } from 'typeorm/decorator/entity/Entity.js'; -import { AssetEntity } from './asset.entity'; @Entity('exif') export class ExifEntity { diff --git a/server/src/infra/entities/index.ts b/server/src/infra/entities/index.ts index af620790ef..47fc3c7f19 100644 --- a/server/src/infra/entities/index.ts +++ b/server/src/infra/entities/index.ts @@ -1,48 +1,25 @@ -import { ActivityEntity } from './activity.entity'; -import { AlbumEntity } from './album.entity'; -import { APIKeyEntity } from './api-key.entity'; -import { AssetFaceEntity } from './asset-face.entity'; -import { AssetJobStatusEntity } from './asset-job-status.entity'; -import { AssetStackEntity } from './asset-stack.entity'; -import { AssetEntity } from './asset.entity'; -import { AuditEntity } from './audit.entity'; -import { ExifEntity } from './exif.entity'; -import { GeodataPlacesEntity } from './geodata-places.entity'; -import { LibraryEntity } from './library.entity'; -import { MoveEntity } from './move.entity'; -import { PartnerEntity } from './partner.entity'; -import { PersonEntity } from './person.entity'; -import { SharedLinkEntity } from './shared-link.entity'; -import { SmartInfoEntity } from './smart-info.entity'; -import { SmartSearchEntity } from './smart-search.entity'; -import { SystemConfigEntity } from './system-config.entity'; -import { SystemMetadataEntity } from './system-metadata.entity'; -import { TagEntity } from './tag.entity'; -import { UserTokenEntity } from './user-token.entity'; -import { UserEntity } from './user.entity'; - -export * from './activity.entity'; -export * from './album.entity'; -export * from './api-key.entity'; -export * from './asset-face.entity'; -export * from './asset-job-status.entity'; -export * from './asset-stack.entity'; -export * from './asset.entity'; -export * from './audit.entity'; -export * from './exif.entity'; -export * from './geodata-places.entity'; -export * from './library.entity'; -export * from './move.entity'; -export * from './partner.entity'; -export * from './person.entity'; -export * from './shared-link.entity'; -export * from './smart-info.entity'; -export * from './smart-search.entity'; -export * from './system-config.entity'; -export * from './system-metadata.entity'; -export * from './tag.entity'; -export * from './user-token.entity'; -export * from './user.entity'; +import { ActivityEntity } from 'src/infra/entities/activity.entity'; +import { AlbumEntity } from 'src/infra/entities/album.entity'; +import { APIKeyEntity } from 'src/infra/entities/api-key.entity'; +import { AssetFaceEntity } from 'src/infra/entities/asset-face.entity'; +import { AssetJobStatusEntity } from 'src/infra/entities/asset-job-status.entity'; +import { AssetStackEntity } from 'src/infra/entities/asset-stack.entity'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { AuditEntity } from 'src/infra/entities/audit.entity'; +import { ExifEntity } from 'src/infra/entities/exif.entity'; +import { GeodataPlacesEntity } from 'src/infra/entities/geodata-places.entity'; +import { LibraryEntity } from 'src/infra/entities/library.entity'; +import { MoveEntity } from 'src/infra/entities/move.entity'; +import { PartnerEntity } from 'src/infra/entities/partner.entity'; +import { PersonEntity } from 'src/infra/entities/person.entity'; +import { SharedLinkEntity } from 'src/infra/entities/shared-link.entity'; +import { SmartInfoEntity } from 'src/infra/entities/smart-info.entity'; +import { SmartSearchEntity } from 'src/infra/entities/smart-search.entity'; +import { SystemConfigEntity } from 'src/infra/entities/system-config.entity'; +import { SystemMetadataEntity } from 'src/infra/entities/system-metadata.entity'; +import { TagEntity } from 'src/infra/entities/tag.entity'; +import { UserTokenEntity } from 'src/infra/entities/user-token.entity'; +import { UserEntity } from 'src/infra/entities/user.entity'; export const databaseEntities = [ ActivityEntity, diff --git a/server/src/infra/entities/library.entity.ts b/server/src/infra/entities/library.entity.ts index bf5f444abb..f68a380952 100644 --- a/server/src/infra/entities/library.entity.ts +++ b/server/src/infra/entities/library.entity.ts @@ -1,3 +1,5 @@ +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { UserEntity } from 'src/infra/entities/user.entity'; import { Column, CreateDateColumn, @@ -9,8 +11,6 @@ import { PrimaryGeneratedColumn, UpdateDateColumn, } from 'typeorm'; -import { AssetEntity } from './asset.entity'; -import { UserEntity } from './user.entity'; @Entity('libraries') export class LibraryEntity { diff --git a/server/src/infra/entities/partner.entity.ts b/server/src/infra/entities/partner.entity.ts index 35d32e4c9b..abf0400dae 100644 --- a/server/src/infra/entities/partner.entity.ts +++ b/server/src/infra/entities/partner.entity.ts @@ -1,7 +1,6 @@ +import { UserEntity } from 'src/infra/entities/user.entity'; import { Column, CreateDateColumn, Entity, JoinColumn, ManyToOne, PrimaryColumn, UpdateDateColumn } from 'typeorm'; -import { UserEntity } from './user.entity'; - @Entity('partners') export class PartnerEntity { @PrimaryColumn('uuid') diff --git a/server/src/infra/entities/person.entity.ts b/server/src/infra/entities/person.entity.ts index ecba45dd2c..046ac9d407 100644 --- a/server/src/infra/entities/person.entity.ts +++ b/server/src/infra/entities/person.entity.ts @@ -1,3 +1,5 @@ +import { AssetFaceEntity } from 'src/infra/entities/asset-face.entity'; +import { UserEntity } from 'src/infra/entities/user.entity'; import { Check, Column, @@ -8,8 +10,6 @@ import { PrimaryGeneratedColumn, UpdateDateColumn, } from 'typeorm'; -import { AssetFaceEntity } from './asset-face.entity'; -import { UserEntity } from './user.entity'; @Entity('person') @Check(`"birthDate" <= CURRENT_DATE`) diff --git a/server/src/infra/entities/shared-link.entity.ts b/server/src/infra/entities/shared-link.entity.ts index e7cd19e53f..7370146df2 100644 --- a/server/src/infra/entities/shared-link.entity.ts +++ b/server/src/infra/entities/shared-link.entity.ts @@ -1,3 +1,6 @@ +import { AlbumEntity } from 'src/infra/entities/album.entity'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { UserEntity } from 'src/infra/entities/user.entity'; import { Column, CreateDateColumn, @@ -8,9 +11,6 @@ import { PrimaryGeneratedColumn, Unique, } from 'typeorm'; -import { AlbumEntity } from './album.entity'; -import { AssetEntity } from './asset.entity'; -import { UserEntity } from './user.entity'; @Entity('shared_links') @Unique('UQ_sharedlink_key', ['key']) diff --git a/server/src/infra/entities/smart-info.entity.ts b/server/src/infra/entities/smart-info.entity.ts index 2606de60eb..5bd65e7fbe 100644 --- a/server/src/infra/entities/smart-info.entity.ts +++ b/server/src/infra/entities/smart-info.entity.ts @@ -1,5 +1,5 @@ +import { AssetEntity } from 'src/infra/entities/asset.entity'; import { Column, Entity, JoinColumn, OneToOne, PrimaryColumn } from 'typeorm'; -import { AssetEntity } from './asset.entity'; @Entity('smart_info', { synchronize: false }) export class SmartInfoEntity { diff --git a/server/src/infra/entities/smart-search.entity.ts b/server/src/infra/entities/smart-search.entity.ts index 2b295ac909..bbd966fd4e 100644 --- a/server/src/infra/entities/smart-search.entity.ts +++ b/server/src/infra/entities/smart-search.entity.ts @@ -1,5 +1,5 @@ +import { AssetEntity } from 'src/infra/entities/asset.entity'; import { Column, Entity, Index, JoinColumn, OneToOne, PrimaryColumn } from 'typeorm'; -import { AssetEntity } from './asset.entity'; @Entity('smart_search', { synchronize: false }) export class SmartSearchEntity { diff --git a/server/src/infra/entities/system-config.entity.ts b/server/src/infra/entities/system-config.entity.ts index 1ba219429e..cf7474417c 100644 --- a/server/src/infra/entities/system-config.entity.ts +++ b/server/src/infra/entities/system-config.entity.ts @@ -1,4 +1,4 @@ -import { ConcurrentQueueName } from '@app/domain'; +import { ConcurrentQueueName } from 'src/domain/job/job.constants'; import { Column, Entity, PrimaryColumn } from 'typeorm'; @Entity('system_config') diff --git a/server/src/infra/entities/tag.entity.ts b/server/src/infra/entities/tag.entity.ts index a364529dba..b159dcb2eb 100644 --- a/server/src/infra/entities/tag.entity.ts +++ b/server/src/infra/entities/tag.entity.ts @@ -1,6 +1,6 @@ +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { UserEntity } from 'src/infra/entities/user.entity'; import { Column, Entity, ManyToMany, ManyToOne, PrimaryGeneratedColumn, Unique } from 'typeorm'; -import { AssetEntity } from './asset.entity'; -import { UserEntity } from './user.entity'; @Entity('tags') @Unique('UQ_tag_name_userId', ['name', 'userId']) diff --git a/server/src/infra/entities/user-token.entity.ts b/server/src/infra/entities/user-token.entity.ts index a39e93a33e..fd04c20dd1 100644 --- a/server/src/infra/entities/user-token.entity.ts +++ b/server/src/infra/entities/user-token.entity.ts @@ -1,5 +1,5 @@ +import { UserEntity } from 'src/infra/entities/user.entity'; import { Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'; -import { UserEntity } from './user.entity'; @Entity('user_token') export class UserTokenEntity { diff --git a/server/src/infra/entities/user.entity.ts b/server/src/infra/entities/user.entity.ts index 20c057d790..888655d3ba 100644 --- a/server/src/infra/entities/user.entity.ts +++ b/server/src/infra/entities/user.entity.ts @@ -1,3 +1,5 @@ +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { TagEntity } from 'src/infra/entities/tag.entity'; import { Column, CreateDateColumn, @@ -7,8 +9,6 @@ import { PrimaryGeneratedColumn, UpdateDateColumn, } from 'typeorm'; -import { AssetEntity } from './asset.entity'; -import { TagEntity } from './tag.entity'; export enum UserAvatarColor { PRIMARY = 'primary', diff --git a/server/src/infra/index.ts b/server/src/infra/index.ts deleted file mode 100644 index 6a218d81c8..0000000000 --- a/server/src/infra/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './database.config'; -export * from './infra.config'; -export * from './infra.module'; -export * from './websocket.adapter'; diff --git a/server/src/infra/infra.config.ts b/server/src/infra/infra.config.ts index 9ea570953a..f521b96b75 100644 --- a/server/src/infra/infra.config.ts +++ b/server/src/infra/infra.config.ts @@ -1,7 +1,7 @@ -import { QueueName } from '@app/domain'; import { RegisterQueueOptions } from '@nestjs/bullmq'; import { QueueOptions } from 'bullmq'; import { RedisOptions } from 'ioredis'; +import { QueueName } from 'src/domain/job/job.constants'; function parseRedisConfig(): RedisOptions { const redisUrl = process.env.REDIS_URL; diff --git a/server/src/infra/infra.module.ts b/server/src/infra/infra.module.ts index df3773deb2..7ac208c1fc 100644 --- a/server/src/infra/infra.module.ts +++ b/server/src/infra/infra.module.ts @@ -1,33 +1,3 @@ -import { - IAccessRepository, - IActivityRepository, - IAlbumRepository, - IAssetRepository, - IAssetStackRepository, - IAuditRepository, - ICommunicationRepository, - ICryptoRepository, - IDatabaseRepository, - IJobRepository, - IKeyRepository, - ILibraryRepository, - IMachineLearningRepository, - IMediaRepository, - IMetadataRepository, - IMoveRepository, - IPartnerRepository, - IPersonRepository, - ISearchRepository, - IServerInfoRepository, - ISharedLinkRepository, - IStorageRepository, - ISystemConfigRepository, - ISystemMetadataRepository, - ITagRepository, - IUserRepository, - IUserTokenRepository, - immichAppConfig, -} from '@app/domain'; import { BullModule } from '@nestjs/bullmq'; import { Global, Module, Provider } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; @@ -35,39 +5,65 @@ import { EventEmitterModule } from '@nestjs/event-emitter'; import { ScheduleModule, SchedulerRegistry } from '@nestjs/schedule'; import { TypeOrmModule } from '@nestjs/typeorm'; import { OpenTelemetryModule } from 'nestjs-otel'; -import { databaseConfig } from './database.config'; -import { databaseEntities } from './entities'; -import { bullConfig, bullQueues } from './infra.config'; -import { otelConfig } from './instrumentation'; -import { - AccessRepository, - ActivityRepository, - AlbumRepository, - ApiKeyRepository, - AssetRepository, - AssetStackRepository, - AuditRepository, - CommunicationRepository, - CryptoRepository, - DatabaseRepository, - FilesystemProvider, - JobRepository, - LibraryRepository, - MachineLearningRepository, - MediaRepository, - MetadataRepository, - MoveRepository, - PartnerRepository, - PersonRepository, - SearchRepository, - ServerInfoRepository, - SharedLinkRepository, - SystemConfigRepository, - SystemMetadataRepository, - TagRepository, - UserRepository, - UserTokenRepository, -} from './repositories'; +import { immichAppConfig } from 'src/domain/domain.config'; +import { IAccessRepository } from 'src/domain/repositories/access.repository'; +import { IActivityRepository } from 'src/domain/repositories/activity.repository'; +import { IAlbumRepository } from 'src/domain/repositories/album.repository'; +import { IKeyRepository } from 'src/domain/repositories/api-key.repository'; +import { IAssetStackRepository } from 'src/domain/repositories/asset-stack.repository'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; +import { IAuditRepository } from 'src/domain/repositories/audit.repository'; +import { ICommunicationRepository } from 'src/domain/repositories/communication.repository'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { IDatabaseRepository } from 'src/domain/repositories/database.repository'; +import { IJobRepository } from 'src/domain/repositories/job.repository'; +import { ILibraryRepository } from 'src/domain/repositories/library.repository'; +import { IMachineLearningRepository } from 'src/domain/repositories/machine-learning.repository'; +import { IMediaRepository } from 'src/domain/repositories/media.repository'; +import { IMetadataRepository } from 'src/domain/repositories/metadata.repository'; +import { IMoveRepository } from 'src/domain/repositories/move.repository'; +import { IPartnerRepository } from 'src/domain/repositories/partner.repository'; +import { IPersonRepository } from 'src/domain/repositories/person.repository'; +import { ISearchRepository } from 'src/domain/repositories/search.repository'; +import { IServerInfoRepository } from 'src/domain/repositories/server-info.repository'; +import { ISharedLinkRepository } from 'src/domain/repositories/shared-link.repository'; +import { IStorageRepository } from 'src/domain/repositories/storage.repository'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { ISystemMetadataRepository } from 'src/domain/repositories/system-metadata.repository'; +import { ITagRepository } from 'src/domain/repositories/tag.repository'; +import { IUserTokenRepository } from 'src/domain/repositories/user-token.repository'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { databaseConfig } from 'src/infra/database.config'; +import { databaseEntities } from 'src/infra/entities'; +import { bullConfig, bullQueues } from 'src/infra/infra.config'; +import { otelConfig } from 'src/infra/instrumentation'; +import { AccessRepository } from 'src/infra/repositories/access.repository'; +import { ActivityRepository } from 'src/infra/repositories/activity.repository'; +import { AlbumRepository } from 'src/infra/repositories/album.repository'; +import { ApiKeyRepository } from 'src/infra/repositories/api-key.repository'; +import { AssetStackRepository } from 'src/infra/repositories/asset-stack.repository'; +import { AssetRepository } from 'src/infra/repositories/asset.repository'; +import { AuditRepository } from 'src/infra/repositories/audit.repository'; +import { CommunicationRepository } from 'src/infra/repositories/communication.repository'; +import { CryptoRepository } from 'src/infra/repositories/crypto.repository'; +import { DatabaseRepository } from 'src/infra/repositories/database.repository'; +import { FilesystemProvider } from 'src/infra/repositories/filesystem.provider'; +import { JobRepository } from 'src/infra/repositories/job.repository'; +import { LibraryRepository } from 'src/infra/repositories/library.repository'; +import { MachineLearningRepository } from 'src/infra/repositories/machine-learning.repository'; +import { MediaRepository } from 'src/infra/repositories/media.repository'; +import { MetadataRepository } from 'src/infra/repositories/metadata.repository'; +import { MoveRepository } from 'src/infra/repositories/move.repository'; +import { PartnerRepository } from 'src/infra/repositories/partner.repository'; +import { PersonRepository } from 'src/infra/repositories/person.repository'; +import { SearchRepository } from 'src/infra/repositories/search.repository'; +import { ServerInfoRepository } from 'src/infra/repositories/server-info.repository'; +import { SharedLinkRepository } from 'src/infra/repositories/shared-link.repository'; +import { SystemConfigRepository } from 'src/infra/repositories/system-config.repository'; +import { SystemMetadataRepository } from 'src/infra/repositories/system-metadata.repository'; +import { TagRepository } from 'src/infra/repositories/tag.repository'; +import { UserTokenRepository } from 'src/infra/repositories/user-token.repository'; +import { UserRepository } from 'src/infra/repositories/user.repository'; const providers: Provider[] = [ { provide: IActivityRepository, useClass: ActivityRepository }, diff --git a/server/src/infra/infra.utils.ts b/server/src/infra/infra.utils.ts index 2472441088..2cc5f629af 100644 --- a/server/src/infra/infra.utils.ts +++ b/server/src/infra/infra.utils.ts @@ -1,5 +1,16 @@ -import { AssetSearchBuilderOptions, Paginated, PaginationOptions } from '@app/domain'; import _ from 'lodash'; +import { + Paginated, + PaginatedBuilderOptions, + PaginationMode, + PaginationOptions, + PaginationResult, + chunks, + setUnion, +} from 'src/domain/domain.util'; +import { AssetSearchBuilderOptions } from 'src/domain/repositories/search.repository'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { DATABASE_PARAMETER_CHUNK_SIZE } from 'src/infra/infra.util'; import { Between, FindManyOptions, @@ -11,9 +22,6 @@ import { Repository, SelectQueryBuilder, } from 'typeorm'; -import { PaginatedBuilderOptions, PaginationMode, PaginationResult, chunks, setUnion } from '../domain/domain.util'; -import { AssetEntity } from './entities'; -import { DATABASE_PARAMETER_CHUNK_SIZE } from './infra.util'; /** * Allows optional values unlike the regular Between and uses MoreThanOrEqual diff --git a/server/src/infra/instrumentation.ts b/server/src/infra/instrumentation.ts index 130eaea3d9..2c912660ee 100644 --- a/server/src/infra/instrumentation.ts +++ b/server/src/infra/instrumentation.ts @@ -1,4 +1,3 @@ -import { serverVersion } from '@app/domain/domain.constant'; import { Histogram, MetricOptions, ValueType, metrics } from '@opentelemetry/api'; import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks'; import { PrometheusExporter } from '@opentelemetry/exporter-prometheus'; @@ -14,8 +13,9 @@ import { snakeCase, startCase } from 'lodash'; import { OpenTelemetryModuleOptions } from 'nestjs-otel/lib/interfaces'; import { copyMetadataFromFunctionToFunction } from 'nestjs-otel/lib/opentelemetry.utils'; import { performance } from 'node:perf_hooks'; -import { excludePaths } from './infra.config'; -import { DecorateAll } from './infra.utils'; +import { serverVersion } from 'src/domain/domain.constant'; +import { excludePaths } from 'src/infra/infra.config'; +import { DecorateAll } from 'src/infra/infra.utils'; let metricsEnabled = process.env.IMMICH_METRICS === 'true'; const hostMetrics = diff --git a/server/src/infra/logger.ts b/server/src/infra/logger.ts index 8de149c409..dcc87a8752 100644 --- a/server/src/infra/logger.ts +++ b/server/src/infra/logger.ts @@ -1,6 +1,6 @@ import { ConsoleLogger } from '@nestjs/common'; import { isLogLevelEnabled } from '@nestjs/common/services/utils/is-log-level-enabled.util'; -import { LogLevel } from './entities'; +import { LogLevel } from 'src/infra/entities/system-config.entity'; const LOG_LEVELS = [LogLevel.VERBOSE, LogLevel.DEBUG, LogLevel.LOG, LogLevel.WARN, LogLevel.ERROR, LogLevel.FATAL]; diff --git a/server/src/infra/migrations/1700713871511-UsePgVectors.ts b/server/src/infra/migrations/1700713871511-UsePgVectors.ts index 008d5eadc8..46d5320ce1 100644 --- a/server/src/infra/migrations/1700713871511-UsePgVectors.ts +++ b/server/src/infra/migrations/1700713871511-UsePgVectors.ts @@ -1,6 +1,6 @@ -import { getCLIPModelInfo } from '@app/domain/smart-info/smart-info.constant'; +import { getCLIPModelInfo } from 'src/domain/smart-info/smart-info.constant'; +import { vectorExt } from 'src/infra/database.config'; import { MigrationInterface, QueryRunner } from 'typeorm'; -import { vectorExt } from '@app/infra/database.config'; export class UsePgVectors1700713871511 implements MigrationInterface { name = 'UsePgVectors1700713871511'; @@ -14,12 +14,14 @@ export class UsePgVectors1700713871511 implements MigrationInterface { LIMIT 1`); const faceDimSize = faceDimQuery?.[0]?.['dimsize'] ?? 512; - const clipModelNameQuery = await queryRunner.query(`SELECT value FROM system_config WHERE key = 'machineLearning.clip.modelName'`); + const clipModelNameQuery = await queryRunner.query( + `SELECT value FROM system_config WHERE key = 'machineLearning.clip.modelName'`, + ); const clipModelName: string = clipModelNameQuery?.[0]?.['value'] ?? 'ViT-B-32__openai'; const clipDimSize = getCLIPModelInfo(clipModelName.replaceAll('"', '')).dimSize; await queryRunner.query(` - ALTER TABLE asset_faces + ALTER TABLE asset_faces ALTER COLUMN embedding SET NOT NULL, ALTER COLUMN embedding TYPE vector(${faceDimSize})`); @@ -37,7 +39,7 @@ export class UsePgVectors1700713871511 implements MigrationInterface { AND array_position(si."clipEmbedding", NULL) IS NULL`); await queryRunner.query(`ALTER TABLE smart_info DROP COLUMN IF EXISTS "clipEmbedding"`); - } + } public async down(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE asset_faces ALTER COLUMN embedding TYPE real array`); diff --git a/server/src/infra/migrations/1700713994428-AddCLIPEmbeddingIndex.ts b/server/src/infra/migrations/1700713994428-AddCLIPEmbeddingIndex.ts index c3716cc191..505b4dbcb8 100644 --- a/server/src/infra/migrations/1700713994428-AddCLIPEmbeddingIndex.ts +++ b/server/src/infra/migrations/1700713994428-AddCLIPEmbeddingIndex.ts @@ -1,6 +1,6 @@ +import { DatabaseExtension } from 'src/domain/repositories/database.repository'; +import { vectorExt } from 'src/infra/database.config'; import { MigrationInterface, QueryRunner } from 'typeorm'; -import { vectorExt } from '../database.config'; -import { DatabaseExtension } from '@app/domain/repositories/database.repository'; export class AddCLIPEmbeddingIndex1700713994428 implements MigrationInterface { name = 'AddCLIPEmbeddingIndex1700713994428'; diff --git a/server/src/infra/migrations/1700714033632-AddFaceEmbeddingIndex.ts b/server/src/infra/migrations/1700714033632-AddFaceEmbeddingIndex.ts index 066303530a..e79c220456 100644 --- a/server/src/infra/migrations/1700714033632-AddFaceEmbeddingIndex.ts +++ b/server/src/infra/migrations/1700714033632-AddFaceEmbeddingIndex.ts @@ -1,6 +1,6 @@ +import { DatabaseExtension } from 'src/domain/repositories/database.repository'; +import { vectorExt } from 'src/infra/database.config'; import { MigrationInterface, QueryRunner } from 'typeorm'; -import { vectorExt } from '../database.config'; -import { DatabaseExtension } from '@app/domain/repositories/database.repository'; export class AddFaceEmbeddingIndex1700714033632 implements MigrationInterface { name = 'AddFaceEmbeddingIndex1700714033632'; diff --git a/server/src/infra/repositories/access.repository.ts b/server/src/infra/repositories/access.repository.ts index ad650bf0e6..1f96226a6f 100644 --- a/server/src/infra/repositories/access.repository.ts +++ b/server/src/infra/repositories/access.repository.ts @@ -1,20 +1,18 @@ -import { IAccessRepository } from '@app/domain'; import { InjectRepository } from '@nestjs/typeorm'; +import { IAccessRepository } from 'src/domain/repositories/access.repository'; +import { ActivityEntity } from 'src/infra/entities/activity.entity'; +import { AlbumEntity } from 'src/infra/entities/album.entity'; +import { AssetFaceEntity } from 'src/infra/entities/asset-face.entity'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { LibraryEntity } from 'src/infra/entities/library.entity'; +import { PartnerEntity } from 'src/infra/entities/partner.entity'; +import { PersonEntity } from 'src/infra/entities/person.entity'; +import { SharedLinkEntity } from 'src/infra/entities/shared-link.entity'; +import { UserTokenEntity } from 'src/infra/entities/user-token.entity'; +import { DummyValue, GenerateSql } from 'src/infra/infra.util'; +import { ChunkedSet } from 'src/infra/infra.utils'; +import { Instrumentation } from 'src/infra/instrumentation'; import { Brackets, In, Repository } from 'typeorm'; -import { - ActivityEntity, - AlbumEntity, - AssetEntity, - AssetFaceEntity, - LibraryEntity, - PartnerEntity, - PersonEntity, - SharedLinkEntity, - UserTokenEntity, -} from '../entities'; -import { DummyValue, GenerateSql } from '../infra.util'; -import { ChunkedSet } from '../infra.utils'; -import { Instrumentation } from '../instrumentation'; type IActivityAccess = IAccessRepository['activity']; type IAlbumAccess = IAccessRepository['album']; diff --git a/server/src/infra/repositories/activity.repository.ts b/server/src/infra/repositories/activity.repository.ts index c546056dbe..afa52ec3a4 100644 --- a/server/src/infra/repositories/activity.repository.ts +++ b/server/src/infra/repositories/activity.repository.ts @@ -1,10 +1,10 @@ -import { IActivityRepository } from '@app/domain'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; +import { IActivityRepository } from 'src/domain/repositories/activity.repository'; +import { ActivityEntity } from 'src/infra/entities/activity.entity'; +import { DummyValue, GenerateSql } from 'src/infra/infra.util'; +import { Instrumentation } from 'src/infra/instrumentation'; import { IsNull, Repository } from 'typeorm'; -import { ActivityEntity } from '../entities/activity.entity'; -import { DummyValue, GenerateSql } from '../infra.util'; -import { Instrumentation } from '../instrumentation'; export interface ActivitySearch { albumId?: string; diff --git a/server/src/infra/repositories/album.repository.ts b/server/src/infra/repositories/album.repository.ts index 60ef6126ce..86b73866f4 100644 --- a/server/src/infra/repositories/album.repository.ts +++ b/server/src/infra/repositories/album.repository.ts @@ -1,14 +1,21 @@ -import { AlbumAsset, AlbumAssetCount, AlbumAssets, AlbumInfoOptions, IAlbumRepository } from '@app/domain'; import { Injectable } from '@nestjs/common'; import { InjectDataSource, InjectRepository } from '@nestjs/typeorm'; import _ from 'lodash'; +import { setUnion } from 'src/domain/domain.util'; +import { + AlbumAsset, + AlbumAssetCount, + AlbumAssets, + AlbumInfoOptions, + IAlbumRepository, +} from 'src/domain/repositories/album.repository'; +import { dataSource } from 'src/infra/database.config'; +import { AlbumEntity } from 'src/infra/entities/album.entity'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { DATABASE_PARAMETER_CHUNK_SIZE, DummyValue, GenerateSql } from 'src/infra/infra.util'; +import { Chunked, ChunkedArray } from 'src/infra/infra.utils'; +import { Instrumentation } from 'src/infra/instrumentation'; import { DataSource, FindOptionsOrder, FindOptionsRelations, In, IsNull, Not, Repository } from 'typeorm'; -import { setUnion } from '../../domain/domain.util'; -import { dataSource } from '../database.config'; -import { AlbumEntity, AssetEntity } from '../entities'; -import { DATABASE_PARAMETER_CHUNK_SIZE, DummyValue, GenerateSql } from '../infra.util'; -import { Chunked, ChunkedArray } from '../infra.utils'; -import { Instrumentation } from '../instrumentation'; @Instrumentation() @Injectable() diff --git a/server/src/infra/repositories/api-key.repository.ts b/server/src/infra/repositories/api-key.repository.ts index 3cafc22ebf..bdc9e6d0bf 100644 --- a/server/src/infra/repositories/api-key.repository.ts +++ b/server/src/infra/repositories/api-key.repository.ts @@ -1,10 +1,10 @@ -import { IKeyRepository } from '@app/domain'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; +import { IKeyRepository } from 'src/domain/repositories/api-key.repository'; +import { APIKeyEntity } from 'src/infra/entities/api-key.entity'; +import { DummyValue, GenerateSql } from 'src/infra/infra.util'; +import { Instrumentation } from 'src/infra/instrumentation'; import { Repository } from 'typeorm'; -import { APIKeyEntity } from '../entities'; -import { DummyValue, GenerateSql } from '../infra.util'; -import { Instrumentation } from '../instrumentation'; @Instrumentation() @Injectable() diff --git a/server/src/infra/repositories/asset-stack.repository.ts b/server/src/infra/repositories/asset-stack.repository.ts index d769030bb8..556098ff1a 100644 --- a/server/src/infra/repositories/asset-stack.repository.ts +++ b/server/src/infra/repositories/asset-stack.repository.ts @@ -1,9 +1,9 @@ -import { IAssetStackRepository } from '@app/domain'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; +import { IAssetStackRepository } from 'src/domain/repositories/asset-stack.repository'; +import { AssetStackEntity } from 'src/infra/entities/asset-stack.entity'; +import { Instrumentation } from 'src/infra/instrumentation'; import { Repository } from 'typeorm'; -import { AssetStackEntity } from '../entities'; -import { Instrumentation } from '../instrumentation'; @Instrumentation() @Injectable() diff --git a/server/src/infra/repositories/asset.repository.ts b/server/src/infra/repositories/asset.repository.ts index 3af6eb1509..93f2e42a18 100644 --- a/server/src/infra/repositories/asset.repository.ts +++ b/server/src/infra/repositories/asset.repository.ts @@ -1,9 +1,13 @@ +import { Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { DateTime } from 'luxon'; +import path from 'node:path'; +import { Paginated, PaginationMode, PaginationOptions } from 'src/domain/domain.util'; import { AssetBuilderOptions, AssetCreate, AssetExploreFieldOptions, AssetPathEntity, - AssetSearchOptions, AssetStats, AssetStatsOptions, AssetUpdateAllOptions, @@ -14,20 +18,28 @@ import { MapMarkerSearchOptions, MetadataSearchOptions, MonthDay, - Paginated, - PaginationMode, - PaginationOptions, - SearchExploreItem, TimeBucketItem, TimeBucketOptions, TimeBucketSize, WithProperty, WithoutProperty, -} from '@app/domain'; -import { Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; -import { DateTime } from 'luxon'; -import path from 'node:path'; +} from 'src/domain/repositories/asset.repository'; +import { AssetSearchOptions, SearchExploreItem } from 'src/domain/repositories/search.repository'; +import { AssetOrder } from 'src/infra/entities/album.entity'; +import { AssetJobStatusEntity } from 'src/infra/entities/asset-job-status.entity'; +import { AssetEntity, AssetType } from 'src/infra/entities/asset.entity'; +import { ExifEntity } from 'src/infra/entities/exif.entity'; +import { SmartInfoEntity } from 'src/infra/entities/smart-info.entity'; +import { DummyValue, GenerateSql } from 'src/infra/infra.util'; +import { + Chunked, + ChunkedArray, + OptionalBetween, + paginate, + paginatedBuilder, + searchAssetBuilder, +} from 'src/infra/infra.utils'; +import { Instrumentation } from 'src/infra/instrumentation'; import { Brackets, FindOptionsRelations, @@ -38,10 +50,6 @@ import { Not, Repository, } from 'typeorm'; -import { AssetEntity, AssetJobStatusEntity, AssetOrder, AssetType, ExifEntity, SmartInfoEntity } from '../entities'; -import { DummyValue, GenerateSql } from '../infra.util'; -import { Chunked, ChunkedArray, OptionalBetween, paginate, paginatedBuilder, searchAssetBuilder } from '../infra.utils'; -import { Instrumentation } from '../instrumentation'; const truncateMap: Record = { [TimeBucketSize.DAY]: 'day', diff --git a/server/src/infra/repositories/audit.repository.ts b/server/src/infra/repositories/audit.repository.ts index bc00cbe9a7..71c89c8d05 100644 --- a/server/src/infra/repositories/audit.repository.ts +++ b/server/src/infra/repositories/audit.repository.ts @@ -1,8 +1,8 @@ -import { AuditSearch, IAuditRepository } from '@app/domain'; import { InjectRepository } from '@nestjs/typeorm'; +import { AuditSearch, IAuditRepository } from 'src/domain/repositories/audit.repository'; +import { AuditEntity } from 'src/infra/entities/audit.entity'; +import { Instrumentation } from 'src/infra/instrumentation'; import { LessThan, MoreThan, Repository } from 'typeorm'; -import { AuditEntity } from '../entities'; -import { Instrumentation } from '../instrumentation'; @Instrumentation() export class AuditRepository implements IAuditRepository { diff --git a/server/src/infra/repositories/communication.repository.ts b/server/src/infra/repositories/communication.repository.ts index 6429b6e191..854c6d1f38 100644 --- a/server/src/infra/repositories/communication.repository.ts +++ b/server/src/infra/repositories/communication.repository.ts @@ -1,13 +1,3 @@ -import { - AuthService, - ClientEvent, - ICommunicationRepository, - InternalEventMap, - OnConnectCallback, - OnServerEventCallback, - ServerEvent, -} from '@app/domain'; -import { ImmichLogger } from '@app/infra/logger'; import { EventEmitter2 } from '@nestjs/event-emitter'; import { OnGatewayConnection, @@ -17,7 +7,17 @@ import { WebSocketServer, } from '@nestjs/websockets'; import { Server, Socket } from 'socket.io'; -import { Instrumentation } from '../instrumentation'; +import { AuthService } from 'src/domain/auth/auth.service'; +import { + ClientEvent, + ICommunicationRepository, + InternalEventMap, + OnConnectCallback, + OnServerEventCallback, + ServerEvent, +} from 'src/domain/repositories/communication.repository'; +import { Instrumentation } from 'src/infra/instrumentation'; +import { ImmichLogger } from 'src/infra/logger'; @Instrumentation() @WebSocketGateway({ diff --git a/server/src/infra/repositories/crypto.repository.ts b/server/src/infra/repositories/crypto.repository.ts index f98fa9d878..f7bf63f2c6 100644 --- a/server/src/infra/repositories/crypto.repository.ts +++ b/server/src/infra/repositories/crypto.repository.ts @@ -1,9 +1,9 @@ -import { ICryptoRepository } from '@app/domain'; import { Injectable } from '@nestjs/common'; import { compareSync, hash } from 'bcrypt'; import { createHash, randomBytes, randomUUID } from 'node:crypto'; import { createReadStream } from 'node:fs'; -import { Instrumentation } from '../instrumentation'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; +import { Instrumentation } from 'src/infra/instrumentation'; @Instrumentation() @Injectable() diff --git a/server/src/infra/repositories/database.repository.ts b/server/src/infra/repositories/database.repository.ts index 8154e91224..a83bcf80f8 100644 --- a/server/src/infra/repositories/database.repository.ts +++ b/server/src/infra/repositories/database.repository.ts @@ -1,3 +1,7 @@ +import { Injectable } from '@nestjs/common'; +import { InjectDataSource } from '@nestjs/typeorm'; +import AsyncLock from 'async-lock'; +import { Version, VersionType } from 'src/domain/domain.constant'; import { DatabaseExtension, DatabaseLock, @@ -5,18 +9,13 @@ import { VectorExtension, VectorIndex, VectorUpdateResult, - Version, - VersionType, extName, -} from '@app/domain'; -import { vectorExt } from '@app/infra/database.config'; -import { Injectable } from '@nestjs/common'; -import { InjectDataSource } from '@nestjs/typeorm'; -import AsyncLock from 'async-lock'; +} from 'src/domain/repositories/database.repository'; +import { vectorExt } from 'src/infra/database.config'; +import { isValidInteger } from 'src/infra/infra.utils'; +import { Instrumentation } from 'src/infra/instrumentation'; +import { ImmichLogger } from 'src/infra/logger'; import { DataSource, EntityManager, QueryRunner } from 'typeorm'; -import { isValidInteger } from '../infra.utils'; -import { Instrumentation } from '../instrumentation'; -import { ImmichLogger } from '../logger'; @Instrumentation() @Injectable() diff --git a/server/src/infra/repositories/filesystem.provider.spec.ts b/server/src/infra/repositories/filesystem.provider.spec.ts index 4c20b2a506..9b12187ed2 100644 --- a/server/src/infra/repositories/filesystem.provider.spec.ts +++ b/server/src/infra/repositories/filesystem.provider.spec.ts @@ -1,6 +1,6 @@ -import { CrawlOptionsDto } from '@app/domain'; import mockfs from 'mock-fs'; -import { FilesystemProvider } from './filesystem.provider'; +import { CrawlOptionsDto } from 'src/domain/library/library.dto'; +import { FilesystemProvider } from 'src/infra/repositories/filesystem.provider'; interface Test { test: string; diff --git a/server/src/infra/repositories/filesystem.provider.ts b/server/src/infra/repositories/filesystem.provider.ts index c4f577ed25..c88b0c83a8 100644 --- a/server/src/infra/repositories/filesystem.provider.ts +++ b/server/src/infra/repositories/filesystem.provider.ts @@ -1,21 +1,21 @@ -import { - CrawlOptionsDto, - DiskUsage, - IStorageRepository, - ImmichReadStream, - ImmichZipStream, - StorageEventType, - WatchEvents, - mimeTypes, -} from '@app/domain'; -import { ImmichLogger } from '@app/infra/logger'; import archiver from 'archiver'; import chokidar, { WatchOptions } from 'chokidar'; import { glob, globStream } from 'fast-glob'; import { constants, createReadStream, existsSync, mkdirSync } from 'node:fs'; import fs from 'node:fs/promises'; import path from 'node:path'; -import { Instrumentation } from '../instrumentation'; +import { mimeTypes } from 'src/domain/domain.constant'; +import { CrawlOptionsDto } from 'src/domain/library/library.dto'; +import { + DiskUsage, + IStorageRepository, + ImmichReadStream, + ImmichZipStream, + StorageEventType, + WatchEvents, +} from 'src/domain/repositories/storage.repository'; +import { Instrumentation } from 'src/infra/instrumentation'; +import { ImmichLogger } from 'src/infra/logger'; @Instrumentation() export class FilesystemProvider implements IStorageRepository { diff --git a/server/src/infra/repositories/index.ts b/server/src/infra/repositories/index.ts deleted file mode 100644 index d684f6b004..0000000000 --- a/server/src/infra/repositories/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -export * from './access.repository'; -export * from './activity.repository'; -export * from './album.repository'; -export * from './api-key.repository'; -export * from './asset-stack.repository'; -export * from './asset.repository'; -export * from './audit.repository'; -export * from './communication.repository'; -export * from './crypto.repository'; -export * from './database.repository'; -export * from './filesystem.provider'; -export * from './job.repository'; -export * from './library.repository'; -export * from './machine-learning.repository'; -export * from './media.repository'; -export * from './metadata.repository'; -export * from './move.repository'; -export * from './partner.repository'; -export * from './person.repository'; -export * from './search.repository'; -export * from './server-info.repository'; -export * from './shared-link.repository'; -export * from './system-config.repository'; -export * from './system-metadata.repository'; -export * from './tag.repository'; -export * from './user-token.repository'; -export * from './user.repository'; diff --git a/server/src/infra/repositories/job.repository.ts b/server/src/infra/repositories/job.repository.ts index 227967a076..eac535e361 100644 --- a/server/src/infra/repositories/job.repository.ts +++ b/server/src/infra/repositories/job.repository.ts @@ -1,14 +1,3 @@ -import { - IJobRepository, - JobCounts, - JobItem, - JobName, - JOBS_TO_QUEUE, - QueueCleanType, - QueueName, - QueueStatus, -} from '@app/domain'; -import { ImmichLogger } from '@app/infra/logger'; import { getQueueToken } from '@nestjs/bullmq'; import { Injectable } from '@nestjs/common'; import { ModuleRef } from '@nestjs/core'; @@ -16,8 +5,17 @@ import { SchedulerRegistry } from '@nestjs/schedule'; import { Job, JobsOptions, Processor, Queue, Worker, WorkerOptions } from 'bullmq'; import { CronJob, CronTime } from 'cron'; import { setTimeout } from 'node:timers/promises'; -import { bullConfig } from '../infra.config'; -import { Instrumentation } from '../instrumentation'; +import { JOBS_TO_QUEUE, JobName, QueueName } from 'src/domain/job/job.constants'; +import { + IJobRepository, + JobCounts, + JobItem, + QueueCleanType, + QueueStatus, +} from 'src/domain/repositories/job.repository'; +import { bullConfig } from 'src/infra/infra.config'; +import { Instrumentation } from 'src/infra/instrumentation'; +import { ImmichLogger } from 'src/infra/logger'; @Instrumentation() @Injectable() diff --git a/server/src/infra/repositories/library.repository.ts b/server/src/infra/repositories/library.repository.ts index 5ae3de96fe..f61d4beb6e 100644 --- a/server/src/infra/repositories/library.repository.ts +++ b/server/src/infra/repositories/library.repository.ts @@ -1,11 +1,12 @@ -import { ILibraryRepository, LibraryStatsResponseDto } from '@app/domain'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; +import { LibraryStatsResponseDto } from 'src/domain/library/library.dto'; +import { ILibraryRepository } from 'src/domain/repositories/library.repository'; +import { LibraryEntity, LibraryType } from 'src/infra/entities/library.entity'; +import { DummyValue, GenerateSql } from 'src/infra/infra.util'; +import { Instrumentation } from 'src/infra/instrumentation'; import { IsNull, Not } from 'typeorm'; import { Repository } from 'typeorm/repository/Repository.js'; -import { LibraryEntity, LibraryType } from '../entities'; -import { DummyValue, GenerateSql } from '../infra.util'; -import { Instrumentation } from '../instrumentation'; @Instrumentation() @Injectable() diff --git a/server/src/infra/repositories/machine-learning.repository.ts b/server/src/infra/repositories/machine-learning.repository.ts index 767ca812bc..edf0679051 100644 --- a/server/src/infra/repositories/machine-learning.repository.ts +++ b/server/src/infra/repositories/machine-learning.repository.ts @@ -1,17 +1,15 @@ +import { Injectable } from '@nestjs/common'; +import { readFile } from 'node:fs/promises'; import { - CLIPConfig, CLIPMode, DetectFaceResult, IMachineLearningRepository, - ModelConfig, ModelType, - RecognitionConfig, TextModelInput, VisionModelInput, -} from '@app/domain'; -import { Injectable } from '@nestjs/common'; -import { readFile } from 'node:fs/promises'; -import { Instrumentation } from '../instrumentation'; +} from 'src/domain/repositories/machine-learning.repository'; +import { CLIPConfig, ModelConfig, RecognitionConfig } from 'src/domain/smart-info/dto/model-config.dto'; +import { Instrumentation } from 'src/infra/instrumentation'; const errorPrefix = 'Machine learning request'; diff --git a/server/src/infra/repositories/media.repository.ts b/server/src/infra/repositories/media.repository.ts index 39cec03afe..0088e312f2 100644 --- a/server/src/infra/repositories/media.repository.ts +++ b/server/src/infra/repositories/media.repository.ts @@ -1,19 +1,19 @@ +import ffmpeg, { FfprobeData } from 'fluent-ffmpeg'; +import fs from 'node:fs/promises'; +import { Writable } from 'node:stream'; +import { promisify } from 'node:util'; +import sharp from 'sharp'; +import { handlePromiseError } from 'src/domain/domain.util'; import { CropOptions, IMediaRepository, ResizeOptions, TranscodeOptions, VideoInfo, - handlePromiseError, -} from '@app/domain'; -import { Colorspace } from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; -import ffmpeg, { FfprobeData } from 'fluent-ffmpeg'; -import fs from 'node:fs/promises'; -import { Writable } from 'node:stream'; -import { promisify } from 'node:util'; -import sharp from 'sharp'; -import { Instrumentation } from '../instrumentation'; +} from 'src/domain/repositories/media.repository'; +import { Colorspace } from 'src/infra/entities/system-config.entity'; +import { Instrumentation } from 'src/infra/instrumentation'; +import { ImmichLogger } from 'src/infra/logger'; const probe = promisify(ffmpeg.ffprobe); sharp.concurrency(0); diff --git a/server/src/infra/repositories/metadata.repository.ts b/server/src/infra/repositories/metadata.repository.ts index bf9bb8a467..e81ba8dcbe 100644 --- a/server/src/infra/repositories/metadata.repository.ts +++ b/server/src/infra/repositories/metadata.repository.ts @@ -1,29 +1,33 @@ +import { Inject } from '@nestjs/common'; +import { InjectDataSource, InjectRepository } from '@nestjs/typeorm'; +import { DefaultReadTaskOptions, Tags, exiftool } from 'exiftool-vendored'; +import geotz from 'geo-tz'; +import { getName } from 'i18n-iso-countries'; +import { createReadStream, existsSync } from 'node:fs'; +import { readFile } from 'node:fs/promises'; +import readLine from 'node:readline'; import { citiesFile, geodataAdmin1Path, geodataAdmin2Path, geodataCities500Path, geodataDatePath, +} from 'src/domain/domain.constant'; +import { GeoPoint, IMetadataRepository, ImmichTags, - ISystemMetadataRepository, ReverseGeocodeResult, -} from '@app/domain'; -import { ExifEntity, GeodataPlacesEntity, SystemMetadataKey } from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; -import { Inject } from '@nestjs/common'; -import { InjectDataSource, InjectRepository } from '@nestjs/typeorm'; -import { DefaultReadTaskOptions, exiftool, Tags } from 'exiftool-vendored'; -import * as geotz from 'geo-tz'; -import { getName } from 'i18n-iso-countries'; -import { createReadStream, existsSync } from 'node:fs'; -import { readFile } from 'node:fs/promises'; -import * as readLine from 'node:readline'; +} from 'src/domain/repositories/metadata.repository'; +import { ISystemMetadataRepository } from 'src/domain/repositories/system-metadata.repository'; +import { ExifEntity } from 'src/infra/entities/exif.entity'; +import { GeodataPlacesEntity } from 'src/infra/entities/geodata-places.entity'; +import { SystemMetadataKey } from 'src/infra/entities/system-metadata.entity'; +import { DummyValue, GenerateSql } from 'src/infra/infra.util'; +import { Instrumentation } from 'src/infra/instrumentation'; +import { ImmichLogger } from 'src/infra/logger'; import { DataSource, QueryRunner, Repository } from 'typeorm'; import { QueryDeepPartialEntity } from 'typeorm/query-builder/QueryPartialEntity.js'; -import { DummyValue, GenerateSql } from '../infra.util'; -import { Instrumentation } from '../instrumentation'; @Instrumentation() export class MetadataRepository implements IMetadataRepository { diff --git a/server/src/infra/repositories/move.repository.ts b/server/src/infra/repositories/move.repository.ts index 205c67ad6e..04807db248 100644 --- a/server/src/infra/repositories/move.repository.ts +++ b/server/src/infra/repositories/move.repository.ts @@ -1,10 +1,10 @@ -import { IMoveRepository, MoveCreate } from '@app/domain'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; +import { IMoveRepository, MoveCreate } from 'src/domain/repositories/move.repository'; +import { MoveEntity, PathType } from 'src/infra/entities/move.entity'; +import { DummyValue, GenerateSql } from 'src/infra/infra.util'; +import { Instrumentation } from 'src/infra/instrumentation'; import { Repository } from 'typeorm'; -import { MoveEntity, PathType } from '../entities'; -import { DummyValue, GenerateSql } from '../infra.util'; -import { Instrumentation } from '../instrumentation'; @Instrumentation() @Injectable() diff --git a/server/src/infra/repositories/partner.repository.ts b/server/src/infra/repositories/partner.repository.ts index eb07902dc5..cd39a8f9d5 100644 --- a/server/src/infra/repositories/partner.repository.ts +++ b/server/src/infra/repositories/partner.repository.ts @@ -1,9 +1,9 @@ -import { IPartnerRepository, PartnerIds } from '@app/domain'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; +import { IPartnerRepository, PartnerIds } from 'src/domain/repositories/partner.repository'; +import { PartnerEntity } from 'src/infra/entities/partner.entity'; +import { Instrumentation } from 'src/infra/instrumentation'; import { DeepPartial, Repository } from 'typeorm'; -import { PartnerEntity } from '../entities'; -import { Instrumentation } from '../instrumentation'; @Instrumentation() @Injectable() diff --git a/server/src/infra/repositories/person.repository.ts b/server/src/infra/repositories/person.repository.ts index 562a56fb6d..df76ad9d0d 100644 --- a/server/src/infra/repositories/person.repository.ts +++ b/server/src/infra/repositories/person.repository.ts @@ -1,21 +1,22 @@ +import { InjectRepository } from '@nestjs/typeorm'; +import _ from 'lodash'; +import { Paginated, PaginationOptions } from 'src/domain/domain.util'; import { AssetFaceId, IPersonRepository, - Paginated, - PaginationOptions, PeopleStatistics, PersonNameSearchOptions, PersonSearchOptions, PersonStatistics, UpdateFacesData, -} from '@app/domain'; -import { InjectRepository } from '@nestjs/typeorm'; -import _ from 'lodash'; +} from 'src/domain/repositories/person.repository'; +import { AssetFaceEntity } from 'src/infra/entities/asset-face.entity'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { PersonEntity } from 'src/infra/entities/person.entity'; +import { DummyValue, GenerateSql } from 'src/infra/infra.util'; +import { ChunkedArray, asVector, paginate } from 'src/infra/infra.utils'; +import { Instrumentation } from 'src/infra/instrumentation'; import { FindManyOptions, FindOptionsRelations, FindOptionsSelect, In, Repository } from 'typeorm'; -import { AssetEntity, AssetFaceEntity, PersonEntity } from '../entities'; -import { DummyValue, GenerateSql } from '../infra.util'; -import { ChunkedArray, asVector, paginate } from '../infra.utils'; -import { Instrumentation } from '../instrumentation'; @Instrumentation() export class PersonRepository implements IPersonRepository { diff --git a/server/src/infra/repositories/search.repository.ts b/server/src/infra/repositories/search.repository.ts index 0e29506d1f..5676bd8b53 100644 --- a/server/src/infra/repositories/search.repository.ts +++ b/server/src/infra/repositories/search.repository.ts @@ -1,33 +1,28 @@ +import { Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { Paginated, PaginationMode, PaginationResult } from 'src/domain/domain.util'; +import { DatabaseExtension } from 'src/domain/repositories/database.repository'; import { AssetSearchOptions, - DatabaseExtension, Embedding, FaceEmbeddingSearch, FaceSearchResult, ISearchRepository, - Paginated, - PaginationMode, - PaginationResult, SearchPaginationOptions, SmartSearchOptions, -} from '@app/domain'; -import { getCLIPModelInfo } from '@app/domain/smart-info/smart-info.constant'; -import { - AssetEntity, - AssetFaceEntity, - AssetType, - GeodataPlacesEntity, - SmartInfoEntity, - SmartSearchEntity, -} from '@app/infra/entities'; -import { ImmichLogger } from '@app/infra/logger'; -import { Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; +} from 'src/domain/repositories/search.repository'; +import { getCLIPModelInfo } from 'src/domain/smart-info/smart-info.constant'; +import { vectorExt } from 'src/infra/database.config'; +import { AssetFaceEntity } from 'src/infra/entities/asset-face.entity'; +import { AssetEntity, AssetType } from 'src/infra/entities/asset.entity'; +import { GeodataPlacesEntity } from 'src/infra/entities/geodata-places.entity'; +import { SmartInfoEntity } from 'src/infra/entities/smart-info.entity'; +import { SmartSearchEntity } from 'src/infra/entities/smart-search.entity'; +import { DummyValue, GenerateSql } from 'src/infra/infra.util'; +import { asVector, isValidInteger, paginatedBuilder, searchAssetBuilder } from 'src/infra/infra.utils'; +import { Instrumentation } from 'src/infra/instrumentation'; +import { ImmichLogger } from 'src/infra/logger'; import { Repository, SelectQueryBuilder } from 'typeorm'; -import { vectorExt } from '../database.config'; -import { DummyValue, GenerateSql } from '../infra.util'; -import { asVector, isValidInteger, paginatedBuilder, searchAssetBuilder } from '../infra.utils'; -import { Instrumentation } from '../instrumentation'; @Instrumentation() @Injectable() @@ -335,7 +330,7 @@ WITH RECURSIVE cte AS ( ) UNION ALL - + SELECT l.city, l."assetId" FROM cte c , LATERAL ( diff --git a/server/src/infra/repositories/server-info.repository.ts b/server/src/infra/repositories/server-info.repository.ts index bd56a58dd9..50ee3bc8dd 100644 --- a/server/src/infra/repositories/server-info.repository.ts +++ b/server/src/infra/repositories/server-info.repository.ts @@ -1,6 +1,6 @@ -import { GitHubRelease, IServerInfoRepository } from '@app/domain'; import { Injectable } from '@nestjs/common'; -import { Instrumentation } from '../instrumentation'; +import { GitHubRelease, IServerInfoRepository } from 'src/domain/repositories/server-info.repository'; +import { Instrumentation } from 'src/infra/instrumentation'; @Instrumentation() @Injectable() diff --git a/server/src/infra/repositories/shared-link.repository.ts b/server/src/infra/repositories/shared-link.repository.ts index 5e796a7721..1b1ed7fe2a 100644 --- a/server/src/infra/repositories/shared-link.repository.ts +++ b/server/src/infra/repositories/shared-link.repository.ts @@ -1,10 +1,10 @@ -import { ISharedLinkRepository } from '@app/domain'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; +import { ISharedLinkRepository } from 'src/domain/repositories/shared-link.repository'; +import { SharedLinkEntity } from 'src/infra/entities/shared-link.entity'; +import { DummyValue, GenerateSql } from 'src/infra/infra.util'; +import { Instrumentation } from 'src/infra/instrumentation'; import { Repository } from 'typeorm'; -import { SharedLinkEntity } from '../entities'; -import { DummyValue, GenerateSql } from '../infra.util'; -import { Instrumentation } from '../instrumentation'; @Instrumentation() @Injectable() diff --git a/server/src/infra/repositories/system-config.repository.ts b/server/src/infra/repositories/system-config.repository.ts index 598333d9fd..f354c87e67 100644 --- a/server/src/infra/repositories/system-config.repository.ts +++ b/server/src/infra/repositories/system-config.repository.ts @@ -1,11 +1,11 @@ -import { ISystemConfigRepository } from '@app/domain'; import { InjectRepository } from '@nestjs/typeorm'; import { readFile } from 'node:fs/promises'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { SystemConfigEntity } from 'src/infra/entities/system-config.entity'; +import { DummyValue, GenerateSql } from 'src/infra/infra.util'; +import { Chunked } from 'src/infra/infra.utils'; +import { Instrumentation } from 'src/infra/instrumentation'; import { In, Repository } from 'typeorm'; -import { SystemConfigEntity } from '../entities'; -import { DummyValue, GenerateSql } from '../infra.util'; -import { Chunked } from '../infra.utils'; -import { Instrumentation } from '../instrumentation'; @Instrumentation() export class SystemConfigRepository implements ISystemConfigRepository { diff --git a/server/src/infra/repositories/system-metadata.repository.ts b/server/src/infra/repositories/system-metadata.repository.ts index 5b99cd1dda..b0ace1b917 100644 --- a/server/src/infra/repositories/system-metadata.repository.ts +++ b/server/src/infra/repositories/system-metadata.repository.ts @@ -1,8 +1,8 @@ -import { ISystemMetadataRepository } from '@app/domain/repositories/system-metadata.repository'; import { InjectRepository } from '@nestjs/typeorm'; +import { ISystemMetadataRepository } from 'src/domain/repositories/system-metadata.repository'; +import { SystemMetadata, SystemMetadataEntity } from 'src/infra/entities/system-metadata.entity'; +import { Instrumentation } from 'src/infra/instrumentation'; import { Repository } from 'typeorm'; -import { SystemMetadata, SystemMetadataEntity } from '../entities'; -import { Instrumentation } from '../instrumentation'; @Instrumentation() export class SystemMetadataRepository implements ISystemMetadataRepository { diff --git a/server/src/infra/repositories/tag.repository.ts b/server/src/infra/repositories/tag.repository.ts index 3ac5afd0e9..3de70aa104 100644 --- a/server/src/infra/repositories/tag.repository.ts +++ b/server/src/infra/repositories/tag.repository.ts @@ -1,9 +1,10 @@ -import { ITagRepository } from '@app/domain'; -import { AssetEntity, TagEntity } from '@app/infra/entities'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; +import { ITagRepository } from 'src/domain/repositories/tag.repository'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { TagEntity } from 'src/infra/entities/tag.entity'; +import { Instrumentation } from 'src/infra/instrumentation'; import { Repository } from 'typeorm'; -import { Instrumentation } from '../instrumentation'; @Instrumentation() @Injectable() diff --git a/server/src/infra/repositories/user-token.repository.ts b/server/src/infra/repositories/user-token.repository.ts index 60eccb2e59..f2b79a05f2 100644 --- a/server/src/infra/repositories/user-token.repository.ts +++ b/server/src/infra/repositories/user-token.repository.ts @@ -1,10 +1,10 @@ -import { IUserTokenRepository } from '@app/domain'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; +import { IUserTokenRepository } from 'src/domain/repositories/user-token.repository'; +import { UserTokenEntity } from 'src/infra/entities/user-token.entity'; +import { DummyValue, GenerateSql } from 'src/infra/infra.util'; +import { Instrumentation } from 'src/infra/instrumentation'; import { Repository } from 'typeorm'; -import { UserTokenEntity } from '../entities'; -import { DummyValue, GenerateSql } from '../infra.util'; -import { Instrumentation } from '../instrumentation'; @Instrumentation() @Injectable() diff --git a/server/src/infra/repositories/user.repository.ts b/server/src/infra/repositories/user.repository.ts index 865a9c8cb4..e71d629360 100644 --- a/server/src/infra/repositories/user.repository.ts +++ b/server/src/infra/repositories/user.repository.ts @@ -1,10 +1,16 @@ -import { IUserRepository, UserFindOptions, UserListFilter, UserStatsQueryResponse } from '@app/domain'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; +import { + IUserRepository, + UserFindOptions, + UserListFilter, + UserStatsQueryResponse, +} from 'src/domain/repositories/user.repository'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { UserEntity } from 'src/infra/entities/user.entity'; +import { DummyValue, GenerateSql } from 'src/infra/infra.util'; +import { Instrumentation } from 'src/infra/instrumentation'; import { IsNull, Not, Repository } from 'typeorm'; -import { AssetEntity, UserEntity } from '../entities'; -import { DummyValue, GenerateSql } from '../infra.util'; -import { Instrumentation } from '../instrumentation'; @Instrumentation() @Injectable() diff --git a/server/src/infra/sql-generator/index.ts b/server/src/infra/sql-generator/index.ts index 0b10c018c1..c365587a96 100644 --- a/server/src/infra/sql-generator/index.ts +++ b/server/src/infra/sql-generator/index.ts @@ -1,33 +1,31 @@ #!/usr/bin/env node -import { ISystemConfigRepository } from '@app/domain'; import { INestApplication } from '@nestjs/common'; import { Reflector } from '@nestjs/core'; import { Test } from '@nestjs/testing'; import { TypeOrmModule } from '@nestjs/typeorm'; import { mkdir, rm, writeFile } from 'node:fs/promises'; import { join } from 'node:path'; -import { databaseConfig } from '../database.config'; -import { databaseEntities } from '../entities'; -import { GENERATE_SQL_KEY, GenerateSqlQueries } from '../infra.util'; -import { - AccessRepository, - AlbumRepository, - ApiKeyRepository, - AssetRepository, - AuditRepository, - LibraryRepository, - MoveRepository, - PartnerRepository, - PersonRepository, - SearchRepository, - SharedLinkRepository, - SystemConfigRepository, - SystemMetadataRepository, - TagRepository, - UserRepository, - UserTokenRepository, -} from '../repositories'; -import { SqlLogger } from './sql.logger'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { databaseConfig } from 'src/infra/database.config'; +import { databaseEntities } from 'src/infra/entities'; +import { GENERATE_SQL_KEY, GenerateSqlQueries } from 'src/infra/infra.util'; +import { AccessRepository } from 'src/infra/repositories/access.repository'; +import { AlbumRepository } from 'src/infra/repositories/album.repository'; +import { ApiKeyRepository } from 'src/infra/repositories/api-key.repository'; +import { AssetRepository } from 'src/infra/repositories/asset.repository'; +import { AuditRepository } from 'src/infra/repositories/audit.repository'; +import { LibraryRepository } from 'src/infra/repositories/library.repository'; +import { MoveRepository } from 'src/infra/repositories/move.repository'; +import { PartnerRepository } from 'src/infra/repositories/partner.repository'; +import { PersonRepository } from 'src/infra/repositories/person.repository'; +import { SearchRepository } from 'src/infra/repositories/search.repository'; +import { SharedLinkRepository } from 'src/infra/repositories/shared-link.repository'; +import { SystemConfigRepository } from 'src/infra/repositories/system-config.repository'; +import { SystemMetadataRepository } from 'src/infra/repositories/system-metadata.repository'; +import { TagRepository } from 'src/infra/repositories/tag.repository'; +import { UserTokenRepository } from 'src/infra/repositories/user-token.repository'; +import { UserRepository } from 'src/infra/repositories/user.repository'; +import { SqlLogger } from 'src/infra/sql-generator/sql.logger'; const reflector = new Reflector(); const repositories = [ diff --git a/server/src/infra/subscribers/audit.subscriber.ts b/server/src/infra/subscribers/audit.subscriber.ts index 896f9ae5e0..ddfc5d0d74 100644 --- a/server/src/infra/subscribers/audit.subscriber.ts +++ b/server/src/infra/subscribers/audit.subscriber.ts @@ -1,5 +1,7 @@ +import { AlbumEntity } from 'src/infra/entities/album.entity'; +import { AssetEntity } from 'src/infra/entities/asset.entity'; +import { AuditEntity, DatabaseAction, EntityType } from 'src/infra/entities/audit.entity'; import { EntitySubscriberInterface, EventSubscriber, RemoveEvent } from 'typeorm'; -import { AlbumEntity, AssetEntity, AuditEntity, DatabaseAction, EntityType } from '../entities'; @EventSubscriber() export class AuditSubscriber implements EntitySubscriberInterface { diff --git a/server/src/main.ts b/server/src/main.ts index 198b0f0877..d598751336 100644 --- a/server/src/main.ts +++ b/server/src/main.ts @@ -1,6 +1,6 @@ -import { bootstrap as admin } from './immich-admin/main'; -import { bootstrap as server } from './immich/main'; -import { bootstrap as microservices } from './microservices/main'; +import { bootstrap as admin } from 'src/immich-admin/main'; +import { bootstrap as server } from 'src/immich/main'; +import { bootstrap as microservices } from 'src/microservices/main'; const immichApp = process.argv[2] || process.env.IMMICH_APP; diff --git a/server/src/microservices/app.service.ts b/server/src/microservices/app.service.ts index 9fabd5855a..043ee9f03c 100644 --- a/server/src/microservices/app.service.ts +++ b/server/src/microservices/app.service.ts @@ -1,22 +1,20 @@ -import { - AssetService, - AuditService, - DatabaseService, - IDeleteFilesJob, - JobName, - JobService, - LibraryService, - MediaService, - MetadataService, - PersonService, - SmartInfoService, - StorageService, - StorageTemplateService, - SystemConfigService, - UserService, -} from '@app/domain'; -import { otelSDK } from '@app/infra/instrumentation'; import { Injectable } from '@nestjs/common'; +import { AssetService } from 'src/domain/asset/asset.service'; +import { AuditService } from 'src/domain/audit/audit.service'; +import { DatabaseService } from 'src/domain/database/database.service'; +import { JobName } from 'src/domain/job/job.constants'; +import { IDeleteFilesJob } from 'src/domain/job/job.interface'; +import { JobService } from 'src/domain/job/job.service'; +import { LibraryService } from 'src/domain/library/library.service'; +import { MediaService } from 'src/domain/media/media.service'; +import { MetadataService } from 'src/domain/metadata/metadata.service'; +import { PersonService } from 'src/domain/person/person.service'; +import { SmartInfoService } from 'src/domain/smart-info/smart-info.service'; +import { StorageTemplateService } from 'src/domain/storage-template/storage-template.service'; +import { StorageService } from 'src/domain/storage/storage.service'; +import { SystemConfigService } from 'src/domain/system-config/system-config.service'; +import { UserService } from 'src/domain/user/user.service'; +import { otelSDK } from 'src/infra/instrumentation'; @Injectable() export class AppService { diff --git a/server/src/microservices/main.ts b/server/src/microservices/main.ts index f7dc64f572..01949dd029 100644 --- a/server/src/microservices/main.ts +++ b/server/src/microservices/main.ts @@ -1,9 +1,9 @@ -import { envName, serverVersion } from '@app/domain'; -import { WebSocketAdapter } from '@app/infra'; -import { otelSDK } from '@app/infra/instrumentation'; -import { ImmichLogger } from '@app/infra/logger'; import { NestFactory } from '@nestjs/core'; -import { MicroservicesModule } from './microservices.module'; +import { envName, serverVersion } from 'src/domain/domain.constant'; +import { otelSDK } from 'src/infra/instrumentation'; +import { ImmichLogger } from 'src/infra/logger'; +import { WebSocketAdapter } from 'src/infra/websocket.adapter'; +import { MicroservicesModule } from 'src/microservices/microservices.module'; const logger = new ImmichLogger('ImmichMicroservice'); const port = Number(process.env.MICROSERVICES_PORT) || 3002; diff --git a/server/src/microservices/microservices.module.ts b/server/src/microservices/microservices.module.ts index 4768d965f2..6fc9f0890c 100644 --- a/server/src/microservices/microservices.module.ts +++ b/server/src/microservices/microservices.module.ts @@ -1,7 +1,7 @@ -import { DomainModule } from '@app/domain'; -import { InfraModule } from '@app/infra'; import { Module, OnModuleInit } from '@nestjs/common'; -import { AppService } from './app.service'; +import { DomainModule } from 'src/domain/domain.module'; +import { InfraModule } from 'src/infra/infra.module'; +import { AppService } from 'src/microservices/app.service'; @Module({ imports: [InfraModule, DomainModule], diff --git a/server/src/microservices/utils/exif/coordinates.spec.ts b/server/src/microservices/utils/exif/coordinates.spec.ts index b9644fb49a..083ea31bc4 100644 --- a/server/src/microservices/utils/exif/coordinates.spec.ts +++ b/server/src/microservices/utils/exif/coordinates.spec.ts @@ -1,4 +1,4 @@ -import { parseLatitude, parseLongitude } from './coordinates'; +import { parseLatitude, parseLongitude } from 'src/microservices/utils/exif/coordinates'; describe('parsing latitude from string input', () => { it('returns null for invalid inputs', () => { diff --git a/server/src/microservices/utils/exif/coordinates.ts b/server/src/microservices/utils/exif/coordinates.ts index 03aeb17f09..7e0d816794 100644 --- a/server/src/microservices/utils/exif/coordinates.ts +++ b/server/src/microservices/utils/exif/coordinates.ts @@ -1,4 +1,4 @@ -import { isNumberInRange } from '../numbers'; +import { isNumberInRange } from 'src/microservices/utils/numbers'; export function parseLatitude(input: string | number | null): number | null { if (input === null) { diff --git a/server/src/microservices/utils/numbers.spec.ts b/server/src/microservices/utils/numbers.spec.ts index 47f95b8aab..633b8b1d45 100644 --- a/server/src/microservices/utils/numbers.spec.ts +++ b/server/src/microservices/utils/numbers.spec.ts @@ -1,4 +1,4 @@ -import { isDecimalNumber, isNumberInRange, toNumberOrNull } from './numbers'; +import { isDecimalNumber, isNumberInRange, toNumberOrNull } from 'src/microservices/utils/numbers'; describe('checks if a number is a decimal number', () => { it('returns false for non-decimal numbers', () => { diff --git a/server/src/test-utils/utils.ts b/server/src/test-utils/utils.ts index cf98222954..5b4f17baf1 100644 --- a/server/src/test-utils/utils.ts +++ b/server/src/test-utils/utils.ts @@ -1,18 +1,22 @@ -import { IJobRepository, IMediaRepository, JobItem, JobItemHandler, QueueName, StorageEventType } from '@app/domain'; -import { AppModule } from '@app/immich'; -import { InfraModule, InfraTestModule, dataSource } from '@app/infra'; -import { MediaRepository } from '@app/infra/repositories'; import { INestApplication } from '@nestjs/common'; import { Test } from '@nestjs/testing'; import { DateTime } from 'luxon'; -import * as fs from 'node:fs'; +import fs from 'node:fs'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; import { EventEmitter } from 'node:stream'; import { Server } from 'node:tls'; +import { QueueName } from 'src/domain/job/job.constants'; +import { IJobRepository, JobItem, JobItemHandler } from 'src/domain/repositories/job.repository'; +import { IMediaRepository } from 'src/domain/repositories/media.repository'; +import { StorageEventType } from 'src/domain/repositories/storage.repository'; +import { AppModule } from 'src/immich/app.module'; +import { AppService } from 'src/immich/app.service'; +import { dataSource } from 'src/infra/database.config'; +import { InfraModule, InfraTestModule } from 'src/infra/infra.module'; +import { MediaRepository } from 'src/infra/repositories/media.repository'; +import { AppService as MicroAppService } from 'src/microservices/app.service'; import { EntityTarget, ObjectLiteral } from 'typeorm'; -import { AppService } from '../immich/app.service'; -import { AppService as MicroAppService } from '../microservices/app.service'; export const IMMICH_TEST_ASSET_PATH = process.env.IMMICH_TEST_ASSET_PATH as string; export const IMMICH_TEST_ASSET_TEMP_PATH = join(tmpdir(), 'immich'); diff --git a/server/test/fixtures/activity.stub.ts b/server/test/fixtures/activity.stub.ts index 7a3aae5ffb..ae33699a0a 100644 --- a/server/test/fixtures/activity.stub.ts +++ b/server/test/fixtures/activity.stub.ts @@ -1,8 +1,8 @@ -import { ActivityEntity } from '@app/infra/entities'; -import { albumStub } from './album.stub'; -import { assetStub } from './asset.stub'; -import { authStub } from './auth.stub'; -import { userStub } from './user.stub'; +import { ActivityEntity } from 'src/infra/entities/activity.entity'; +import { albumStub } from 'test/fixtures/album.stub'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { authStub } from 'test/fixtures/auth.stub'; +import { userStub } from 'test/fixtures/user.stub'; export const activityStub = { oneComment: Object.freeze({ diff --git a/server/test/fixtures/album.stub.ts b/server/test/fixtures/album.stub.ts index bfb6acb6d1..18be7d4ffb 100644 --- a/server/test/fixtures/album.stub.ts +++ b/server/test/fixtures/album.stub.ts @@ -1,7 +1,7 @@ -import { AlbumEntity, AssetOrder } from '@app/infra/entities'; -import { assetStub } from './asset.stub'; -import { authStub } from './auth.stub'; -import { userStub } from './user.stub'; +import { AlbumEntity, AssetOrder } from 'src/infra/entities/album.entity'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { authStub } from 'test/fixtures/auth.stub'; +import { userStub } from 'test/fixtures/user.stub'; export const albumStub = { empty: Object.freeze({ diff --git a/server/test/fixtures/api-key.stub.ts b/server/test/fixtures/api-key.stub.ts index de1b8dc176..bc6f85c65c 100644 --- a/server/test/fixtures/api-key.stub.ts +++ b/server/test/fixtures/api-key.stub.ts @@ -1,6 +1,6 @@ -import { APIKeyEntity } from '@app/infra/entities'; -import { authStub } from './auth.stub'; -import { userStub } from './user.stub'; +import { APIKeyEntity } from 'src/infra/entities/api-key.entity'; +import { authStub } from 'test/fixtures/auth.stub'; +import { userStub } from 'test/fixtures/user.stub'; export const keyStub = { admin: Object.freeze({ diff --git a/server/test/fixtures/asset.stub.ts b/server/test/fixtures/asset.stub.ts index d72a295d42..d2daeaaff8 100644 --- a/server/test/fixtures/asset.stub.ts +++ b/server/test/fixtures/asset.stub.ts @@ -1,8 +1,10 @@ -import { AssetEntity, AssetStackEntity, AssetType, ExifEntity } from '@app/infra/entities'; -import { authStub } from './auth.stub'; -import { fileStub } from './file.stub'; -import { libraryStub } from './library.stub'; -import { userStub } from './user.stub'; +import { AssetStackEntity } from 'src/infra/entities/asset-stack.entity'; +import { AssetEntity, AssetType } from 'src/infra/entities/asset.entity'; +import { ExifEntity } from 'src/infra/entities/exif.entity'; +import { authStub } from 'test/fixtures/auth.stub'; +import { fileStub } from 'test/fixtures/file.stub'; +import { libraryStub } from 'test/fixtures/library.stub'; +import { userStub } from 'test/fixtures/user.stub'; export const assetStackStub = (stackId: string, assets: AssetEntity[]): AssetStackEntity => { return { diff --git a/server/test/fixtures/audit.stub.ts b/server/test/fixtures/audit.stub.ts index ab1ca98b9d..2c7ef67822 100644 --- a/server/test/fixtures/audit.stub.ts +++ b/server/test/fixtures/audit.stub.ts @@ -1,5 +1,5 @@ -import { AuditEntity, DatabaseAction, EntityType } from '@app/infra/entities'; -import { authStub } from './auth.stub'; +import { AuditEntity, DatabaseAction, EntityType } from 'src/infra/entities/audit.entity'; +import { authStub } from 'test/fixtures/auth.stub'; export const auditStub = { create: Object.freeze({ diff --git a/server/test/fixtures/auth.stub.ts b/server/test/fixtures/auth.stub.ts index 79993a4da2..f05285fd6b 100644 --- a/server/test/fixtures/auth.stub.ts +++ b/server/test/fixtures/auth.stub.ts @@ -1,5 +1,7 @@ -import { AuthDto } from '@app/domain'; -import { SharedLinkEntity, UserEntity, UserTokenEntity } from '../../src/infra/entities'; +import { AuthDto } from 'src/domain/auth/auth.dto'; +import { SharedLinkEntity } from 'src/infra/entities/shared-link.entity'; +import { UserTokenEntity } from 'src/infra/entities/user-token.entity'; +import { UserEntity } from 'src/infra/entities/user.entity'; export const adminSignupStub = { name: 'Immich Admin', diff --git a/server/test/fixtures/face.stub.ts b/server/test/fixtures/face.stub.ts index 0b988d59a8..58a0179275 100644 --- a/server/test/fixtures/face.stub.ts +++ b/server/test/fixtures/face.stub.ts @@ -1,6 +1,6 @@ -import { AssetFaceEntity } from '@app/infra/entities'; -import { assetStub } from './asset.stub'; -import { personStub } from './person.stub'; +import { AssetFaceEntity } from 'src/infra/entities/asset-face.entity'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { personStub } from 'test/fixtures/person.stub'; type NonNullableProperty = { [P in keyof T]: NonNullable }; diff --git a/server/test/fixtures/index.ts b/server/test/fixtures/index.ts deleted file mode 100644 index 2217c9b1ff..0000000000 --- a/server/test/fixtures/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -export * from './album.stub'; -export * from './api-key.stub'; -export * from './asset.stub'; -export * from './audit.stub'; -export * from './auth.stub'; -export * from './error.stub'; -export * from './face.stub'; -export * from './file.stub'; -export * from './library.stub'; -export * from './media.stub'; -export * from './partner.stub'; -export * from './person.stub'; -export * from './shared-link.stub'; -export * from './system-config.stub'; -export * from './tag.stub'; -export * from './user-token.stub'; -export * from './user.stub'; -export * from './uuid.stub'; diff --git a/server/test/fixtures/library.stub.ts b/server/test/fixtures/library.stub.ts index db7687f283..d112d0fb4d 100644 --- a/server/test/fixtures/library.stub.ts +++ b/server/test/fixtures/library.stub.ts @@ -1,7 +1,8 @@ -import { APP_MEDIA_LOCATION, THUMBNAIL_DIR } from '@app/domain'; -import { LibraryEntity, LibraryType } from '@app/infra/entities'; import { join } from 'node:path'; -import { userStub } from './user.stub'; +import { APP_MEDIA_LOCATION } from 'src/domain/domain.constant'; +import { THUMBNAIL_DIR } from 'src/domain/storage/storage.core'; +import { LibraryEntity, LibraryType } from 'src/infra/entities/library.entity'; +import { userStub } from 'test/fixtures/user.stub'; export const libraryStub = { uploadLibrary1: Object.freeze({ diff --git a/server/test/fixtures/media.stub.ts b/server/test/fixtures/media.stub.ts index ad9a4baf72..b4c74b34da 100644 --- a/server/test/fixtures/media.stub.ts +++ b/server/test/fixtures/media.stub.ts @@ -1,4 +1,4 @@ -import { AudioStreamInfo, VideoFormat, VideoInfo, VideoStreamInfo } from '@app/domain'; +import { AudioStreamInfo, VideoFormat, VideoInfo, VideoStreamInfo } from 'src/domain/repositories/media.repository'; const probeStubDefaultFormat: VideoFormat = { formatName: 'mov,mp4,m4a,3gp,3g2,mj2', diff --git a/server/test/fixtures/partner.stub.ts b/server/test/fixtures/partner.stub.ts index 05c1c67d6e..1277e2e21f 100644 --- a/server/test/fixtures/partner.stub.ts +++ b/server/test/fixtures/partner.stub.ts @@ -1,5 +1,5 @@ -import { PartnerEntity } from '@app/infra/entities'; -import { userStub } from './user.stub'; +import { PartnerEntity } from 'src/infra/entities/partner.entity'; +import { userStub } from 'test/fixtures/user.stub'; export const partnerStub = { adminToUser1: Object.freeze({ diff --git a/server/test/fixtures/person.stub.ts b/server/test/fixtures/person.stub.ts index ad83d68001..a573d72e30 100644 --- a/server/test/fixtures/person.stub.ts +++ b/server/test/fixtures/person.stub.ts @@ -1,5 +1,5 @@ -import { PersonEntity } from '@app/infra/entities'; -import { userStub } from './user.stub'; +import { PersonEntity } from 'src/infra/entities/person.entity'; +import { userStub } from 'test/fixtures/user.stub'; export const personStub = { noName: Object.freeze({ diff --git a/server/test/fixtures/shared-link.stub.ts b/server/test/fixtures/shared-link.stub.ts index 109f051907..d3b3d51519 100644 --- a/server/test/fixtures/shared-link.stub.ts +++ b/server/test/fixtures/shared-link.stub.ts @@ -1,9 +1,16 @@ -import { AlbumResponseDto, AssetResponseDto, ExifResponseDto, mapUser, SharedLinkResponseDto } from '@app/domain'; -import { AssetOrder, AssetType, SharedLinkEntity, SharedLinkType, UserEntity } from '@app/infra/entities'; -import { assetStub } from './asset.stub'; -import { authStub } from './auth.stub'; -import { libraryStub } from './library.stub'; -import { userStub } from './user.stub'; +import { AlbumResponseDto } from 'src/domain/album/album-response.dto'; +import { AssetResponseDto } from 'src/domain/asset/response-dto/asset-response.dto'; +import { ExifResponseDto } from 'src/domain/asset/response-dto/exif-response.dto'; +import { SharedLinkResponseDto } from 'src/domain/shared-link/shared-link-response.dto'; +import { mapUser } from 'src/domain/user/response-dto/user-response.dto'; +import { AssetOrder } from 'src/infra/entities/album.entity'; +import { AssetType } from 'src/infra/entities/asset.entity'; +import { SharedLinkEntity, SharedLinkType } from 'src/infra/entities/shared-link.entity'; +import { UserEntity } from 'src/infra/entities/user.entity'; +import { assetStub } from 'test/fixtures/asset.stub'; +import { authStub } from 'test/fixtures/auth.stub'; +import { libraryStub } from 'test/fixtures/library.stub'; +import { userStub } from 'test/fixtures/user.stub'; const today = new Date(); const tomorrow = new Date(); diff --git a/server/test/fixtures/system-config.stub.ts b/server/test/fixtures/system-config.stub.ts index 9f9f02144c..2de5398481 100644 --- a/server/test/fixtures/system-config.stub.ts +++ b/server/test/fixtures/system-config.stub.ts @@ -1,4 +1,4 @@ -import { SystemConfigEntity, SystemConfigKey } from '@app/infra/entities'; +import { SystemConfigEntity, SystemConfigKey } from 'src/infra/entities/system-config.entity'; export const systemConfigStub: Record = { defaults: [], diff --git a/server/test/fixtures/tag.stub.ts b/server/test/fixtures/tag.stub.ts index cffae00325..a480055281 100644 --- a/server/test/fixtures/tag.stub.ts +++ b/server/test/fixtures/tag.stub.ts @@ -1,6 +1,6 @@ -import { TagResponseDto } from '@app/domain'; -import { TagEntity, TagType } from '@app/infra/entities'; -import { userStub } from './user.stub'; +import { TagResponseDto } from 'src/domain/tag/tag-response.dto'; +import { TagEntity, TagType } from 'src/infra/entities/tag.entity'; +import { userStub } from 'test/fixtures/user.stub'; export const tagStub = { tag1: Object.freeze({ diff --git a/server/test/fixtures/user-token.stub.ts b/server/test/fixtures/user-token.stub.ts index 975318e215..de42d1d322 100644 --- a/server/test/fixtures/user-token.stub.ts +++ b/server/test/fixtures/user-token.stub.ts @@ -1,5 +1,5 @@ -import { UserTokenEntity } from '@app/infra/entities'; -import { userStub } from './user.stub'; +import { UserTokenEntity } from 'src/infra/entities/user-token.entity'; +import { userStub } from 'test/fixtures/user.stub'; export const userTokenStub = { userToken: Object.freeze({ diff --git a/server/test/fixtures/user.stub.ts b/server/test/fixtures/user.stub.ts index e0d9113c65..7809583c7f 100644 --- a/server/test/fixtures/user.stub.ts +++ b/server/test/fixtures/user.stub.ts @@ -1,5 +1,5 @@ -import { UserAvatarColor, UserEntity } from '@app/infra/entities'; -import { authStub } from './auth.stub'; +import { UserAvatarColor, UserEntity } from 'src/infra/entities/user.entity'; +import { authStub } from 'test/fixtures/auth.stub'; export const userDto = { user1: { diff --git a/server/test/index.ts b/server/test/index.ts deleted file mode 100644 index 784eeeb353..0000000000 --- a/server/test/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './fixtures'; -export * from './repositories'; diff --git a/server/test/repositories/access.repository.mock.ts b/server/test/repositories/access.repository.mock.ts index e10dd7d9a7..4491d6e70c 100644 --- a/server/test/repositories/access.repository.mock.ts +++ b/server/test/repositories/access.repository.mock.ts @@ -1,4 +1,5 @@ -import { AccessCore, IAccessRepository } from '@app/domain'; +import { AccessCore } from 'src/domain/access/access.core'; +import { IAccessRepository } from 'src/domain/repositories/access.repository'; export interface IAccessRepositoryMock { activity: jest.Mocked; diff --git a/server/test/repositories/activity.repository.mock.ts b/server/test/repositories/activity.repository.mock.ts index 349fa46361..166690b5f7 100644 --- a/server/test/repositories/activity.repository.mock.ts +++ b/server/test/repositories/activity.repository.mock.ts @@ -1,4 +1,4 @@ -import { IActivityRepository } from '@app/domain'; +import { IActivityRepository } from 'src/domain/repositories/activity.repository'; export const newActivityRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/album.repository.mock.ts b/server/test/repositories/album.repository.mock.ts index 36c3afb297..8259ac4565 100644 --- a/server/test/repositories/album.repository.mock.ts +++ b/server/test/repositories/album.repository.mock.ts @@ -1,4 +1,4 @@ -import { IAlbumRepository } from '@app/domain'; +import { IAlbumRepository } from 'src/domain/repositories/album.repository'; export const newAlbumRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/api-key.repository.mock.ts b/server/test/repositories/api-key.repository.mock.ts index 5688978e75..471b4bb94e 100644 --- a/server/test/repositories/api-key.repository.mock.ts +++ b/server/test/repositories/api-key.repository.mock.ts @@ -1,4 +1,4 @@ -import { IKeyRepository } from '@app/domain'; +import { IKeyRepository } from 'src/domain/repositories/api-key.repository'; export const newKeyRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/asset-stack.repository.mock.ts b/server/test/repositories/asset-stack.repository.mock.ts index d87f0316f0..cb935a17e5 100644 --- a/server/test/repositories/asset-stack.repository.mock.ts +++ b/server/test/repositories/asset-stack.repository.mock.ts @@ -1,4 +1,4 @@ -import { IAssetStackRepository } from '@app/domain'; +import { IAssetStackRepository } from 'src/domain/repositories/asset-stack.repository'; export const newAssetStackRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/asset.repository.mock.ts b/server/test/repositories/asset.repository.mock.ts index b9451f34f5..ab933e7858 100644 --- a/server/test/repositories/asset.repository.mock.ts +++ b/server/test/repositories/asset.repository.mock.ts @@ -1,4 +1,4 @@ -import { IAssetRepository } from '@app/domain'; +import { IAssetRepository } from 'src/domain/repositories/asset.repository'; export const newAssetRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/audit.repository.mock.ts b/server/test/repositories/audit.repository.mock.ts index bd1a4b815a..87a83787b3 100644 --- a/server/test/repositories/audit.repository.mock.ts +++ b/server/test/repositories/audit.repository.mock.ts @@ -1,4 +1,4 @@ -import { IAuditRepository } from '@app/domain'; +import { IAuditRepository } from 'src/domain/repositories/audit.repository'; export const newAuditRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/communication.repository.mock.ts b/server/test/repositories/communication.repository.mock.ts index e98e0a68f7..8ba1e370cf 100644 --- a/server/test/repositories/communication.repository.mock.ts +++ b/server/test/repositories/communication.repository.mock.ts @@ -1,4 +1,4 @@ -import { ICommunicationRepository } from '@app/domain'; +import { ICommunicationRepository } from 'src/domain/repositories/communication.repository'; export const newCommunicationRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/crypto.repository.mock.ts b/server/test/repositories/crypto.repository.mock.ts index 52f4384530..015593a888 100644 --- a/server/test/repositories/crypto.repository.mock.ts +++ b/server/test/repositories/crypto.repository.mock.ts @@ -1,4 +1,4 @@ -import { ICryptoRepository } from '@app/domain'; +import { ICryptoRepository } from 'src/domain/repositories/crypto.repository'; export const newCryptoRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/database.repository.mock.ts b/server/test/repositories/database.repository.mock.ts index 19e2df17a3..5cf2960d27 100644 --- a/server/test/repositories/database.repository.mock.ts +++ b/server/test/repositories/database.repository.mock.ts @@ -1,4 +1,5 @@ -import { IDatabaseRepository, Version } from '@app/domain'; +import { Version } from 'src/domain/domain.constant'; +import { IDatabaseRepository } from 'src/domain/repositories/database.repository'; export const newDatabaseRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/index.ts b/server/test/repositories/index.ts deleted file mode 100644 index 90fd1326b4..0000000000 --- a/server/test/repositories/index.ts +++ /dev/null @@ -1,26 +0,0 @@ -export * from './access.repository.mock'; -export * from './album.repository.mock'; -export * from './api-key.repository.mock'; -export * from './asset-stack.repository.mock'; -export * from './asset.repository.mock'; -export * from './audit.repository.mock'; -export * from './communication.repository.mock'; -export * from './crypto.repository.mock'; -export * from './database.repository.mock'; -export * from './job.repository.mock'; -export * from './library.repository.mock'; -export * from './machine-learning.repository.mock'; -export * from './media.repository.mock'; -export * from './metadata.repository.mock'; -export * from './move.repository.mock'; -export * from './partner.repository.mock'; -export * from './person.repository.mock'; -export * from './search.repository.mock'; -export * from './shared-link.repository.mock'; -export * from './storage.repository.mock'; -export * from './system-config.repository.mock'; -export * from './system-info.repository.mock'; -export * from './system-metadata.repository.mock'; -export * from './tag.repository.mock'; -export * from './user-token.repository.mock'; -export * from './user.repository.mock'; diff --git a/server/test/repositories/job.repository.mock.ts b/server/test/repositories/job.repository.mock.ts index 5967c3ce25..2162873435 100644 --- a/server/test/repositories/job.repository.mock.ts +++ b/server/test/repositories/job.repository.mock.ts @@ -1,4 +1,4 @@ -import { IJobRepository } from '@app/domain'; +import { IJobRepository } from 'src/domain/repositories/job.repository'; export const newJobRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/library.repository.mock.ts b/server/test/repositories/library.repository.mock.ts index 740f4c4837..79d95cbb56 100644 --- a/server/test/repositories/library.repository.mock.ts +++ b/server/test/repositories/library.repository.mock.ts @@ -1,4 +1,4 @@ -import { ILibraryRepository } from '@app/domain'; +import { ILibraryRepository } from 'src/domain/repositories/library.repository'; export const newLibraryRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/machine-learning.repository.mock.ts b/server/test/repositories/machine-learning.repository.mock.ts index 3538b78939..2266dedae6 100644 --- a/server/test/repositories/machine-learning.repository.mock.ts +++ b/server/test/repositories/machine-learning.repository.mock.ts @@ -1,4 +1,4 @@ -import { IMachineLearningRepository } from '@app/domain'; +import { IMachineLearningRepository } from 'src/domain/repositories/machine-learning.repository'; export const newMachineLearningRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/media.repository.mock.ts b/server/test/repositories/media.repository.mock.ts index 74c4a5d7a1..8b21aad10c 100644 --- a/server/test/repositories/media.repository.mock.ts +++ b/server/test/repositories/media.repository.mock.ts @@ -1,4 +1,4 @@ -import { IMediaRepository } from '@app/domain'; +import { IMediaRepository } from 'src/domain/repositories/media.repository'; export const newMediaRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/metadata.repository.mock.ts b/server/test/repositories/metadata.repository.mock.ts index e47120ac9f..ff2bb53fb4 100644 --- a/server/test/repositories/metadata.repository.mock.ts +++ b/server/test/repositories/metadata.repository.mock.ts @@ -1,4 +1,4 @@ -import { IMetadataRepository } from '@app/domain'; +import { IMetadataRepository } from 'src/domain/repositories/metadata.repository'; export const newMetadataRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/move.repository.mock.ts b/server/test/repositories/move.repository.mock.ts index e14b0640b8..b42dc8610a 100644 --- a/server/test/repositories/move.repository.mock.ts +++ b/server/test/repositories/move.repository.mock.ts @@ -1,4 +1,4 @@ -import { IMoveRepository } from '@app/domain'; +import { IMoveRepository } from 'src/domain/repositories/move.repository'; export const newMoveRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/partner.repository.mock.ts b/server/test/repositories/partner.repository.mock.ts index 1e839ae4f7..c701471397 100644 --- a/server/test/repositories/partner.repository.mock.ts +++ b/server/test/repositories/partner.repository.mock.ts @@ -1,4 +1,4 @@ -import { IPartnerRepository } from '@app/domain'; +import { IPartnerRepository } from 'src/domain/repositories/partner.repository'; export const newPartnerRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/person.repository.mock.ts b/server/test/repositories/person.repository.mock.ts index 2a1ccdfe59..c370241b71 100644 --- a/server/test/repositories/person.repository.mock.ts +++ b/server/test/repositories/person.repository.mock.ts @@ -1,4 +1,4 @@ -import { IPersonRepository } from '@app/domain'; +import { IPersonRepository } from 'src/domain/repositories/person.repository'; export const newPersonRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/search.repository.mock.ts b/server/test/repositories/search.repository.mock.ts index 7b428f0cc4..e86b833506 100644 --- a/server/test/repositories/search.repository.mock.ts +++ b/server/test/repositories/search.repository.mock.ts @@ -1,4 +1,4 @@ -import { ISearchRepository } from '@app/domain'; +import { ISearchRepository } from 'src/domain/repositories/search.repository'; export const newSearchRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/shared-link.repository.mock.ts b/server/test/repositories/shared-link.repository.mock.ts index fb34b0ad76..2cdf0e2b23 100644 --- a/server/test/repositories/shared-link.repository.mock.ts +++ b/server/test/repositories/shared-link.repository.mock.ts @@ -1,4 +1,4 @@ -import { ISharedLinkRepository } from '@app/domain'; +import { ISharedLinkRepository } from 'src/domain/repositories/shared-link.repository'; export const newSharedLinkRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/storage.repository.mock.ts b/server/test/repositories/storage.repository.mock.ts index a8ffbf4105..a2851e9e1c 100644 --- a/server/test/repositories/storage.repository.mock.ts +++ b/server/test/repositories/storage.repository.mock.ts @@ -1,5 +1,6 @@ -import { IStorageRepository, StorageCore, StorageEventType, WatchEvents } from '@app/domain'; import { WatchOptions } from 'chokidar'; +import { IStorageRepository, StorageEventType, WatchEvents } from 'src/domain/repositories/storage.repository'; +import { StorageCore } from 'src/domain/storage/storage.core'; interface MockWatcherOptions { items?: Array<{ event: 'change' | 'add' | 'unlink' | 'error'; value: string }>; diff --git a/server/test/repositories/system-config.repository.mock.ts b/server/test/repositories/system-config.repository.mock.ts index 3be69f2670..6fb4520f83 100644 --- a/server/test/repositories/system-config.repository.mock.ts +++ b/server/test/repositories/system-config.repository.mock.ts @@ -1,4 +1,5 @@ -import { ISystemConfigRepository, SystemConfigCore } from '@app/domain'; +import { ISystemConfigRepository } from 'src/domain/repositories/system-config.repository'; +import { SystemConfigCore } from 'src/domain/system-config/system-config.core'; export const newSystemConfigRepositoryMock = (reset = true): jest.Mocked => { if (reset) { diff --git a/server/test/repositories/system-info.repository.mock.ts b/server/test/repositories/system-info.repository.mock.ts index 14c52a6b7d..a392818ed6 100644 --- a/server/test/repositories/system-info.repository.mock.ts +++ b/server/test/repositories/system-info.repository.mock.ts @@ -1,4 +1,4 @@ -import { IServerInfoRepository } from '@app/domain'; +import { IServerInfoRepository } from 'src/domain/repositories/server-info.repository'; export const newServerInfoRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/system-metadata.repository.mock.ts b/server/test/repositories/system-metadata.repository.mock.ts index fc4207da6f..f031740a4f 100644 --- a/server/test/repositories/system-metadata.repository.mock.ts +++ b/server/test/repositories/system-metadata.repository.mock.ts @@ -1,4 +1,4 @@ -import { ISystemMetadataRepository } from '@app/domain'; +import { ISystemMetadataRepository } from 'src/domain/repositories/system-metadata.repository'; export const newSystemMetadataRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/tag.repository.mock.ts b/server/test/repositories/tag.repository.mock.ts index cb1e05a096..611e773eff 100644 --- a/server/test/repositories/tag.repository.mock.ts +++ b/server/test/repositories/tag.repository.mock.ts @@ -1,4 +1,4 @@ -import { ITagRepository } from '@app/domain'; +import { ITagRepository } from 'src/domain/repositories/tag.repository'; export const newTagRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/user-token.repository.mock.ts b/server/test/repositories/user-token.repository.mock.ts index 9d1bacf1c2..c11cc5ed9e 100644 --- a/server/test/repositories/user-token.repository.mock.ts +++ b/server/test/repositories/user-token.repository.mock.ts @@ -1,4 +1,4 @@ -import { IUserTokenRepository } from '@app/domain'; +import { IUserTokenRepository } from 'src/domain/repositories/user-token.repository'; export const newUserTokenRepositoryMock = (): jest.Mocked => { return { diff --git a/server/test/repositories/user.repository.mock.ts b/server/test/repositories/user.repository.mock.ts index 402b90eadd..e6772d2b1f 100644 --- a/server/test/repositories/user.repository.mock.ts +++ b/server/test/repositories/user.repository.mock.ts @@ -1,4 +1,5 @@ -import { IUserRepository, UserCore } from '@app/domain'; +import { IUserRepository } from 'src/domain/repositories/user.repository'; +import { UserCore } from 'src/domain/user/user.core'; export const newUserRepositoryMock = (reset = true): jest.Mocked => { if (reset) { diff --git a/server/tsconfig.json b/server/tsconfig.json index 6d89fe7088..ce3edda395 100644 --- a/server/tsconfig.json +++ b/server/tsconfig.json @@ -17,16 +17,10 @@ "esModuleInterop": true, "preserveWatchOutput": true, "baseUrl": "./", - "paths": { - "@test": ["test"], - "@test/*": ["test/*"], - "@app/immich": ["src/immich"], - "@app/immich/*": ["src/immich/*"], - "@app/infra": ["src/infra"], - "@app/infra/*": ["src/infra/*"], - "@app/domain": ["src/domain"], - "@app/domain/*": ["src/domain/*"], - }, }, - "exclude": ["dist", "node_modules", "upload"], -} + "exclude": [ + "dist", + "node_modules", + "upload" + ], +} \ No newline at end of file