Просмотр исходного кода

refactor(server)*: tsconfigs (#2689)

* refactor(server): tsconfigs

* chore: dummy commit

* fix: start.sh

* chore: restore original entry scripts
Jason Rasmussen 2 лет назад
Родитель
Сommit
8ebac41318
100 измененных файлов с 78 добавлено и 214 удалено
  1. 2 2
      .github/workflows/test.yml
  2. 2 2
      docker/docker-compose.yml
  3. 3 3
      docs/docs/developer/database-migrations.md
  4. 1 1
      docs/docs/developer/pr-checklist.md
  5. 2 2
      docs/docs/developer/setup.md
  6. 2 0
      server/.gitignore
  7. 1 1
      server/Dockerfile
  8. 0 6
      server/README.md
  9. 0 9
      server/apps/cli/tsconfig.app.json
  10. 0 6
      server/apps/immich/src/api-v1/album/dto/add-users.dto.ts
  11. 0 14
      server/apps/immich/test/jest-e2e.json
  12. 0 9
      server/apps/immich/tsconfig.app.json
  13. 0 21
      server/apps/microservices/test/app.e2e-spec.ts
  14. 0 9
      server/apps/microservices/test/jest-e2e.json
  15. 0 9
      server/apps/microservices/tsconfig.app.json
  16. 1 1
      server/bin/cli.sh
  17. 4 4
      server/e2e/album.e2e-spec.ts
  18. 2 2
      server/e2e/user.e2e-spec.ts
  19. 16 0
      server/jest-e2e.json
  20. 0 6
      server/libs/domain/src/asset/dto/asset-ids.dto.ts
  21. 0 9
      server/libs/domain/tsconfig.lib.json
  22. 0 9
      server/libs/infra/tsconfig.lib.json
  23. 3 51
      server/nest-cli.json
  24. 18 22
      server/package.json
  25. 0 0
      server/src/cli/app.module.ts
  26. 0 0
      server/src/cli/commands/list-users.command.ts
  27. 0 0
      server/src/cli/commands/password-login.ts
  28. 1 1
      server/src/cli/commands/reset-admin-password.command.ts
  29. 0 0
      server/src/cli/constants.ts
  30. 1 2
      server/src/cli/immich.ts
  31. 0 0
      server/src/domain/access/access.repository.ts
  32. 0 0
      server/src/domain/access/index.ts
  33. 0 0
      server/src/domain/album/album.repository.ts
  34. 1 1
      server/src/domain/album/album.service.spec.ts
  35. 0 0
      server/src/domain/album/album.service.ts
  36. 1 1
      server/src/domain/album/dto/album-add-users.dto.ts
  37. 1 1
      server/src/domain/album/dto/album-create.dto.ts
  38. 1 1
      server/src/domain/album/dto/album-update.dto.ts
  39. 2 2
      server/src/domain/album/dto/get-albums.dto.ts
  40. 0 0
      server/src/domain/album/dto/index.ts
  41. 0 0
      server/src/domain/album/index.ts
  42. 0 0
      server/src/domain/album/response-dto/album-response.dto.ts
  43. 0 0
      server/src/domain/album/response-dto/index.ts
  44. 0 0
      server/src/domain/api-key/api-key-response.dto.ts
  45. 0 0
      server/src/domain/api-key/api-key.core.ts
  46. 0 0
      server/src/domain/api-key/api-key.dto.ts
  47. 0 0
      server/src/domain/api-key/api-key.repository.ts
  48. 1 1
      server/src/domain/api-key/api-key.service.spec.ts
  49. 0 0
      server/src/domain/api-key/api-key.service.ts
  50. 0 0
      server/src/domain/api-key/index.ts
  51. 0 0
      server/src/domain/asset/asset.repository.ts
  52. 2 2
      server/src/domain/asset/asset.service.spec.ts
  53. 0 0
      server/src/domain/asset/asset.service.ts
  54. 6 0
      server/src/domain/asset/dto/asset-ids.dto.ts
  55. 0 0
      server/src/domain/asset/dto/index.ts
  56. 1 1
      server/src/domain/asset/dto/map-marker.dto.ts
  57. 0 0
      server/src/domain/asset/index.ts
  58. 0 0
      server/src/domain/asset/response-dto/asset-ids-response.dto.ts
  59. 0 0
      server/src/domain/asset/response-dto/asset-response.dto.ts
  60. 0 0
      server/src/domain/asset/response-dto/exif-response.dto.ts
  61. 0 0
      server/src/domain/asset/response-dto/index.ts
  62. 0 0
      server/src/domain/asset/response-dto/map-marker-response.dto.ts
  63. 0 0
      server/src/domain/asset/response-dto/smart-info-response.dto.ts
  64. 0 0
      server/src/domain/auth/auth.constant.ts
  65. 0 0
      server/src/domain/auth/auth.core.ts
  66. 1 1
      server/src/domain/auth/auth.service.spec.ts
  67. 0 0
      server/src/domain/auth/auth.service.ts
  68. 0 0
      server/src/domain/auth/dto/auth-user.dto.ts
  69. 0 0
      server/src/domain/auth/dto/change-password.dto.ts
  70. 0 0
      server/src/domain/auth/dto/index.ts
  71. 0 0
      server/src/domain/auth/dto/login-credential.dto.spec.ts
  72. 0 0
      server/src/domain/auth/dto/login-credential.dto.ts
  73. 0 0
      server/src/domain/auth/dto/sign-up.dto.spec.ts
  74. 0 0
      server/src/domain/auth/dto/sign-up.dto.ts
  75. 0 0
      server/src/domain/auth/index.ts
  76. 0 0
      server/src/domain/auth/response-dto/admin-signup-response.dto.ts
  77. 0 0
      server/src/domain/auth/response-dto/auth-device-response.dto.ts
  78. 0 0
      server/src/domain/auth/response-dto/index.ts
  79. 0 0
      server/src/domain/auth/response-dto/login-response.dto.ts
  80. 0 0
      server/src/domain/auth/response-dto/logout-response.dto.ts
  81. 0 0
      server/src/domain/auth/response-dto/validate-asset-token-response.dto.ts
  82. 0 0
      server/src/domain/communication/communication.repository.ts
  83. 0 0
      server/src/domain/communication/index.ts
  84. 0 0
      server/src/domain/crypto/crypto.repository.ts
  85. 0 0
      server/src/domain/crypto/index.ts
  86. 0 0
      server/src/domain/domain.config.ts
  87. 1 1
      server/src/domain/domain.constant.ts
  88. 0 0
      server/src/domain/domain.module.ts
  89. 0 0
      server/src/domain/domain.util.ts
  90. 0 0
      server/src/domain/facial-recognition/face.repository.ts
  91. 1 1
      server/src/domain/facial-recognition/facial-recognition.service.spec.ts
  92. 0 0
      server/src/domain/facial-recognition/facial-recognition.services.ts
  93. 0 0
      server/src/domain/facial-recognition/index.ts
  94. 0 0
      server/src/domain/index.ts
  95. 0 0
      server/src/domain/job/dto/index.ts
  96. 0 0
      server/src/domain/job/dto/job-command.dto.ts
  97. 0 0
      server/src/domain/job/dto/job-id.dto.ts
  98. 0 0
      server/src/domain/job/index.ts
  99. 0 0
      server/src/domain/job/job.constants.ts
  100. 0 0
      server/src/domain/job/job.interface.ts

+ 2 - 2
.github/workflows/test.yml

@@ -167,13 +167,13 @@ jobs:
         run: npm --prefix server run typeorm:migrations:run
       - name: Generate new migrations
         continue-on-error: true
-        run: npm --prefix server run typeorm:migrations:generate ./libs/infra/src/migrations/TestMigration
+        run: npm --prefix server run typeorm:migrations:generate ./src/infra/migrations/TestMigration
       - name: Find file changes
         uses: tj-actions/verify-changed-files@v13.1
         id: verify-changed-files
         with:
           files: |
-            server/libs/infra/src/migrations/
+            server/src/infra/migrations/
       - name: Verify files have not changed
         if: steps.verify-changed-files.outputs.files_changed == 'true'
         run: |

+ 2 - 2
docker/docker-compose.yml

@@ -4,7 +4,7 @@ services:
   immich-server:
     container_name: immich_server
     image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
-    command: ["start-server.sh"]
+    command: [ "start.sh", "immich" ]
     volumes:
       - ${UPLOAD_LOCATION}:/usr/src/app/upload
     env_file:
@@ -18,7 +18,7 @@ services:
   immich-microservices:
     container_name: immich_microservices
     image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
-    command: ["start-microservices.sh"]
+    command: [ "start.sh", "microservices" ]
     volumes:
       - ${UPLOAD_LOCATION}:/usr/src/app/upload
     env_file:

+ 3 - 3
docs/docs/developer/database-migrations.md

@@ -1,14 +1,14 @@
 # Database Migrations
 
-After making any changes in the `server/libs/database/src/entities`, a database migration need to run in order to register the changes in the database. Follow the steps below to create a new migration.
+After making any changes in the `server/src/infra/database/entities`, a database migration need to run in order to register the changes in the database. Follow the steps below to create a new migration.
 
 1. Run the command
 
 ```bash
-npm run typeorm:migrations:generate ./libs/infra/src/<migration-name>
+npm run typeorm:migrations:generate ./src/infra/<migration-name>
 ```
 
 2. Check if the migration file makes sense.
-3. Move the migration file to folder `server/libs/database/src/migrations` in your code editor.
+3. Move the migration file to folder `./src/infra/database/migrations` in your code editor.
 
 The server will automatically detect `*.ts` file changes and restart. Part of the server start-up process includes running any new migrations, so it will be applied immediately.

+ 1 - 1
docs/docs/developer/pr-checklist.md

@@ -30,4 +30,4 @@ The Open API client libraries need to be regenerated whenever there are changes
 
 ## Database Migrations
 
-A database migration needs to be generated whenever there are changes to `server/libs/infra/src/entities`. See [Database Migration](/docs/developer/database-migrations.md) for more details.
+A database migration needs to be generated whenever there are changes to `server/src/infra/src/entities`. See [Database Migration](/docs/developer/database-migrations.md) for more details.

+ 2 - 2
docs/docs/developer/setup.md

@@ -10,9 +10,9 @@ sidebar_position: 2
 
 This environment includes the following services:
 
-- Core server - `/server/apps/immich`
+- Core server - `/server/src/immich`
 - Machine learning - `/machine-learning`
-- Microservices - `/server/apps/microservicess`
+- Microservices - `/server/src/microservicess`
 - Web app - `/web`
 - Redis
 - PostgreSQL development database with exposed port `5432` so you can use any database client to acess it

+ 2 - 0
server/.gitignore

@@ -40,3 +40,5 @@ upload/
 tmp/
 core
 .reverse-geocoding-dump/
+
+**/node_modules/**

+ 1 - 1
server/Dockerfile

@@ -32,7 +32,7 @@ COPY --from=prod /usr/src/app/bin ./bin
 COPY LICENSE /licenses/LICENSE.txt
 COPY LICENSE /LICENSE
 COPY package.json package-lock.json ./
-COPY start-server.sh start-microservices.sh ./
+COPY start*.sh ./
 
 RUN npm link && npm cache clean --force
 

+ 0 - 6
server/README.md

@@ -1,6 +0,0 @@
-## How to run migration
-
-1. Attached to the container shell
-2. Run `npm run typeorm -- migration:generate ./libs/database/src/<migration-name> -d libs/database/src/config/database.config.ts`
-3. Check if the migration file makes sense
-4. Move the migration file to folder `server/libs/database/src/migrations` in your code editor.

+ 0 - 9
server/apps/cli/tsconfig.app.json

@@ -1,9 +0,0 @@
-{
-  "extends": "../../tsconfig.json",
-  "compilerOptions": {
-    "declaration": false,
-    "outDir": "../../dist/apps/cli"
-  },
-  "include": ["src/**/*", "../../libs/**/*"],
-  "exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
-}

+ 0 - 6
server/apps/immich/src/api-v1/album/dto/add-users.dto.ts

@@ -1,6 +0,0 @@
-import { ValidateUUID } from '../../../../../../apps/immich/src/decorators/validate-uuid.decorator';
-
-export class AddUsersDto {
-  @ValidateUUID({ each: true })
-  sharedUserIds!: string[];
-}

+ 0 - 14
server/apps/immich/test/jest-e2e.json

@@ -1,14 +0,0 @@
-{
-  "moduleFileExtensions": ["js", "json", "ts"],
-  "modulePaths": ["<rootDir>", "<rootDir>../../../"],
-  "rootDir": ".",
-  "testEnvironment": "node",
-  "testRegex": ".e2e-spec.ts$",
-  "transform": {
-    "^.+\\.(t|j)s$": "ts-jest"
-  },
-  "moduleNameMapper": {
-    "^@app/infra(|/.*)$": "<rootDir>../../../libs/infra/src/$1",
-    "^@app/domain(|/.*)$": "<rootDir>../../../libs/domain/src/$1"
-  }
-}

+ 0 - 9
server/apps/immich/tsconfig.app.json

@@ -1,9 +0,0 @@
-{
-  "extends": "../../tsconfig.json",
-  "compilerOptions": {
-    "declaration": false,
-    "outDir": "../../dist/apps/immich"
-  },
-  "include": ["src/**/*", "../../libs/**/*"],
-  "exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
-}

+ 0 - 21
server/apps/microservices/test/app.e2e-spec.ts

@@ -1,21 +0,0 @@
-import { Test, TestingModule } from '@nestjs/testing';
-import { INestApplication } from '@nestjs/common';
-import request from 'supertest';
-import { MicroservicesModule } from './../src/microservices.module';
-
-describe('MicroservicesController (e2e)', () => {
-  let app: INestApplication;
-
-  beforeEach(async () => {
-    const moduleFixture: TestingModule = await Test.createTestingModule({
-      imports: [MicroservicesModule],
-    }).compile();
-
-    app = moduleFixture.createNestApplication();
-    await app.init();
-  });
-
-  it('/ (GET)', () => {
-    return request(app.getHttpServer()).get('/').expect(200).expect('Hello World!');
-  });
-});

+ 0 - 9
server/apps/microservices/test/jest-e2e.json

@@ -1,9 +0,0 @@
-{
-  "moduleFileExtensions": ["js", "json", "ts"],
-  "rootDir": ".",
-  "testEnvironment": "node",
-  "testRegex": ".e2e-spec.ts$",
-  "transform": {
-    "^.+\\.(t|j)s$": "ts-jest"
-  }
-}

+ 0 - 9
server/apps/microservices/tsconfig.app.json

@@ -1,9 +0,0 @@
-{
-  "extends": "../../tsconfig.json",
-  "compilerOptions": {
-    "declaration": false,
-    "outDir": "../../dist/apps/microservices"
-  },
-  "include": ["src/**/*"],
-  "exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
-}

+ 1 - 1
server/bin/cli.sh

@@ -1 +1 @@
-node ./dist/apps/cli/apps/cli/src/immich "$@"
+node ./dist/main cli "$@"

+ 4 - 4
server/apps/immich/test/album.e2e-spec.ts → server/e2e/album.e2e-spec.ts

@@ -1,13 +1,13 @@
 import { Test, TestingModule } from '@nestjs/testing';
 import { INestApplication } from '@nestjs/common';
 import request from 'supertest';
-import { clearDb, getAuthUser, authCustom } from './test-utils';
+import { clearDb, getAuthUser, authCustom } from '../test/test-utils';
 import { CreateAlbumDto } from '@app/domain';
-import { CreateAlbumShareLinkDto } from '../src/api-v1/album/dto/create-album-shared-link.dto';
-import { AuthUserDto } from '../src/decorators/auth-user.decorator';
+import { CreateAlbumShareLinkDto } from '@app/immich/api-v1/album/dto/create-album-shared-link.dto';
+import { AuthUserDto } from '@app/immich/decorators/auth-user.decorator';
 import { AlbumResponseDto, AuthService, SharedLinkResponseDto, UserService } from '@app/domain';
 import { DataSource } from 'typeorm';
-import { AppModule } from '../src/app.module';
+import { AppModule } from '@app/immich/app.module';
 
 async function _createAlbum(app: INestApplication, data: CreateAlbumDto) {
   const res = await request(app.getHttpServer()).post('/album').send(data);

+ 2 - 2
server/apps/immich/test/user.e2e-spec.ts → server/e2e/user.e2e-spec.ts

@@ -1,11 +1,11 @@
 import { Test, TestingModule } from '@nestjs/testing';
 import { INestApplication } from '@nestjs/common';
 import request from 'supertest';
-import { clearDb, authCustom } from './test-utils';
+import { clearDb, authCustom } from '../test/test-utils';
 import { CreateUserDto, UserService, AuthUserDto, UserResponseDto } from '@app/domain';
 import { DataSource } from 'typeorm';
 import { AuthService } from '@app/domain';
-import { AppModule } from '../src/app.module';
+import { AppModule } from '@app/immich/app.module';
 
 function _createUser(userService: UserService, data: CreateUserDto) {
   return userService.createUser(data);

+ 16 - 0
server/jest-e2e.json

@@ -0,0 +1,16 @@
+{
+  "moduleFileExtensions": ["js", "json", "ts"],
+  "modulePaths": ["<rootDir>"],
+  "rootDir": ".",
+  "testEnvironment": "node",
+  "testRegex": ".e2e-spec.ts$",
+  "transform": {
+    "^.+\\.(t|j)s$": "ts-jest"
+  },
+  "moduleNameMapper": {
+    "^@test(|/.*)$": "<rootDir>/test/$1",
+    "^@app/immich(|/.*)$": "<rootDir>/src/immich/$1",
+    "^@app/infra(|/.*)$": "<rootDir>/src/infra/$1",
+    "^@app/domain(|/.*)$": "<rootDir>/src/domain/$1"
+  }
+}

+ 0 - 6
server/libs/domain/src/asset/dto/asset-ids.dto.ts

@@ -1,6 +0,0 @@
-import { ValidateUUID } from '../../../../../apps/immich/src/decorators/validate-uuid.decorator';
-
-export class AssetIdsDto {
-  @ValidateUUID({ each: true })
-  assetIds!: string[];
-}

+ 0 - 9
server/libs/domain/tsconfig.lib.json

@@ -1,9 +0,0 @@
-{
-  "extends": "../../tsconfig.json",
-  "compilerOptions": {
-    "declaration": true,
-    "outDir": "../../dist/libs/domain"
-  },
-  "include": ["src/**/*"],
-  "exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
-}

+ 0 - 9
server/libs/infra/tsconfig.lib.json

@@ -1,9 +0,0 @@
-{
-  "extends": "../../tsconfig.json",
-  "compilerOptions": {
-    "declaration": true,
-    "outDir": "../../dist/libs/infra"
-  },
-  "include": ["src/**/*"],
-  "exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
-}

+ 3 - 51
server/nest-cli.json

@@ -1,11 +1,10 @@
 {
+  "$schema": "https://json.schemastore.org/nest-cli",
   "collection": "@nestjs/schematics",
-  "sourceRoot": "apps/immich/src",
-  "monorepo": true,
-  "root": "apps/immich",
+  "sourceRoot": "src",
   "compilerOptions": {
+    "deleteOutDir": true,
     "webpack": false,
-    "tsConfigPath": "apps/immich/tsconfig.app.json",
     "plugins": [
       {
         "name": "@nestjs/swagger",
@@ -15,52 +14,5 @@
         }
       }
     ]
-  },
-  "projects": {
-    "immich": {
-      "type": "application",
-      "root": "apps/immich",
-      "entryFile": "main",
-      "sourceRoot": "apps/immich/src",
-      "compilerOptions": {
-        "tsConfigPath": "apps/immich/tsconfig.app.json"
-      }
-    },
-    "microservices": {
-      "type": "application",
-      "root": "apps/microservices",
-      "entryFile": "main",
-      "sourceRoot": "apps/microservices/src",
-      "compilerOptions": {
-        "tsConfigPath": "apps/microservices/tsconfig.app.json"
-      }
-    },
-    "cli": {
-      "type": "application",
-      "root": "apps/cli",
-      "entryFile": "immich",
-      "sourceRoot": "apps/cli/src",
-      "compilerOptions": {
-        "tsConfigPath": "apps/cli/tsconfig.app.json"
-      }
-    },
-    "infra": {
-      "type": "library",
-      "root": "libs/infra",
-      "entryFile": "index",
-      "sourceRoot": "libs/infra/src",
-      "compilerOptions": {
-        "tsConfigPath": "libs/infra/tsconfig.lib.json"
-      }
-    },
-    "domain": {
-      "type": "library",
-      "root": "libs/domain",
-      "entryFile": "index",
-      "sourceRoot": "libs/domain/src",
-      "compilerOptions": {
-        "tsConfigPath": "libs/domain/tsconfig.lib.json"
-      }
-    }
   }
 }

+ 18 - 22
server/package.json

@@ -9,16 +9,14 @@
     "immich": "./bin/cli.sh"
   },
   "scripts": {
-    "prebuild": "rimraf dist",
-    "build": "nest build immich && nest build microservices && nest build cli",
+    "build": "nest build",
     "format": "prettier --check .",
     "format:fix": "prettier --write .",
-    "start": "nest start",
+    "start": "npm run start:dev",
     "nest": "nest",
-    "start:dev": "nest start --watch",
-    "start:debug": "rimraf dist && nest start --debug 0.0.0.0:9230 --watch",
-    "start:prod": "node dist/main",
-    "lint": "eslint \"{apps,libs}/**/*.ts\" --max-warnings 0",
+    "start:dev": "nest start --watch --",
+    "start:debug": "nest start --debug 0.0.0.0:9230 --watch --",
+    "lint": "eslint \"src/**/*.ts\" --max-warnings 0",
     "lint:fix": "npm run lint -- --fix",
     "check": "tsc --noEmit",
     "check:code": "npm run format && npm run lint && npm run check",
@@ -27,13 +25,13 @@
     "test:watch": "jest --watch",
     "test:cov": "jest --coverage",
     "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
-    "test:e2e": "jest --config ./apps/immich/test/jest-e2e.json --runInBand",
+    "test:e2e": "jest --config jest-e2e.json --runInBand",
     "typeorm": "node --require ts-node/register ./node_modules/typeorm/cli.js",
     "typeorm:migrations:create": "node --require ts-node/register ./node_modules/typeorm/cli.js migration:create",
-    "typeorm:migrations:generate": "node --require ts-node/register ./node_modules/typeorm/cli.js migration:generate -d ./libs/infra/src/database.config.ts",
-    "typeorm:migrations:run": "node --require ts-node/register ./node_modules/typeorm/cli.js migration:run -d ./libs/infra/src/database.config.ts",
-    "typeorm:migrations:revert": "node --require ts-node/register ./node_modules/typeorm/cli.js migration:revert -d ./libs/infra/src/database.config.ts",
-    "typeorm:schema:drop": "node --require ts-node/register ./node_modules/typeorm/cli.js schema:drop -d ./libs/infra/src/database.config.ts",
+    "typeorm:migrations:generate": "node --require ts-node/register ./node_modules/typeorm/cli.js migration:generate -d ./src/infra/database.config.ts",
+    "typeorm:migrations:run": "node --require ts-node/register ./node_modules/typeorm/cli.js migration:run -d ./src/infra/database.config.ts",
+    "typeorm:migrations:revert": "node --require ts-node/register ./node_modules/typeorm/cli.js migration:revert -d ./src/infra/database.config.ts",
+    "typeorm:schema:drop": "node --require ts-node/register ./node_modules/typeorm/cli.js schema:drop -d ./src/infra/database.config.ts",
     "typeorm:schema:reset": "npm run typeorm:schema:drop && npm run typeorm:migrations:run",
     "api:typescript": "bash ./bin/generate-open-api.sh web",
     "api:dart": "bash ./bin/generate-open-api.sh mobile",
@@ -134,11 +132,11 @@
     },
     "collectCoverageFrom": [
       "**/*.(t|j)s",
-      "!<rootDir>/libs/infra/**/*"
+      "!<rootDir>/infra/**/*"
     ],
     "coverageDirectory": "./coverage",
     "coverageThreshold": {
-      "./libs/domain/": {
+      "./src/domain/": {
         "branches": 80,
         "functions": 80,
         "lines": 90,
@@ -146,17 +144,15 @@
       }
     },
     "setupFilesAfterEnv": [
-      "<rootDir>/libs/domain/test/setup.ts"
+      "<rootDir>/test/setup.ts"
     ],
     "testEnvironment": "node",
-    "roots": [
-      "<rootDir>/apps/",
-      "<rootDir>/libs/"
-    ],
     "moduleNameMapper": {
-      "^@app/infra(|/.*)$": "<rootDir>/libs/infra/src/$1",
-      "^@app/domain(|/.*)$": "<rootDir>/libs/domain/src/$1"
+      "^@test(|/.*)$": "<rootDir>/test/$1",
+      "^@app/immich(|/.*)$": "<rootDir>/src/immich/$1",
+      "^@app/infra(|/.*)$": "<rootDir>/src/infra/$1",
+      "^@app/domain(|/.*)$": "<rootDir>/src/domain/$1"
     },
-    "globalSetup": "<rootDir>/libs/domain/test/global-setup.js"
+    "globalSetup": "<rootDir>/test/global-setup.js"
   }
 }

+ 0 - 0
server/apps/cli/src/app.module.ts → server/src/cli/app.module.ts


+ 0 - 0
server/apps/cli/src/commands/list-users.command.ts → server/src/cli/commands/list-users.command.ts


+ 0 - 0
server/apps/cli/src/commands/password-login.ts → server/src/cli/commands/password-login.ts


+ 1 - 1
server/apps/cli/src/commands/reset-admin-password.command.ts → server/src/cli/commands/reset-admin-password.command.ts

@@ -13,7 +13,7 @@ export class ResetAdminPasswordCommand extends CommandRunner {
   async run(): Promise<void> {
     const ask = (admin: UserResponseDto) => {
       const { id, oauthId, email, firstName, lastName } = admin;
-      console.log(`Found Admin: 
+      console.log(`Found Admin:
 - ID=${id}
 - OAuth ID=${oauthId}
 - Email=${email}

+ 0 - 0
server/apps/cli/src/constants.ts → server/src/cli/constants.ts


+ 1 - 2
server/apps/cli/src/immich.ts → server/src/cli/immich.ts

@@ -1,7 +1,6 @@
 import { CommandFactory } from 'nest-commander';
 import { AppModule } from './app.module';
 
-async function bootstrap() {
+export async function bootstrap() {
   await CommandFactory.run(AppModule, ['warn', 'error']);
 }
-bootstrap();

+ 0 - 0
server/libs/domain/src/access/access.repository.ts → server/src/domain/access/access.repository.ts


+ 0 - 0
server/libs/domain/src/access/index.ts → server/src/domain/access/index.ts


+ 0 - 0
server/libs/domain/src/album/album.repository.ts → server/src/domain/album/album.repository.ts


+ 1 - 1
server/libs/domain/src/album/album.service.spec.ts → server/src/domain/album/album.service.spec.ts

@@ -8,7 +8,7 @@ import {
   newJobRepositoryMock,
   newUserRepositoryMock,
   userEntityStub,
-} from '../../test';
+} from '@test';
 import { IAssetRepository } from '../asset';
 import { IJobRepository, JobName } from '../job';
 import { IUserRepository } from '../user';

+ 0 - 0
server/libs/domain/src/album/album.service.ts → server/src/domain/album/album.service.ts


+ 1 - 1
server/libs/domain/src/album/dto/album-add-users.dto.ts → server/src/domain/album/dto/album-add-users.dto.ts

@@ -1,5 +1,5 @@
 import { ArrayNotEmpty } from 'class-validator';
-import { ValidateUUID } from '../../../../../apps/immich/src/decorators/validate-uuid.decorator';
+import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator';
 
 export class AddUsersDto {
   @ValidateUUID({ each: true })

+ 1 - 1
server/libs/domain/src/album/dto/album-create.dto.ts → server/src/domain/album/dto/album-create.dto.ts

@@ -1,5 +1,5 @@
 import { ApiProperty } from '@nestjs/swagger';
-import { ValidateUUID } from '../../../../../apps/immich/src/decorators/validate-uuid.decorator';
+import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator';
 import { IsNotEmpty, IsString } from 'class-validator';
 
 export class CreateAlbumDto {

+ 1 - 1
server/libs/domain/src/album/dto/album-update.dto.ts → server/src/domain/album/dto/album-update.dto.ts

@@ -1,6 +1,6 @@
 import { ApiProperty } from '@nestjs/swagger';
 import { IsOptional } from 'class-validator';
-import { ValidateUUID } from '../../../../../apps/immich/src/decorators/validate-uuid.decorator';
+import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator';
 
 export class UpdateAlbumDto {
   @IsOptional()

+ 2 - 2
server/libs/domain/src/album/dto/get-albums.dto.ts → server/src/domain/album/dto/get-albums.dto.ts

@@ -1,8 +1,8 @@
 import { ApiProperty } from '@nestjs/swagger';
 import { Transform } from 'class-transformer';
 import { IsBoolean, IsOptional } from 'class-validator';
-import { ValidateUUID } from '../../../../../apps/immich/src/decorators/validate-uuid.decorator';
-import { toBoolean } from '../../../../../apps/immich/src/utils/transform.util';
+import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator';
+import { toBoolean } from '@app/immich/utils/transform.util';
 
 export class GetAlbumsDto {
   @IsOptional()

+ 0 - 0
server/libs/domain/src/album/dto/index.ts → server/src/domain/album/dto/index.ts


+ 0 - 0
server/libs/domain/src/album/index.ts → server/src/domain/album/index.ts


+ 0 - 0
server/libs/domain/src/album/response-dto/album-response.dto.ts → server/src/domain/album/response-dto/album-response.dto.ts


+ 0 - 0
server/libs/domain/src/album/response-dto/index.ts → server/src/domain/album/response-dto/index.ts


+ 0 - 0
server/libs/domain/src/api-key/api-key-response.dto.ts → server/src/domain/api-key/api-key-response.dto.ts


+ 0 - 0
server/libs/domain/src/api-key/api-key.core.ts → server/src/domain/api-key/api-key.core.ts


+ 0 - 0
server/libs/domain/src/api-key/api-key.dto.ts → server/src/domain/api-key/api-key.dto.ts


+ 0 - 0
server/libs/domain/src/api-key/api-key.repository.ts → server/src/domain/api-key/api-key.repository.ts


+ 1 - 1
server/libs/domain/src/api-key/api-key.service.spec.ts → server/src/domain/api-key/api-key.service.spec.ts

@@ -1,5 +1,5 @@
 import { BadRequestException } from '@nestjs/common';
-import { authStub, keyStub, newCryptoRepositoryMock, newKeyRepositoryMock } from '../../test';
+import { authStub, keyStub, newCryptoRepositoryMock, newKeyRepositoryMock } from '@test';
 import { ICryptoRepository } from '../crypto';
 import { IKeyRepository } from './api-key.repository';
 import { APIKeyService } from './api-key.service';

+ 0 - 0
server/libs/domain/src/api-key/api-key.service.ts → server/src/domain/api-key/api-key.service.ts


+ 0 - 0
server/libs/domain/src/api-key/index.ts → server/src/domain/api-key/index.ts


+ 0 - 0
server/libs/domain/src/asset/asset.repository.ts → server/src/domain/asset/asset.repository.ts


+ 2 - 2
server/libs/domain/src/asset/asset.service.spec.ts → server/src/domain/asset/asset.service.spec.ts

@@ -1,5 +1,5 @@
-import { assetEntityStub, authStub, newAssetRepositoryMock } from '../../test';
-import { AssetService, IAssetRepository } from '../asset';
+import { assetEntityStub, authStub, newAssetRepositoryMock } from '@test';
+import { AssetService, IAssetRepository } from '.';
 
 describe(AssetService.name, () => {
   let sut: AssetService;

+ 0 - 0
server/libs/domain/src/asset/asset.service.ts → server/src/domain/asset/asset.service.ts


+ 6 - 0
server/src/domain/asset/dto/asset-ids.dto.ts

@@ -0,0 +1,6 @@
+import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator';
+
+export class AssetIdsDto {
+  @ValidateUUID({ each: true })
+  assetIds!: string[];
+}

+ 0 - 0
server/libs/domain/src/asset/dto/index.ts → server/src/domain/asset/dto/index.ts


+ 1 - 1
server/libs/domain/src/asset/dto/map-marker.dto.ts → server/src/domain/asset/dto/map-marker.dto.ts

@@ -1,7 +1,7 @@
 import { ApiProperty } from '@nestjs/swagger';
 import { Transform, Type } from 'class-transformer';
 import { IsBoolean, IsDate, IsOptional } from 'class-validator';
-import { toBoolean } from '../../../../../apps/immich/src/utils/transform.util';
+import { toBoolean } from '@app/immich/utils/transform.util';
 
 export class MapMarkerDto {
   @ApiProperty()

+ 0 - 0
server/libs/domain/src/asset/index.ts → server/src/domain/asset/index.ts


+ 0 - 0
server/libs/domain/src/asset/response-dto/asset-ids-response.dto.ts → server/src/domain/asset/response-dto/asset-ids-response.dto.ts


+ 0 - 0
server/libs/domain/src/asset/response-dto/asset-response.dto.ts → server/src/domain/asset/response-dto/asset-response.dto.ts


+ 0 - 0
server/libs/domain/src/asset/response-dto/exif-response.dto.ts → server/src/domain/asset/response-dto/exif-response.dto.ts


+ 0 - 0
server/libs/domain/src/asset/response-dto/index.ts → server/src/domain/asset/response-dto/index.ts


+ 0 - 0
server/libs/domain/src/asset/response-dto/map-marker-response.dto.ts → server/src/domain/asset/response-dto/map-marker-response.dto.ts


+ 0 - 0
server/libs/domain/src/asset/response-dto/smart-info-response.dto.ts → server/src/domain/asset/response-dto/smart-info-response.dto.ts


+ 0 - 0
server/libs/domain/src/auth/auth.constant.ts → server/src/domain/auth/auth.constant.ts


+ 0 - 0
server/libs/domain/src/auth/auth.core.ts → server/src/domain/auth/auth.core.ts


+ 1 - 1
server/libs/domain/src/auth/auth.service.spec.ts → server/src/domain/auth/auth.service.spec.ts

@@ -17,7 +17,7 @@ import {
   systemConfigStub,
   userEntityStub,
   userTokenEntityStub,
-} from '../../test';
+} from '@test';
 import { IKeyRepository } from '../api-key';
 import { ICryptoRepository } from '../crypto/crypto.repository';
 import { ISharedLinkRepository } from '../shared-link';

+ 0 - 0
server/libs/domain/src/auth/auth.service.ts → server/src/domain/auth/auth.service.ts


+ 0 - 0
server/libs/domain/src/auth/dto/auth-user.dto.ts → server/src/domain/auth/dto/auth-user.dto.ts


+ 0 - 0
server/libs/domain/src/auth/dto/change-password.dto.ts → server/src/domain/auth/dto/change-password.dto.ts


+ 0 - 0
server/libs/domain/src/auth/dto/index.ts → server/src/domain/auth/dto/index.ts


+ 0 - 0
server/libs/domain/src/auth/dto/login-credential.dto.spec.ts → server/src/domain/auth/dto/login-credential.dto.spec.ts


+ 0 - 0
server/libs/domain/src/auth/dto/login-credential.dto.ts → server/src/domain/auth/dto/login-credential.dto.ts


+ 0 - 0
server/libs/domain/src/auth/dto/sign-up.dto.spec.ts → server/src/domain/auth/dto/sign-up.dto.spec.ts


+ 0 - 0
server/libs/domain/src/auth/dto/sign-up.dto.ts → server/src/domain/auth/dto/sign-up.dto.ts


+ 0 - 0
server/libs/domain/src/auth/index.ts → server/src/domain/auth/index.ts


+ 0 - 0
server/libs/domain/src/auth/response-dto/admin-signup-response.dto.ts → server/src/domain/auth/response-dto/admin-signup-response.dto.ts


+ 0 - 0
server/libs/domain/src/auth/response-dto/auth-device-response.dto.ts → server/src/domain/auth/response-dto/auth-device-response.dto.ts


+ 0 - 0
server/libs/domain/src/auth/response-dto/index.ts → server/src/domain/auth/response-dto/index.ts


+ 0 - 0
server/libs/domain/src/auth/response-dto/login-response.dto.ts → server/src/domain/auth/response-dto/login-response.dto.ts


+ 0 - 0
server/libs/domain/src/auth/response-dto/logout-response.dto.ts → server/src/domain/auth/response-dto/logout-response.dto.ts


+ 0 - 0
server/libs/domain/src/auth/response-dto/validate-asset-token-response.dto.ts → server/src/domain/auth/response-dto/validate-asset-token-response.dto.ts


+ 0 - 0
server/libs/domain/src/communication/communication.repository.ts → server/src/domain/communication/communication.repository.ts


+ 0 - 0
server/libs/domain/src/communication/index.ts → server/src/domain/communication/index.ts


+ 0 - 0
server/libs/domain/src/crypto/crypto.repository.ts → server/src/domain/crypto/crypto.repository.ts


+ 0 - 0
server/libs/domain/src/crypto/index.ts → server/src/domain/crypto/index.ts


+ 0 - 0
server/libs/domain/src/domain.config.ts → server/src/domain/domain.config.ts


+ 1 - 1
server/libs/domain/src/domain.constant.ts → server/src/domain/domain.constant.ts

@@ -1,5 +1,5 @@
 import { BadRequestException } from '@nestjs/common';
-import pkg from '../../../package.json';
+import pkg from 'src/../../package.json';
 
 const [major, minor, patch] = pkg.version.split('.');
 

+ 0 - 0
server/libs/domain/src/domain.module.ts → server/src/domain/domain.module.ts


+ 0 - 0
server/libs/domain/src/domain.util.ts → server/src/domain/domain.util.ts


+ 0 - 0
server/libs/domain/src/facial-recognition/face.repository.ts → server/src/domain/facial-recognition/face.repository.ts


+ 1 - 1
server/libs/domain/src/facial-recognition/facial-recognition.service.spec.ts → server/src/domain/facial-recognition/facial-recognition.service.spec.ts

@@ -10,7 +10,7 @@ import {
   newSearchRepositoryMock,
   newStorageRepositoryMock,
   personStub,
-} from '../../test';
+} from '@test';
 import { IAssetRepository, WithoutProperty } from '../asset';
 import { IJobRepository, JobName } from '../job';
 import { IMediaRepository } from '../media';

+ 0 - 0
server/libs/domain/src/facial-recognition/facial-recognition.services.ts → server/src/domain/facial-recognition/facial-recognition.services.ts


+ 0 - 0
server/libs/domain/src/facial-recognition/index.ts → server/src/domain/facial-recognition/index.ts


+ 0 - 0
server/libs/domain/src/index.ts → server/src/domain/index.ts


+ 0 - 0
server/libs/domain/src/job/dto/index.ts → server/src/domain/job/dto/index.ts


+ 0 - 0
server/libs/domain/src/job/dto/job-command.dto.ts → server/src/domain/job/dto/job-command.dto.ts


+ 0 - 0
server/libs/domain/src/job/dto/job-id.dto.ts → server/src/domain/job/dto/job-id.dto.ts


+ 0 - 0
server/libs/domain/src/job/index.ts → server/src/domain/job/index.ts


+ 0 - 0
server/libs/domain/src/job/job.constants.ts → server/src/domain/job/job.constants.ts


+ 0 - 0
server/libs/domain/src/job/job.interface.ts → server/src/domain/job/job.interface.ts


Некоторые файлы не были показаны из-за большого количества измененных файлов