From d9fa6619e715ecaee6214c84c75e5df8a4025ed9 Mon Sep 17 00:00:00 2001 From: Jason Rasmussen Date: Fri, 30 Dec 2022 08:22:06 -0500 Subject: [PATCH] refactor(server): imports and repository tokens (#1220) * refactor: entity imports * refactor: rename user repository token * chore: merge imports * refactor: rename album repository token * refactor: rename asset repository token * refactor: rename tag repository token --- server/apps/cli/src/app.module.ts | 3 +-- .../commands/reset-admin-password.command.ts | 2 +- .../src/api-v1/album/album-repository.ts | 6 ++--- .../immich/src/api-v1/album/album.module.ts | 8 +++---- .../src/api-v1/album/album.service.spec.ts | 2 +- .../immich/src/api-v1/album/album.service.ts | 10 ++++----- .../album/response-dto/album-response.dto.ts | 2 +- .../src/api-v1/asset/asset-repository.ts | 8 +++---- .../immich/src/api-v1/asset/asset.module.ts | 6 ++--- .../src/api-v1/asset/asset.service.spec.ts | 2 +- .../immich/src/api-v1/asset/asset.service.ts | 12 +++++----- .../src/api-v1/asset/dto/create-asset.dto.ts | 2 +- .../asset/response-dto/asset-response.dto.ts | 2 +- .../asset/response-dto/exif-response.dto.ts | 2 +- .../response-dto/smart-info-response.dto.ts | 2 +- .../src/api-v1/auth/auth.service.spec.ts | 2 +- .../immich/src/api-v1/auth/auth.service.ts | 6 ++--- .../response-dto/admin-signup-response.dto.ts | 2 +- .../auth/response-dto/login-response.dto.ts | 2 +- .../communication/communication.gateway.ts | 2 +- .../communication/communication.module.ts | 2 +- .../api-v1/device-info/device-info.module.ts | 2 +- .../device-info/device-info.service.spec.ts | 2 +- .../api-v1/device-info/device-info.service.ts | 2 +- .../device-info/dto/upsert-device-info.dto.ts | 2 +- .../response-dto/device-info-response.dto.ts | 2 +- .../apps/immich/src/api-v1/job/job.module.ts | 2 +- .../apps/immich/src/api-v1/job/job.service.ts | 6 ++--- .../src/api-v1/oauth/oauth.service.spec.ts | 3 +-- .../immich/src/api-v1/oauth/oauth.service.ts | 4 ++-- .../api-v1/server-info/server-info.module.ts | 3 +-- .../api-v1/server-info/server-info.service.ts | 2 +- .../system-config/dto/system-config.dto.ts | 2 +- .../system-config/system-config.module.ts | 2 +- .../src/api-v1/tag/dto/create-tag.dto.ts | 2 +- .../tag/response-dto/tag-response.dto.ts | 2 +- .../apps/immich/src/api-v1/tag/tag.module.ts | 6 ++--- .../immich/src/api-v1/tag/tag.repository.ts | 4 ++-- .../immich/src/api-v1/tag/tag.service.spec.ts | 3 +-- .../apps/immich/src/api-v1/tag/tag.service.ts | 10 ++++----- .../user/response-dto/user-response.dto.ts | 2 +- .../immich/src/api-v1/user/user-repository.ts | 4 ++-- .../apps/immich/src/api-v1/user/user.core.ts | 2 +- .../immich/src/api-v1/user/user.module.ts | 6 ++--- .../src/api-v1/user/user.service.spec.ts | 2 +- .../immich/src/api-v1/user/user.service.ts | 7 ++---- .../src/decorators/auth-user.decorator.ts | 2 +- .../background-task/background-task.module.ts | 4 +--- .../background-task.processor.ts | 3 +-- .../src/modules/download/download.service.ts | 2 +- .../modules/immich-jwt/immich-jwt.module.ts | 2 +- .../modules/immich-jwt/immich-jwt.service.ts | 2 +- .../immich-jwt/strategies/jwt.strategy.ts | 2 +- .../schedule-tasks/schedule-tasks.module.ts | 4 +--- .../schedule-tasks/schedule-tasks.service.ts | 4 +--- server/apps/immich/test/album.e2e-spec.ts | 2 +- .../microservices/src/microservices.module.ts | 6 +---- .../processors/asset-uploaded.processor.ts | 2 +- .../processors/generate-checksum.processor.ts | 2 +- .../processors/machine-learning.processor.ts | 22 +++++++------------ .../metadata-extraction.processor.ts | 3 +-- .../processors/storage-migration.processor.ts | 2 +- .../src/processors/thumbnail.processor.ts | 2 +- .../src/processors/user-deletion.processor.ts | 3 +-- .../processors/video-transcode.processor.ts | 2 +- server/libs/common/src/utils/asset-utils.ts | 2 +- .../libs/common/src/utils/user-utils.spec.ts | 2 +- server/libs/common/src/utils/user-utils.ts | 2 +- server/libs/database/src/config/index.ts | 1 + server/libs/database/src/entities/index.ts | 10 +++++++++ server/libs/database/src/index.ts | 2 ++ .../immich-config/src/immich-config.module.ts | 2 +- .../src/immich-config.service.ts | 2 +- .../interfaces/asset-uploaded.interface.ts | 2 +- .../interfaces/machine-learning.interface.ts | 2 +- .../metadata-extraction.interface.ts | 2 +- .../thumbnail-generation.interface.ts | 2 +- .../src/interfaces/user-deletion.interface.ts | 2 +- .../interfaces/video-transcode.interface.ts | 2 +- server/libs/storage/src/storage.module.ts | 3 +-- server/libs/storage/src/storage.service.ts | 3 +-- 81 files changed, 130 insertions(+), 151 deletions(-) create mode 100644 server/libs/database/src/config/index.ts create mode 100644 server/libs/database/src/entities/index.ts diff --git a/server/apps/cli/src/app.module.ts b/server/apps/cli/src/app.module.ts index 8e43d494f8..b529c7b136 100644 --- a/server/apps/cli/src/app.module.ts +++ b/server/apps/cli/src/app.module.ts @@ -1,5 +1,4 @@ -import { DatabaseModule } from '@app/database'; -import { UserEntity } from '@app/database/entities/user.entity'; +import { DatabaseModule, UserEntity } from '@app/database'; import { Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; import { PromptPasswordQuestions, ResetAdminPasswordCommand } from './commands/reset-admin-password.command'; diff --git a/server/apps/cli/src/commands/reset-admin-password.command.ts b/server/apps/cli/src/commands/reset-admin-password.command.ts index 2a01dd05a3..5062134890 100644 --- a/server/apps/cli/src/commands/reset-admin-password.command.ts +++ b/server/apps/cli/src/commands/reset-admin-password.command.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; import { InjectRepository } from '@nestjs/typeorm'; import bcrypt from 'bcrypt'; import { Command, CommandRunner, InquirerService, Question, QuestionSet } from 'nest-commander'; diff --git a/server/apps/immich/src/api-v1/album/album-repository.ts b/server/apps/immich/src/api-v1/album/album-repository.ts index 9d04aec363..988f68b5f7 100644 --- a/server/apps/immich/src/api-v1/album/album-repository.ts +++ b/server/apps/immich/src/api-v1/album/album-repository.ts @@ -1,6 +1,4 @@ -import { AlbumEntity } from '@app/database/entities/album.entity'; -import { AssetAlbumEntity } from '@app/database/entities/asset-album.entity'; -import { UserAlbumEntity } from '@app/database/entities/user-album.entity'; +import { AlbumEntity, AssetAlbumEntity, UserAlbumEntity } from '@app/database'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { In, Repository, SelectQueryBuilder, DataSource, Brackets } from 'typeorm'; @@ -28,7 +26,7 @@ export interface IAlbumRepository { getSharedWithUserAlbumCount(userId: string, assetId: string): Promise; } -export const ALBUM_REPOSITORY = 'ALBUM_REPOSITORY'; +export const IAlbumRepository = 'IAlbumRepository'; @Injectable() export class AlbumRepository implements IAlbumRepository { diff --git a/server/apps/immich/src/api-v1/album/album.module.ts b/server/apps/immich/src/api-v1/album/album.module.ts index 4df3835ffc..45b56b86cc 100644 --- a/server/apps/immich/src/api-v1/album/album.module.ts +++ b/server/apps/immich/src/api-v1/album/album.module.ts @@ -2,16 +2,14 @@ import { forwardRef, Module } from '@nestjs/common'; import { AlbumService } from './album.service'; import { AlbumController } from './album.controller'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { AlbumEntity } from '../../../../../libs/database/src/entities/album.entity'; -import { AssetAlbumEntity } from '@app/database/entities/asset-album.entity'; -import { UserAlbumEntity } from '@app/database/entities/user-album.entity'; -import { AlbumRepository, ALBUM_REPOSITORY } from './album-repository'; +import { AlbumEntity, AssetAlbumEntity, UserAlbumEntity } from '@app/database'; +import { AlbumRepository, IAlbumRepository } from './album-repository'; import { DownloadModule } from '../../modules/download/download.module'; import { AssetModule } from '../asset/asset.module'; import { UserModule } from '../user/user.module'; const ALBUM_REPOSITORY_PROVIDER = { - provide: ALBUM_REPOSITORY, + provide: IAlbumRepository, useClass: AlbumRepository, }; diff --git a/server/apps/immich/src/api-v1/album/album.service.spec.ts b/server/apps/immich/src/api-v1/album/album.service.spec.ts index 2a634656e2..2239284cc2 100644 --- a/server/apps/immich/src/api-v1/album/album.service.spec.ts +++ b/server/apps/immich/src/api-v1/album/album.service.spec.ts @@ -1,7 +1,7 @@ import { AlbumService } from './album.service'; import { AuthUserDto } from '../../decorators/auth-user.decorator'; import { BadRequestException, NotFoundException, ForbiddenException } from '@nestjs/common'; -import { AlbumEntity } from '@app/database/entities/album.entity'; +import { AlbumEntity } from '@app/database'; import { AlbumResponseDto } from './response-dto/album-response.dto'; import { IAssetRepository } from '../asset/asset-repository'; import { AddAssetsResponseDto } from './response-dto/add-assets-response.dto'; diff --git a/server/apps/immich/src/api-v1/album/album.service.ts b/server/apps/immich/src/api-v1/album/album.service.ts index 20029a76a9..941df5df02 100644 --- a/server/apps/immich/src/api-v1/album/album.service.ts +++ b/server/apps/immich/src/api-v1/album/album.service.ts @@ -1,15 +1,15 @@ import { BadRequestException, Inject, Injectable, NotFoundException, ForbiddenException } from '@nestjs/common'; import { AuthUserDto } from '../../decorators/auth-user.decorator'; import { CreateAlbumDto } from './dto/create-album.dto'; -import { AlbumEntity } from '@app/database/entities/album.entity'; +import { AlbumEntity } from '@app/database'; import { AddUsersDto } from './dto/add-users.dto'; import { RemoveAssetsDto } from './dto/remove-assets.dto'; import { UpdateAlbumDto } from './dto/update-album.dto'; import { GetAlbumsDto } from './dto/get-albums.dto'; import { AlbumResponseDto, mapAlbum, mapAlbumExcludeAssetInfo } from './response-dto/album-response.dto'; -import { ALBUM_REPOSITORY, IAlbumRepository } from './album-repository'; +import { IAlbumRepository } from './album-repository'; import { AlbumCountResponseDto } from './response-dto/album-count-response.dto'; -import { ASSET_REPOSITORY, IAssetRepository } from '../asset/asset-repository'; +import { IAssetRepository } from '../asset/asset-repository'; import { AddAssetsResponseDto } from './response-dto/add-assets-response.dto'; import { AddAssetsDto } from './dto/add-assets.dto'; import { DownloadService } from '../../modules/download/download.service'; @@ -18,8 +18,8 @@ import { DownloadDto } from '../asset/dto/download-library.dto'; @Injectable() export class AlbumService { constructor( - @Inject(ALBUM_REPOSITORY) private _albumRepository: IAlbumRepository, - @Inject(ASSET_REPOSITORY) private _assetRepository: IAssetRepository, + @Inject(IAlbumRepository) private _albumRepository: IAlbumRepository, + @Inject(IAssetRepository) private _assetRepository: IAssetRepository, private downloadService: DownloadService, ) {} diff --git a/server/apps/immich/src/api-v1/album/response-dto/album-response.dto.ts b/server/apps/immich/src/api-v1/album/response-dto/album-response.dto.ts index 71d4475430..41279252d5 100644 --- a/server/apps/immich/src/api-v1/album/response-dto/album-response.dto.ts +++ b/server/apps/immich/src/api-v1/album/response-dto/album-response.dto.ts @@ -1,4 +1,4 @@ -import { AlbumEntity } from '../../../../../../libs/database/src/entities/album.entity'; +import { AlbumEntity } from '@app/database'; import { UserResponseDto, mapUser } from '../../user/response-dto/user-response.dto'; import { AssetResponseDto, mapAsset } from '../../asset/response-dto/asset-response.dto'; import { ApiProperty } from '@nestjs/swagger'; diff --git a/server/apps/immich/src/api-v1/asset/asset-repository.ts b/server/apps/immich/src/api-v1/asset/asset-repository.ts index cc2cc0937a..ccc9076073 100644 --- a/server/apps/immich/src/api-v1/asset/asset-repository.ts +++ b/server/apps/immich/src/api-v1/asset/asset-repository.ts @@ -1,6 +1,6 @@ import { SearchPropertiesDto } from './dto/search-properties.dto'; import { CuratedLocationsResponseDto } from './response-dto/curated-locations-response.dto'; -import { AssetEntity, AssetType } from '@app/database/entities/asset.entity'; +import { AssetEntity, AssetType } from '@app/database'; import { BadRequestException, Inject, Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm/repository/Repository'; @@ -14,7 +14,7 @@ import { CheckExistingAssetsDto } from './dto/check-existing-assets.dto'; import { CheckExistingAssetsResponseDto } from './response-dto/check-existing-assets-response.dto'; import { In } from 'typeorm/find-options/operator/In'; import { UpdateAssetDto } from './dto/update-asset.dto'; -import { ITagRepository, TAG_REPOSITORY } from '../tag/tag.repository'; +import { ITagRepository } from '../tag/tag.repository'; import { IsNull } from 'typeorm'; export interface IAssetRepository { @@ -48,7 +48,7 @@ export interface IAssetRepository { countByIdAndUser(assetId: string, userId: string): Promise; } -export const ASSET_REPOSITORY = 'ASSET_REPOSITORY'; +export const IAssetRepository = 'IAssetRepository'; @Injectable() export class AssetRepository implements IAssetRepository { @@ -56,7 +56,7 @@ export class AssetRepository implements IAssetRepository { @InjectRepository(AssetEntity) private assetRepository: Repository, - @Inject(TAG_REPOSITORY) private _tagRepository: ITagRepository, + @Inject(ITagRepository) private _tagRepository: ITagRepository, ) {} async getAssetWithNoSmartInfo(): Promise { diff --git a/server/apps/immich/src/api-v1/asset/asset.module.ts b/server/apps/immich/src/api-v1/asset/asset.module.ts index b0d6d1775d..6833d3e2e1 100644 --- a/server/apps/immich/src/api-v1/asset/asset.module.ts +++ b/server/apps/immich/src/api-v1/asset/asset.module.ts @@ -2,12 +2,12 @@ import { forwardRef, Module } from '@nestjs/common'; import { AssetService } from './asset.service'; import { AssetController } from './asset.controller'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { AssetEntity } from '@app/database/entities/asset.entity'; +import { AssetEntity } from '@app/database'; import { BullModule } from '@nestjs/bull'; import { BackgroundTaskModule } from '../../modules/background-task/background-task.module'; import { BackgroundTaskService } from '../../modules/background-task/background-task.service'; import { CommunicationModule } from '../communication/communication.module'; -import { AssetRepository, ASSET_REPOSITORY } from './asset-repository'; +import { AssetRepository, IAssetRepository } from './asset-repository'; import { DownloadModule } from '../../modules/download/download.module'; import { TagModule } from '../tag/tag.module'; import { AlbumModule } from '../album/album.module'; @@ -16,7 +16,7 @@ import { StorageModule } from '@app/storage'; import { immichSharedQueues } from '@app/job/constants/bull-queue-registration.constant'; const ASSET_REPOSITORY_PROVIDER = { - provide: ASSET_REPOSITORY, + provide: IAssetRepository, useClass: AssetRepository, }; diff --git a/server/apps/immich/src/api-v1/asset/asset.service.spec.ts b/server/apps/immich/src/api-v1/asset/asset.service.spec.ts index 6608246f88..c709f53a94 100644 --- a/server/apps/immich/src/api-v1/asset/asset.service.spec.ts +++ b/server/apps/immich/src/api-v1/asset/asset.service.spec.ts @@ -2,7 +2,7 @@ import { IAssetRepository } from './asset-repository'; import { AuthUserDto } from '../../decorators/auth-user.decorator'; import { AssetService } from './asset.service'; import { Repository } from 'typeorm'; -import { AssetEntity, AssetType } from '@app/database/entities/asset.entity'; +import { AssetEntity, AssetType } from '@app/database'; import { CreateAssetDto } from './dto/create-asset.dto'; import { AssetCountByTimeBucket } from './response-dto/asset-count-by-time-group-response.dto'; import { TimeGroupEnum } from './dto/get-asset-count-by-time-bucket.dto'; diff --git a/server/apps/immich/src/api-v1/asset/asset.service.ts b/server/apps/immich/src/api-v1/asset/asset.service.ts index b0f9b39f36..33334bd2d1 100644 --- a/server/apps/immich/src/api-v1/asset/asset.service.ts +++ b/server/apps/immich/src/api-v1/asset/asset.service.ts @@ -13,7 +13,7 @@ import { InjectRepository } from '@nestjs/typeorm'; import { createHash, randomUUID } from 'node:crypto'; import { QueryFailedError, Repository } from 'typeorm'; import { AuthUserDto } from '../../decorators/auth-user.decorator'; -import { AssetEntity, AssetType } from '@app/database/entities/asset.entity'; +import { AssetEntity, AssetType } from '@app/database'; import { constants, createReadStream, ReadStream, stat } from 'fs'; import { ServeFileDto } from './dto/serve-file.dto'; import { Response as Res } from 'express'; @@ -28,7 +28,7 @@ import { CreateAssetDto } from './dto/create-asset.dto'; import { DeleteAssetResponseDto, DeleteAssetStatusEnum } from './response-dto/delete-asset-response.dto'; import { GetAssetThumbnailDto, GetAssetThumbnailFormatEnum } from './dto/get-asset-thumbnail.dto'; import { CheckDuplicateAssetResponseDto } from './response-dto/check-duplicate-asset-response.dto'; -import { ASSET_REPOSITORY, IAssetRepository } from './asset-repository'; +import { IAssetRepository } from './asset-repository'; import { SearchPropertiesDto } from './dto/search-properties.dto'; import { AssetCountByTimeBucketResponseDto, @@ -54,7 +54,7 @@ import { InjectQueue } from '@nestjs/bull'; import { Queue } from 'bull'; import { DownloadService } from '../../modules/download/download.service'; import { DownloadDto } from './dto/download-library.dto'; -import { ALBUM_REPOSITORY, IAlbumRepository } from '../album/album-repository'; +import { IAlbumRepository } from '../album/album-repository'; import { StorageService } from '@app/storage'; const fileInfo = promisify(stat); @@ -62,11 +62,9 @@ const fileInfo = promisify(stat); @Injectable() export class AssetService { constructor( - @Inject(ASSET_REPOSITORY) - private _assetRepository: IAssetRepository, + @Inject(IAssetRepository) private _assetRepository: IAssetRepository, - @Inject(ALBUM_REPOSITORY) - private _albumRepository: IAlbumRepository, + @Inject(IAlbumRepository) private _albumRepository: IAlbumRepository, @InjectRepository(AssetEntity) private assetRepository: Repository, diff --git a/server/apps/immich/src/api-v1/asset/dto/create-asset.dto.ts b/server/apps/immich/src/api-v1/asset/dto/create-asset.dto.ts index 7a5bcd3c09..401a0c48a8 100644 --- a/server/apps/immich/src/api-v1/asset/dto/create-asset.dto.ts +++ b/server/apps/immich/src/api-v1/asset/dto/create-asset.dto.ts @@ -1,5 +1,5 @@ import { IsNotEmpty, IsOptional } from 'class-validator'; -import { AssetType } from '@app/database/entities/asset.entity'; +import { AssetType } from '@app/database'; import { ApiProperty } from '@nestjs/swagger'; export class CreateAssetDto { diff --git a/server/apps/immich/src/api-v1/asset/response-dto/asset-response.dto.ts b/server/apps/immich/src/api-v1/asset/response-dto/asset-response.dto.ts index 840d47c274..481516a344 100644 --- a/server/apps/immich/src/api-v1/asset/response-dto/asset-response.dto.ts +++ b/server/apps/immich/src/api-v1/asset/response-dto/asset-response.dto.ts @@ -1,4 +1,4 @@ -import { AssetEntity, AssetType } from '@app/database/entities/asset.entity'; +import { AssetEntity, AssetType } from '@app/database'; import { ApiProperty } from '@nestjs/swagger'; import { mapTag, TagResponseDto } from '../../tag/response-dto/tag-response.dto'; import { ExifResponseDto, mapExif } from './exif-response.dto'; diff --git a/server/apps/immich/src/api-v1/asset/response-dto/exif-response.dto.ts b/server/apps/immich/src/api-v1/asset/response-dto/exif-response.dto.ts index ff86716eca..92d209fecb 100644 --- a/server/apps/immich/src/api-v1/asset/response-dto/exif-response.dto.ts +++ b/server/apps/immich/src/api-v1/asset/response-dto/exif-response.dto.ts @@ -1,4 +1,4 @@ -import { ExifEntity } from '@app/database/entities/exif.entity'; +import { ExifEntity } from '@app/database'; import { ApiProperty } from '@nestjs/swagger'; export class ExifResponseDto { diff --git a/server/apps/immich/src/api-v1/asset/response-dto/smart-info-response.dto.ts b/server/apps/immich/src/api-v1/asset/response-dto/smart-info-response.dto.ts index cc9f3118e1..e27b5e5cb2 100644 --- a/server/apps/immich/src/api-v1/asset/response-dto/smart-info-response.dto.ts +++ b/server/apps/immich/src/api-v1/asset/response-dto/smart-info-response.dto.ts @@ -1,4 +1,4 @@ -import { SmartInfoEntity } from '@app/database/entities/smart-info.entity'; +import { SmartInfoEntity } from '@app/database'; export class SmartInfoResponseDto { id?: string; diff --git a/server/apps/immich/src/api-v1/auth/auth.service.spec.ts b/server/apps/immich/src/api-v1/auth/auth.service.spec.ts index 1a3a5a70ea..b84420d1b2 100644 --- a/server/apps/immich/src/api-v1/auth/auth.service.spec.ts +++ b/server/apps/immich/src/api-v1/auth/auth.service.spec.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; import { BadRequestException, UnauthorizedException } from '@nestjs/common'; import * as bcrypt from 'bcrypt'; import { AuthType } from '../../constants/jwt.constant'; diff --git a/server/apps/immich/src/api-v1/auth/auth.service.ts b/server/apps/immich/src/api-v1/auth/auth.service.ts index 307913257a..6a671decb9 100644 --- a/server/apps/immich/src/api-v1/auth/auth.service.ts +++ b/server/apps/immich/src/api-v1/auth/auth.service.ts @@ -7,11 +7,11 @@ import { UnauthorizedException, } from '@nestjs/common'; import * as bcrypt from 'bcrypt'; -import { UserEntity } from '../../../../../libs/database/src/entities/user.entity'; +import { UserEntity } from '@app/database'; import { AuthType } from '../../constants/jwt.constant'; import { AuthUserDto } from '../../decorators/auth-user.decorator'; import { ImmichJwtService } from '../../modules/immich-jwt/immich-jwt.service'; -import { IUserRepository, USER_REPOSITORY } from '../user/user-repository'; +import { IUserRepository } from '../user/user-repository'; import { ChangePasswordDto } from './dto/change-password.dto'; import { LoginCredentialDto } from './dto/login-credential.dto'; import { SignUpDto } from './dto/sign-up.dto'; @@ -29,7 +29,7 @@ export class AuthService { constructor( private oauthService: OAuthService, private immichJwtService: ImmichJwtService, - @Inject(USER_REPOSITORY) userRepository: IUserRepository, + @Inject(IUserRepository) userRepository: IUserRepository, ) { this.userCore = new UserCore(userRepository); } diff --git a/server/apps/immich/src/api-v1/auth/response-dto/admin-signup-response.dto.ts b/server/apps/immich/src/api-v1/auth/response-dto/admin-signup-response.dto.ts index 994846d9da..0288400d55 100644 --- a/server/apps/immich/src/api-v1/auth/response-dto/admin-signup-response.dto.ts +++ b/server/apps/immich/src/api-v1/auth/response-dto/admin-signup-response.dto.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; export class AdminSignupResponseDto { id!: string; diff --git a/server/apps/immich/src/api-v1/auth/response-dto/login-response.dto.ts b/server/apps/immich/src/api-v1/auth/response-dto/login-response.dto.ts index 915a83793e..ea80cfde25 100644 --- a/server/apps/immich/src/api-v1/auth/response-dto/login-response.dto.ts +++ b/server/apps/immich/src/api-v1/auth/response-dto/login-response.dto.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; import { ApiResponseProperty } from '@nestjs/swagger'; export class LoginResponseDto { diff --git a/server/apps/immich/src/api-v1/communication/communication.gateway.ts b/server/apps/immich/src/api-v1/communication/communication.gateway.ts index b0babadfdd..9915cf7c0c 100644 --- a/server/apps/immich/src/api-v1/communication/communication.gateway.ts +++ b/server/apps/immich/src/api-v1/communication/communication.gateway.ts @@ -3,7 +3,7 @@ import { Socket, Server } from 'socket.io'; import { ImmichJwtService, JwtValidationResult } from '../../modules/immich-jwt/immich-jwt.service'; import { Logger } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; import { Repository } from 'typeorm'; import cookieParser from 'cookie'; import { IMMICH_ACCESS_COOKIE } from '../../constants/jwt.constant'; diff --git a/server/apps/immich/src/api-v1/communication/communication.module.ts b/server/apps/immich/src/api-v1/communication/communication.module.ts index 95d0360c34..b93ee0cdc6 100644 --- a/server/apps/immich/src/api-v1/communication/communication.module.ts +++ b/server/apps/immich/src/api-v1/communication/communication.module.ts @@ -6,7 +6,7 @@ import { ImmichJwtService } from '../../modules/immich-jwt/immich-jwt.service'; import { JwtModule } from '@nestjs/jwt'; import { jwtConfig } from '../../config/jwt.config'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; @Module({ imports: [TypeOrmModule.forFeature([UserEntity]), ImmichJwtModule, JwtModule.register(jwtConfig)], diff --git a/server/apps/immich/src/api-v1/device-info/device-info.module.ts b/server/apps/immich/src/api-v1/device-info/device-info.module.ts index 59a129f667..c6c0db084a 100644 --- a/server/apps/immich/src/api-v1/device-info/device-info.module.ts +++ b/server/apps/immich/src/api-v1/device-info/device-info.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { DeviceInfoService } from './device-info.service'; import { DeviceInfoController } from './device-info.controller'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { DeviceInfoEntity } from '@app/database/entities/device-info.entity'; +import { DeviceInfoEntity } from '@app/database'; @Module({ imports: [TypeOrmModule.forFeature([DeviceInfoEntity])], diff --git a/server/apps/immich/src/api-v1/device-info/device-info.service.spec.ts b/server/apps/immich/src/api-v1/device-info/device-info.service.spec.ts index 60f39c2a4c..be9ea3a4c3 100644 --- a/server/apps/immich/src/api-v1/device-info/device-info.service.spec.ts +++ b/server/apps/immich/src/api-v1/device-info/device-info.service.spec.ts @@ -1,4 +1,4 @@ -import { DeviceInfoEntity, DeviceType } from '@app/database/entities/device-info.entity'; +import { DeviceInfoEntity, DeviceType } from '@app/database'; import { Repository } from 'typeorm'; import { DeviceInfoService } from './device-info.service'; diff --git a/server/apps/immich/src/api-v1/device-info/device-info.service.ts b/server/apps/immich/src/api-v1/device-info/device-info.service.ts index 297224e976..ff9243afb6 100644 --- a/server/apps/immich/src/api-v1/device-info/device-info.service.ts +++ b/server/apps/immich/src/api-v1/device-info/device-info.service.ts @@ -1,4 +1,4 @@ -import { DeviceInfoEntity } from '@app/database/entities/device-info.entity'; +import { DeviceInfoEntity } from '@app/database'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; diff --git a/server/apps/immich/src/api-v1/device-info/dto/upsert-device-info.dto.ts b/server/apps/immich/src/api-v1/device-info/dto/upsert-device-info.dto.ts index e4233bc450..9d39e88838 100644 --- a/server/apps/immich/src/api-v1/device-info/dto/upsert-device-info.dto.ts +++ b/server/apps/immich/src/api-v1/device-info/dto/upsert-device-info.dto.ts @@ -1,5 +1,5 @@ import { IsNotEmpty, IsOptional } from 'class-validator'; -import { DeviceType } from '@app/database/entities/device-info.entity'; +import { DeviceType } from '@app/database'; import { ApiProperty } from '@nestjs/swagger'; export class UpsertDeviceInfoDto { diff --git a/server/apps/immich/src/api-v1/device-info/response-dto/device-info-response.dto.ts b/server/apps/immich/src/api-v1/device-info/response-dto/device-info-response.dto.ts index 5c1bcfadf9..555049958d 100644 --- a/server/apps/immich/src/api-v1/device-info/response-dto/device-info-response.dto.ts +++ b/server/apps/immich/src/api-v1/device-info/response-dto/device-info-response.dto.ts @@ -1,4 +1,4 @@ -import { DeviceInfoEntity, DeviceType } from '@app/database/entities/device-info.entity'; +import { DeviceInfoEntity, DeviceType } from '@app/database'; import { ApiProperty } from '@nestjs/swagger'; export class DeviceInfoResponseDto { diff --git a/server/apps/immich/src/api-v1/job/job.module.ts b/server/apps/immich/src/api-v1/job/job.module.ts index 41a0b9d7d3..9e070fc8c1 100644 --- a/server/apps/immich/src/api-v1/job/job.module.ts +++ b/server/apps/immich/src/api-v1/job/job.module.ts @@ -6,7 +6,7 @@ import { ImmichJwtModule } from '../../modules/immich-jwt/immich-jwt.module'; import { JwtModule } from '@nestjs/jwt'; import { jwtConfig } from '../../config/jwt.config'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { ExifEntity } from '@app/database/entities/exif.entity'; +import { ExifEntity } from '@app/database'; import { TagModule } from '../tag/tag.module'; import { AssetModule } from '../asset/asset.module'; import { UserModule } from '../user/user.module'; diff --git a/server/apps/immich/src/api-v1/job/job.service.ts b/server/apps/immich/src/api-v1/job/job.service.ts index 7b61d34a9e..421569dd34 100644 --- a/server/apps/immich/src/api-v1/job/job.service.ts +++ b/server/apps/immich/src/api-v1/job/job.service.ts @@ -14,8 +14,8 @@ import { Queue } from 'bull'; import { BadRequestException, Inject, Injectable } from '@nestjs/common'; import { AllJobStatusResponseDto } from './response-dto/all-job-status-response.dto'; import { randomUUID } from 'crypto'; -import { ASSET_REPOSITORY, IAssetRepository } from '../asset/asset-repository'; -import { AssetType } from '@app/database/entities/asset.entity'; +import { IAssetRepository } from '../asset/asset-repository'; +import { AssetType } from '@app/database'; import { GetJobDto, JobId } from './dto/get-job.dto'; import { JobStatusResponseDto } from './response-dto/job-status-response.dto'; import { IMachineLearningJob } from '@app/job/interfaces/machine-learning.interface'; @@ -39,7 +39,7 @@ export class JobService { @InjectQueue(QueueNameEnum.STORAGE_MIGRATION) private storageMigrationQueue: Queue, - @Inject(ASSET_REPOSITORY) + @Inject(IAssetRepository) private _assetRepository: IAssetRepository, private storageService: StorageService, diff --git a/server/apps/immich/src/api-v1/oauth/oauth.service.spec.ts b/server/apps/immich/src/api-v1/oauth/oauth.service.spec.ts index c222bfebcc..1e931a80ac 100644 --- a/server/apps/immich/src/api-v1/oauth/oauth.service.spec.ts +++ b/server/apps/immich/src/api-v1/oauth/oauth.service.spec.ts @@ -1,5 +1,4 @@ -import { SystemConfig } from '@app/database/entities/system-config.entity'; -import { UserEntity } from '@app/database/entities/user.entity'; +import { SystemConfig, UserEntity } from '@app/database'; import { ImmichConfigService } from '@app/immich-config'; import { BadRequestException } from '@nestjs/common'; import { generators, Issuer } from 'openid-client'; diff --git a/server/apps/immich/src/api-v1/oauth/oauth.service.ts b/server/apps/immich/src/api-v1/oauth/oauth.service.ts index 892f877533..8c62f8f623 100644 --- a/server/apps/immich/src/api-v1/oauth/oauth.service.ts +++ b/server/apps/immich/src/api-v1/oauth/oauth.service.ts @@ -6,7 +6,7 @@ import { AuthUserDto } from '../../decorators/auth-user.decorator'; import { ImmichJwtService } from '../../modules/immich-jwt/immich-jwt.service'; import { LoginResponseDto } from '../auth/response-dto/login-response.dto'; import { UserResponseDto } from '../user/response-dto/user-response.dto'; -import { IUserRepository, USER_REPOSITORY } from '../user/user-repository'; +import { IUserRepository } from '../user/user-repository'; import { UserCore } from '../user/user.core'; import { OAuthCallbackDto } from './dto/oauth-auth-code.dto'; import { OAuthConfigDto } from './dto/oauth-config.dto'; @@ -26,7 +26,7 @@ export class OAuthService { constructor( private immichJwtService: ImmichJwtService, immichConfigService: ImmichConfigService, - @Inject(USER_REPOSITORY) userRepository: IUserRepository, + @Inject(IUserRepository) userRepository: IUserRepository, @Inject(INITIAL_SYSTEM_CONFIG) private config: SystemConfig, ) { this.userCore = new UserCore(userRepository); diff --git a/server/apps/immich/src/api-v1/server-info/server-info.module.ts b/server/apps/immich/src/api-v1/server-info/server-info.module.ts index 3e7f6a5df3..897b787bab 100644 --- a/server/apps/immich/src/api-v1/server-info/server-info.module.ts +++ b/server/apps/immich/src/api-v1/server-info/server-info.module.ts @@ -1,10 +1,9 @@ import { Module } from '@nestjs/common'; import { ServerInfoService } from './server-info.service'; import { ServerInfoController } from './server-info.controller'; -import { AssetEntity } from '@app/database/entities/asset.entity'; +import { AssetEntity, UserEntity } from '@app/database'; import { TypeOrmModule } from '@nestjs/typeorm'; import { ImmichJwtModule } from '../../modules/immich-jwt/immich-jwt.module'; -import { UserEntity } from '@app/database/entities/user.entity'; @Module({ imports: [TypeOrmModule.forFeature([AssetEntity, UserEntity]), ImmichJwtModule], diff --git a/server/apps/immich/src/api-v1/server-info/server-info.service.ts b/server/apps/immich/src/api-v1/server-info/server-info.service.ts index db85a7038f..b8c9ea17b4 100644 --- a/server/apps/immich/src/api-v1/server-info/server-info.service.ts +++ b/server/apps/immich/src/api-v1/server-info/server-info.service.ts @@ -4,7 +4,7 @@ import { ServerInfoResponseDto } from './response-dto/server-info-response.dto'; import diskusage from 'diskusage'; import { ServerStatsResponseDto } from './response-dto/server-stats-response.dto'; import { UsageByUserDto } from './response-dto/usage-by-user-response.dto'; -import { AssetEntity } from '@app/database/entities/asset.entity'; +import { AssetEntity } from '@app/database'; import { Repository } from 'typeorm'; import { InjectRepository } from '@nestjs/typeorm'; import { asHumanReadable } from '../../utils/human-readable.util'; diff --git a/server/apps/immich/src/api-v1/system-config/dto/system-config.dto.ts b/server/apps/immich/src/api-v1/system-config/dto/system-config.dto.ts index 72e1356ba4..498d1e7b5b 100644 --- a/server/apps/immich/src/api-v1/system-config/dto/system-config.dto.ts +++ b/server/apps/immich/src/api-v1/system-config/dto/system-config.dto.ts @@ -1,4 +1,4 @@ -import { SystemConfig } from '@app/database/entities/system-config.entity'; +import { SystemConfig } from '@app/database'; import { ValidateNested } from 'class-validator'; import { SystemConfigFFmpegDto } from './system-config-ffmpeg.dto'; import { SystemConfigOAuthDto } from './system-config-oauth.dto'; diff --git a/server/apps/immich/src/api-v1/system-config/system-config.module.ts b/server/apps/immich/src/api-v1/system-config/system-config.module.ts index 3fd920156e..daf851f1b4 100644 --- a/server/apps/immich/src/api-v1/system-config/system-config.module.ts +++ b/server/apps/immich/src/api-v1/system-config/system-config.module.ts @@ -1,4 +1,4 @@ -import { SystemConfigEntity } from '@app/database/entities/system-config.entity'; +import { SystemConfigEntity } from '@app/database'; import { immichSharedQueues } from '@app/job/constants/bull-queue-registration.constant'; import { BullModule } from '@nestjs/bull'; import { Module } from '@nestjs/common'; diff --git a/server/apps/immich/src/api-v1/tag/dto/create-tag.dto.ts b/server/apps/immich/src/api-v1/tag/dto/create-tag.dto.ts index 3c3859291d..625d8ea1e9 100644 --- a/server/apps/immich/src/api-v1/tag/dto/create-tag.dto.ts +++ b/server/apps/immich/src/api-v1/tag/dto/create-tag.dto.ts @@ -1,4 +1,4 @@ -import { TagType } from '@app/database/entities/tag.entity'; +import { TagType } from '@app/database'; import { ApiProperty } from '@nestjs/swagger'; import { IsEnum, IsNotEmpty, IsString } from 'class-validator'; diff --git a/server/apps/immich/src/api-v1/tag/response-dto/tag-response.dto.ts b/server/apps/immich/src/api-v1/tag/response-dto/tag-response.dto.ts index dffb487356..e0629559ba 100644 --- a/server/apps/immich/src/api-v1/tag/response-dto/tag-response.dto.ts +++ b/server/apps/immich/src/api-v1/tag/response-dto/tag-response.dto.ts @@ -1,4 +1,4 @@ -import { TagEntity, TagType } from '@app/database/entities/tag.entity'; +import { TagEntity, TagType } from '@app/database'; import { ApiProperty } from '@nestjs/swagger'; export class TagResponseDto { diff --git a/server/apps/immich/src/api-v1/tag/tag.module.ts b/server/apps/immich/src/api-v1/tag/tag.module.ts index 5a9db11e78..d5cfccfd51 100644 --- a/server/apps/immich/src/api-v1/tag/tag.module.ts +++ b/server/apps/immich/src/api-v1/tag/tag.module.ts @@ -1,12 +1,12 @@ import { Module } from '@nestjs/common'; import { TagService } from './tag.service'; import { TagController } from './tag.controller'; -import { TagEntity } from '@app/database/entities/tag.entity'; +import { TagEntity } from '@app/database'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { TagRepository, TAG_REPOSITORY } from './tag.repository'; +import { TagRepository, ITagRepository } from './tag.repository'; const TAG_REPOSITORY_PROVIDER = { - provide: TAG_REPOSITORY, + provide: ITagRepository, useClass: TagRepository, }; @Module({ diff --git a/server/apps/immich/src/api-v1/tag/tag.repository.ts b/server/apps/immich/src/api-v1/tag/tag.repository.ts index a1a383aecd..716f59b793 100644 --- a/server/apps/immich/src/api-v1/tag/tag.repository.ts +++ b/server/apps/immich/src/api-v1/tag/tag.repository.ts @@ -1,4 +1,4 @@ -import { TagEntity, TagType } from '@app/database/entities/tag.entity'; +import { TagEntity, TagType } from '@app/database'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { In, Repository } from 'typeorm'; @@ -13,7 +13,7 @@ export interface ITagRepository { remove(tag: TagEntity): Promise; } -export const TAG_REPOSITORY = 'TAG_REPOSITORY'; +export const ITagRepository = 'ITagRepository'; @Injectable() export class TagRepository implements ITagRepository { diff --git a/server/apps/immich/src/api-v1/tag/tag.service.spec.ts b/server/apps/immich/src/api-v1/tag/tag.service.spec.ts index 78278a8de2..872742f3d6 100644 --- a/server/apps/immich/src/api-v1/tag/tag.service.spec.ts +++ b/server/apps/immich/src/api-v1/tag/tag.service.spec.ts @@ -1,5 +1,4 @@ -import { TagEntity, TagType } from '@app/database/entities/tag.entity'; -import { UserEntity } from '@app/database/entities/user.entity'; +import { TagEntity, TagType, UserEntity } from '@app/database'; import { AuthUserDto } from '../../decorators/auth-user.decorator'; import { ITagRepository } from './tag.repository'; import { TagService } from './tag.service'; diff --git a/server/apps/immich/src/api-v1/tag/tag.service.ts b/server/apps/immich/src/api-v1/tag/tag.service.ts index dc8c5a166d..596a76f5f3 100644 --- a/server/apps/immich/src/api-v1/tag/tag.service.ts +++ b/server/apps/immich/src/api-v1/tag/tag.service.ts @@ -1,16 +1,16 @@ -import { TagEntity } from '@app/database/entities/tag.entity'; +import { TagEntity } from '@app/database'; import { BadRequestException, Inject, Injectable, Logger } from '@nestjs/common'; import { AuthUserDto } from '../../decorators/auth-user.decorator'; import { CreateTagDto } from './dto/create-tag.dto'; import { UpdateTagDto } from './dto/update-tag.dto'; -import { ITagRepository, TAG_REPOSITORY } from './tag.repository'; -import { mapTag, TagResponseDto } from "./response-dto/tag-response.dto"; +import { ITagRepository } from './tag.repository'; +import { mapTag, TagResponseDto } from './response-dto/tag-response.dto'; @Injectable() export class TagService { readonly logger = new Logger(TagService.name); - constructor(@Inject(TAG_REPOSITORY) private _tagRepository: ITagRepository) {} + constructor(@Inject(ITagRepository) private _tagRepository: ITagRepository) {} async create(authUser: AuthUserDto, createTagDto: CreateTagDto) { try { @@ -37,7 +37,7 @@ export class TagService { return tag; } - async update(authUser: AuthUserDto, id: string, updateTagDto: UpdateTagDto): Promise { + async update(authUser: AuthUserDto, id: string, updateTagDto: UpdateTagDto): Promise { const tag = await this.findOne(authUser, id); await this._tagRepository.update(tag, updateTagDto); diff --git a/server/apps/immich/src/api-v1/user/response-dto/user-response.dto.ts b/server/apps/immich/src/api-v1/user/response-dto/user-response.dto.ts index 502387b6ab..6e11f78a20 100644 --- a/server/apps/immich/src/api-v1/user/response-dto/user-response.dto.ts +++ b/server/apps/immich/src/api-v1/user/response-dto/user-response.dto.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; export class UserResponseDto { id!: string; diff --git a/server/apps/immich/src/api-v1/user/user-repository.ts b/server/apps/immich/src/api-v1/user/user-repository.ts index 44017ff749..6bae12b061 100644 --- a/server/apps/immich/src/api-v1/user/user-repository.ts +++ b/server/apps/immich/src/api-v1/user/user-repository.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; import { InternalServerErrorException } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Not, Repository } from 'typeorm'; @@ -19,7 +19,7 @@ export interface UserListFilter { excludeId?: string; } -export const USER_REPOSITORY = 'USER_REPOSITORY'; +export const IUserRepository = 'IUserRepository'; export class UserRepository implements IUserRepository { constructor( diff --git a/server/apps/immich/src/api-v1/user/user.core.ts b/server/apps/immich/src/api-v1/user/user.core.ts index c2d99aedb4..df58041849 100644 --- a/server/apps/immich/src/api-v1/user/user.core.ts +++ b/server/apps/immich/src/api-v1/user/user.core.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; import { BadRequestException, ForbiddenException, diff --git a/server/apps/immich/src/api-v1/user/user.module.ts b/server/apps/immich/src/api-v1/user/user.module.ts index 93c83bc196..388a38667d 100644 --- a/server/apps/immich/src/api-v1/user/user.module.ts +++ b/server/apps/immich/src/api-v1/user/user.module.ts @@ -1,16 +1,16 @@ -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; import { Module } from '@nestjs/common'; import { JwtModule } from '@nestjs/jwt'; import { TypeOrmModule } from '@nestjs/typeorm'; import { jwtConfig } from '../../config/jwt.config'; import { ImmichJwtModule } from '../../modules/immich-jwt/immich-jwt.module'; import { ImmichJwtService } from '../../modules/immich-jwt/immich-jwt.service'; -import { UserRepository, USER_REPOSITORY } from './user-repository'; +import { UserRepository, IUserRepository } from './user-repository'; import { UserController } from './user.controller'; import { UserService } from './user.service'; const USER_REPOSITORY_PROVIDER = { - provide: USER_REPOSITORY, + provide: IUserRepository, useClass: UserRepository, }; diff --git a/server/apps/immich/src/api-v1/user/user.service.spec.ts b/server/apps/immich/src/api-v1/user/user.service.spec.ts index b7e76be43f..d7c8d6bd1f 100644 --- a/server/apps/immich/src/api-v1/user/user.service.spec.ts +++ b/server/apps/immich/src/api-v1/user/user.service.spec.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; import { BadRequestException, ForbiddenException, NotFoundException } from '@nestjs/common'; import { newUserRepositoryMock } from '../../../test/test-utils'; import { AuthUserDto } from '../../decorators/auth-user.decorator'; diff --git a/server/apps/immich/src/api-v1/user/user.service.ts b/server/apps/immich/src/api-v1/user/user.service.ts index 559c1e42c9..b9a9bcd828 100644 --- a/server/apps/immich/src/api-v1/user/user.service.ts +++ b/server/apps/immich/src/api-v1/user/user.service.ts @@ -10,16 +10,13 @@ import { } from './response-dto/create-profile-image-response.dto'; import { mapUserCountResponse, UserCountResponseDto } from './response-dto/user-count-response.dto'; import { mapUser, UserResponseDto } from './response-dto/user-response.dto'; -import { IUserRepository, USER_REPOSITORY } from './user-repository'; +import { IUserRepository } from './user-repository'; import { UserCore } from './user.core'; @Injectable() export class UserService { private userCore: UserCore; - constructor( - @Inject(USER_REPOSITORY) - userRepository: IUserRepository, - ) { + constructor(@Inject(IUserRepository) userRepository: IUserRepository) { this.userCore = new UserCore(userRepository); } diff --git a/server/apps/immich/src/decorators/auth-user.decorator.ts b/server/apps/immich/src/decorators/auth-user.decorator.ts index e599b33310..023cab7ea1 100644 --- a/server/apps/immich/src/decorators/auth-user.decorator.ts +++ b/server/apps/immich/src/decorators/auth-user.decorator.ts @@ -1,5 +1,5 @@ import { createParamDecorator, ExecutionContext } from '@nestjs/common'; -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; // import { AuthUserDto } from './dto/auth-user.dto'; export class AuthUserDto { diff --git a/server/apps/immich/src/modules/background-task/background-task.module.ts b/server/apps/immich/src/modules/background-task/background-task.module.ts index 6ebeead9f3..c418dd634f 100644 --- a/server/apps/immich/src/modules/background-task/background-task.module.ts +++ b/server/apps/immich/src/modules/background-task/background-task.module.ts @@ -1,9 +1,7 @@ import { BullModule } from '@nestjs/bull'; import { Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { AssetEntity } from '@app/database/entities/asset.entity'; -import { ExifEntity } from '@app/database/entities/exif.entity'; -import { SmartInfoEntity } from '@app/database/entities/smart-info.entity'; +import { AssetEntity, ExifEntity, SmartInfoEntity } from '@app/database'; import { BackgroundTaskProcessor } from './background-task.processor'; import { BackgroundTaskService } from './background-task.service'; diff --git a/server/apps/immich/src/modules/background-task/background-task.processor.ts b/server/apps/immich/src/modules/background-task/background-task.processor.ts index 01cdfb7864..3d4278de19 100644 --- a/server/apps/immich/src/modules/background-task/background-task.processor.ts +++ b/server/apps/immich/src/modules/background-task/background-task.processor.ts @@ -1,8 +1,7 @@ import { Process, Processor } from '@nestjs/bull'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; -import { AssetEntity } from '@app/database/entities/asset.entity'; -import { SmartInfoEntity } from '@app/database/entities/smart-info.entity'; +import { AssetEntity, SmartInfoEntity } from '@app/database'; import { Job } from 'bull'; import { AssetResponseDto } from '../../api-v1/asset/response-dto/asset-response.dto'; import { assetUtils } from '@app/common/utils'; diff --git a/server/apps/immich/src/modules/download/download.service.ts b/server/apps/immich/src/modules/download/download.service.ts index 0c47cce429..168d5aff3f 100644 --- a/server/apps/immich/src/modules/download/download.service.ts +++ b/server/apps/immich/src/modules/download/download.service.ts @@ -1,4 +1,4 @@ -import { AssetEntity } from '@app/database/entities/asset.entity'; +import { AssetEntity } from '@app/database'; import { BadRequestException, Injectable, InternalServerErrorException, Logger, StreamableFile } from '@nestjs/common'; import archiver from 'archiver'; import { extname } from 'path'; diff --git a/server/apps/immich/src/modules/immich-jwt/immich-jwt.module.ts b/server/apps/immich/src/modules/immich-jwt/immich-jwt.module.ts index d7835d277c..aabfd650db 100644 --- a/server/apps/immich/src/modules/immich-jwt/immich-jwt.module.ts +++ b/server/apps/immich/src/modules/immich-jwt/immich-jwt.module.ts @@ -4,7 +4,7 @@ import { JwtModule } from '@nestjs/jwt'; import { jwtConfig } from '../../config/jwt.config'; import { JwtStrategy } from './strategies/jwt.strategy'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; @Module({ imports: [JwtModule.register(jwtConfig), TypeOrmModule.forFeature([UserEntity])], diff --git a/server/apps/immich/src/modules/immich-jwt/immich-jwt.service.ts b/server/apps/immich/src/modules/immich-jwt/immich-jwt.service.ts index 4a2dc5408a..3b3c010bd6 100644 --- a/server/apps/immich/src/modules/immich-jwt/immich-jwt.service.ts +++ b/server/apps/immich/src/modules/immich-jwt/immich-jwt.service.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; import { Injectable, Logger } from '@nestjs/common'; import { JwtService } from '@nestjs/jwt'; import { Request } from 'express'; diff --git a/server/apps/immich/src/modules/immich-jwt/strategies/jwt.strategy.ts b/server/apps/immich/src/modules/immich-jwt/strategies/jwt.strategy.ts index a9d7d35f45..50d99852d9 100644 --- a/server/apps/immich/src/modules/immich-jwt/strategies/jwt.strategy.ts +++ b/server/apps/immich/src/modules/immich-jwt/strategies/jwt.strategy.ts @@ -4,7 +4,7 @@ import { InjectRepository } from '@nestjs/typeorm'; import { ExtractJwt, Strategy } from 'passport-jwt'; import { Repository } from 'typeorm'; import { JwtPayloadDto } from '../../../api-v1/auth/dto/jwt-payload.dto'; -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; import { jwtSecret } from '../../../constants/jwt.constant'; import { ImmichJwtService } from '../immich-jwt.service'; diff --git a/server/apps/immich/src/modules/schedule-tasks/schedule-tasks.module.ts b/server/apps/immich/src/modules/schedule-tasks/schedule-tasks.module.ts index 4139276179..7e4dc13190 100644 --- a/server/apps/immich/src/modules/schedule-tasks/schedule-tasks.module.ts +++ b/server/apps/immich/src/modules/schedule-tasks/schedule-tasks.module.ts @@ -1,10 +1,8 @@ import { BullModule } from '@nestjs/bull'; import { Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { AssetEntity } from '@app/database/entities/asset.entity'; +import { AssetEntity, ExifEntity, UserEntity } from '@app/database'; import { ScheduleTasksService } from './schedule-tasks.service'; -import { ExifEntity } from '@app/database/entities/exif.entity'; -import { UserEntity } from '@app/database/entities/user.entity'; import { immichSharedQueues } from '@app/job/constants/bull-queue-registration.constant'; @Module({ diff --git a/server/apps/immich/src/modules/schedule-tasks/schedule-tasks.service.ts b/server/apps/immich/src/modules/schedule-tasks/schedule-tasks.service.ts index 80e5e9924d..e4ff8011e9 100644 --- a/server/apps/immich/src/modules/schedule-tasks/schedule-tasks.service.ts +++ b/server/apps/immich/src/modules/schedule-tasks/schedule-tasks.service.ts @@ -2,11 +2,10 @@ import { Injectable, Logger } from '@nestjs/common'; import { Cron, CronExpression } from '@nestjs/schedule'; import { InjectRepository } from '@nestjs/typeorm'; import { IsNull, Not, Repository } from 'typeorm'; -import { AssetEntity, AssetType } from '@app/database/entities/asset.entity'; +import { AssetEntity, AssetType, ExifEntity, UserEntity } from '@app/database'; import { InjectQueue } from '@nestjs/bull'; import { Queue } from 'bull'; import { randomUUID } from 'crypto'; -import { ExifEntity } from '@app/database/entities/exif.entity'; import { userDeletionProcessorName, exifExtractionProcessorName, @@ -19,7 +18,6 @@ import { videoMetadataExtractionProcessorName, } from '@app/job'; import { ConfigService } from '@nestjs/config'; -import { UserEntity } from '@app/database/entities/user.entity'; import { IUserDeletionJob } from '@app/job/interfaces/user-deletion.interface'; import { userUtils } from '@app/common'; diff --git a/server/apps/immich/test/album.e2e-spec.ts b/server/apps/immich/test/album.e2e-spec.ts index 62d40692d7..bd712935c0 100644 --- a/server/apps/immich/test/album.e2e-spec.ts +++ b/server/apps/immich/test/album.e2e-spec.ts @@ -3,7 +3,7 @@ import { INestApplication } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; import request from 'supertest'; import { clearDb, getAuthUser, authCustom } from './test-utils'; -import { databaseConfig } from '@app/database/config/database.config'; +import { databaseConfig } from '@app/database'; import { AlbumModule } from '../src/api-v1/album/album.module'; import { CreateAlbumDto } from '../src/api-v1/album/dto/create-album.dto'; import { ImmichJwtModule } from '../src/modules/immich-jwt/immich-jwt.module'; diff --git a/server/apps/microservices/src/microservices.module.ts b/server/apps/microservices/src/microservices.module.ts index e57c7672a9..2b4322d2e3 100644 --- a/server/apps/microservices/src/microservices.module.ts +++ b/server/apps/microservices/src/microservices.module.ts @@ -1,9 +1,5 @@ import { immichAppConfig, immichBullAsyncConfig } from '@app/common/config'; -import { DatabaseModule } from '@app/database'; -import { AssetEntity } from '@app/database/entities/asset.entity'; -import { ExifEntity } from '@app/database/entities/exif.entity'; -import { SmartInfoEntity } from '@app/database/entities/smart-info.entity'; -import { UserEntity } from '@app/database/entities/user.entity'; +import { DatabaseModule, AssetEntity, ExifEntity, SmartInfoEntity, UserEntity } from '@app/database'; import { StorageModule } from '@app/storage'; import { BullModule } from '@nestjs/bull'; import { Module } from '@nestjs/common'; diff --git a/server/apps/microservices/src/processors/asset-uploaded.processor.ts b/server/apps/microservices/src/processors/asset-uploaded.processor.ts index 340d22a06d..f92a2830b7 100644 --- a/server/apps/microservices/src/processors/asset-uploaded.processor.ts +++ b/server/apps/microservices/src/processors/asset-uploaded.processor.ts @@ -1,4 +1,4 @@ -import { AssetType } from '@app/database/entities/asset.entity'; +import { AssetType } from '@app/database'; import { IAssetUploadedJob, IMetadataExtractionJob, diff --git a/server/apps/microservices/src/processors/generate-checksum.processor.ts b/server/apps/microservices/src/processors/generate-checksum.processor.ts index bbf20cccd4..f6c1954ceb 100644 --- a/server/apps/microservices/src/processors/generate-checksum.processor.ts +++ b/server/apps/microservices/src/processors/generate-checksum.processor.ts @@ -1,4 +1,4 @@ -import { AssetEntity } from '@app/database/entities/asset.entity'; +import { AssetEntity } from '@app/database'; import { QueueNameEnum } from '@app/job'; import { Process, Processor } from '@nestjs/bull'; import { Logger } from '@nestjs/common'; diff --git a/server/apps/microservices/src/processors/machine-learning.processor.ts b/server/apps/microservices/src/processors/machine-learning.processor.ts index 6ce5789b04..807d1ad33c 100644 --- a/server/apps/microservices/src/processors/machine-learning.processor.ts +++ b/server/apps/microservices/src/processors/machine-learning.processor.ts @@ -1,5 +1,5 @@ -import { AssetEntity } from '@app/database/entities/asset.entity'; -import { SmartInfoEntity } from '@app/database/entities/smart-info.entity'; +import { AssetEntity } from '@app/database'; +import { SmartInfoEntity } from '@app/database'; import { MachineLearningJobNameEnum, QueueNameEnum } from '@app/job'; import { IMachineLearningJob } from '@app/job/interfaces/machine-learning.interface'; import { Process, Processor } from '@nestjs/bull'; @@ -22,12 +22,9 @@ export class MachineLearningProcessor { async tagImage(job: Job) { const { asset } = job.data; - const res = await axios.post( - immich_machine_learning_url + '/image-classifier/tag-image', - { - thumbnailPath: asset.resizePath, - }, - ); + const res = await axios.post(immich_machine_learning_url + '/image-classifier/tag-image', { + thumbnailPath: asset.resizePath, + }); if (res.status == 201 && res.data.length > 0) { const smartInfo = new SmartInfoEntity(); @@ -45,12 +42,9 @@ export class MachineLearningProcessor { try { const { asset }: { asset: AssetEntity } = job.data; - const res = await axios.post( - immich_machine_learning_url + '/object-detection/detect-object', - { - thumbnailPath: asset.resizePath, - }, - ); + const res = await axios.post(immich_machine_learning_url + '/object-detection/detect-object', { + thumbnailPath: asset.resizePath, + }); if (res.status == 201 && res.data.length > 0) { const smartInfo = new SmartInfoEntity(); diff --git a/server/apps/microservices/src/processors/metadata-extraction.processor.ts b/server/apps/microservices/src/processors/metadata-extraction.processor.ts index b247215d43..ba38800a7b 100644 --- a/server/apps/microservices/src/processors/metadata-extraction.processor.ts +++ b/server/apps/microservices/src/processors/metadata-extraction.processor.ts @@ -1,6 +1,5 @@ import { ImmichLogLevel } from '@app/common/constants/log-level.constant'; -import { AssetEntity } from '@app/database/entities/asset.entity'; -import { ExifEntity } from '@app/database/entities/exif.entity'; +import { AssetEntity, ExifEntity } from '@app/database'; import { IExifExtractionProcessor, IVideoLengthExtractionProcessor, diff --git a/server/apps/microservices/src/processors/storage-migration.processor.ts b/server/apps/microservices/src/processors/storage-migration.processor.ts index 8c913776fa..f5714c1dba 100644 --- a/server/apps/microservices/src/processors/storage-migration.processor.ts +++ b/server/apps/microservices/src/processors/storage-migration.processor.ts @@ -1,5 +1,5 @@ import { APP_UPLOAD_LOCATION } from '@app/common'; -import { AssetEntity } from '@app/database/entities/asset.entity'; +import { AssetEntity } from '@app/database'; import { ImmichConfigService } from '@app/immich-config'; import { QueueNameEnum, templateMigrationProcessorName, updateTemplateProcessorName } from '@app/job'; import { StorageService } from '@app/storage'; diff --git a/server/apps/microservices/src/processors/thumbnail.processor.ts b/server/apps/microservices/src/processors/thumbnail.processor.ts index 3c9236736d..6cafab40bc 100644 --- a/server/apps/microservices/src/processors/thumbnail.processor.ts +++ b/server/apps/microservices/src/processors/thumbnail.processor.ts @@ -1,5 +1,5 @@ import { APP_UPLOAD_LOCATION } from '@app/common'; -import { AssetEntity, AssetType } from '@app/database/entities/asset.entity'; +import { AssetEntity, AssetType } from '@app/database'; import { WebpGeneratorProcessor, generateJPEGThumbnailProcessorName, diff --git a/server/apps/microservices/src/processors/user-deletion.processor.ts b/server/apps/microservices/src/processors/user-deletion.processor.ts index 37719576ec..2462d8978a 100644 --- a/server/apps/microservices/src/processors/user-deletion.processor.ts +++ b/server/apps/microservices/src/processors/user-deletion.processor.ts @@ -1,6 +1,5 @@ import { APP_UPLOAD_LOCATION, userUtils } from '@app/common'; -import { AssetEntity } from '@app/database/entities/asset.entity'; -import { UserEntity } from '@app/database/entities/user.entity'; +import { AssetEntity, UserEntity } from '@app/database'; import { QueueNameEnum, userDeletionProcessorName } from '@app/job'; import { IUserDeletionJob } from '@app/job/interfaces/user-deletion.interface'; import { Process, Processor } from '@nestjs/bull'; diff --git a/server/apps/microservices/src/processors/video-transcode.processor.ts b/server/apps/microservices/src/processors/video-transcode.processor.ts index fc4c3eaf6c..793e68076d 100644 --- a/server/apps/microservices/src/processors/video-transcode.processor.ts +++ b/server/apps/microservices/src/processors/video-transcode.processor.ts @@ -1,5 +1,5 @@ import { APP_UPLOAD_LOCATION } from '@app/common/constants'; -import { AssetEntity } from '@app/database/entities/asset.entity'; +import { AssetEntity } from '@app/database'; import { QueueNameEnum } from '@app/job'; import { mp4ConversionProcessorName } from '@app/job/constants/job-name.constant'; import { IMp4ConversionProcessor } from '@app/job/interfaces/video-transcode.interface'; diff --git a/server/libs/common/src/utils/asset-utils.ts b/server/libs/common/src/utils/asset-utils.ts index 7d590b269e..cebbfad142 100644 --- a/server/libs/common/src/utils/asset-utils.ts +++ b/server/libs/common/src/utils/asset-utils.ts @@ -1,4 +1,4 @@ -import { AssetEntity } from '@app/database/entities/asset.entity'; +import { AssetEntity } from '@app/database'; import { AssetResponseDto } from 'apps/immich/src/api-v1/asset/response-dto/asset-response.dto'; import fs from 'fs'; diff --git a/server/libs/common/src/utils/user-utils.spec.ts b/server/libs/common/src/utils/user-utils.spec.ts index 22252cf937..849b84988c 100644 --- a/server/libs/common/src/utils/user-utils.spec.ts +++ b/server/libs/common/src/utils/user-utils.spec.ts @@ -1,6 +1,6 @@ // create unit test for user utils -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; import { userUtils } from './user-utils'; describe('User Utilities', () => { diff --git a/server/libs/common/src/utils/user-utils.ts b/server/libs/common/src/utils/user-utils.ts index 9046ffa46b..90aa022506 100644 --- a/server/libs/common/src/utils/user-utils.ts +++ b/server/libs/common/src/utils/user-utils.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; function createUserUtils() { const isReadyForDeletion = (user: UserEntity): boolean => { diff --git a/server/libs/database/src/config/index.ts b/server/libs/database/src/config/index.ts new file mode 100644 index 0000000000..64341a62e5 --- /dev/null +++ b/server/libs/database/src/config/index.ts @@ -0,0 +1 @@ +export * from './database.config'; diff --git a/server/libs/database/src/entities/index.ts b/server/libs/database/src/entities/index.ts new file mode 100644 index 0000000000..a11884ad25 --- /dev/null +++ b/server/libs/database/src/entities/index.ts @@ -0,0 +1,10 @@ +export * from './album.entity'; +export * from './asset-album.entity'; +export * from './asset.entity'; +export * from './device-info.entity'; +export * from './exif.entity'; +export * from './smart-info.entity'; +export * from './system-config.entity'; +export * from './tag.entity'; +export * from './user-album.entity'; +export * from './user.entity'; diff --git a/server/libs/database/src/index.ts b/server/libs/database/src/index.ts index 90b0aaab98..b8b25dc222 100644 --- a/server/libs/database/src/index.ts +++ b/server/libs/database/src/index.ts @@ -1 +1,3 @@ +export * from './config'; export * from './database.module'; +export * from './entities'; diff --git a/server/libs/immich-config/src/immich-config.module.ts b/server/libs/immich-config/src/immich-config.module.ts index dc2b93569f..7a9d2e8ebd 100644 --- a/server/libs/immich-config/src/immich-config.module.ts +++ b/server/libs/immich-config/src/immich-config.module.ts @@ -1,4 +1,4 @@ -import { SystemConfigEntity } from '@app/database/entities/system-config.entity'; +import { SystemConfigEntity } from '@app/database'; import { Module, Provider } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; import { ImmichConfigService } from './immich-config.service'; diff --git a/server/libs/immich-config/src/immich-config.service.ts b/server/libs/immich-config/src/immich-config.service.ts index 2efe03112a..6cb37e2be8 100644 --- a/server/libs/immich-config/src/immich-config.service.ts +++ b/server/libs/immich-config/src/immich-config.service.ts @@ -1,4 +1,4 @@ -import { SystemConfig, SystemConfigEntity, SystemConfigKey } from '@app/database/entities/system-config.entity'; +import { SystemConfig, SystemConfigEntity, SystemConfigKey } from '@app/database'; import { BadRequestException, Injectable, Logger } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import * as _ from 'lodash'; diff --git a/server/libs/job/src/interfaces/asset-uploaded.interface.ts b/server/libs/job/src/interfaces/asset-uploaded.interface.ts index 28d27fed64..ffa9186ad6 100644 --- a/server/libs/job/src/interfaces/asset-uploaded.interface.ts +++ b/server/libs/job/src/interfaces/asset-uploaded.interface.ts @@ -1,4 +1,4 @@ -import { AssetEntity } from '@app/database/entities/asset.entity'; +import { AssetEntity } from '@app/database'; export interface IAssetUploadedJob { /** diff --git a/server/libs/job/src/interfaces/machine-learning.interface.ts b/server/libs/job/src/interfaces/machine-learning.interface.ts index 13bf5e19d5..42c9cde23d 100644 --- a/server/libs/job/src/interfaces/machine-learning.interface.ts +++ b/server/libs/job/src/interfaces/machine-learning.interface.ts @@ -1,4 +1,4 @@ -import { AssetEntity } from '@app/database/entities/asset.entity'; +import { AssetEntity } from '@app/database'; export interface IMachineLearningJob { /** diff --git a/server/libs/job/src/interfaces/metadata-extraction.interface.ts b/server/libs/job/src/interfaces/metadata-extraction.interface.ts index e5652808fd..3f08fdc1d3 100644 --- a/server/libs/job/src/interfaces/metadata-extraction.interface.ts +++ b/server/libs/job/src/interfaces/metadata-extraction.interface.ts @@ -1,4 +1,4 @@ -import { AssetEntity } from '@app/database/entities/asset.entity'; +import { AssetEntity } from '@app/database'; export interface IExifExtractionProcessor { /** diff --git a/server/libs/job/src/interfaces/thumbnail-generation.interface.ts b/server/libs/job/src/interfaces/thumbnail-generation.interface.ts index 7ead7c5f18..903abd99a8 100644 --- a/server/libs/job/src/interfaces/thumbnail-generation.interface.ts +++ b/server/libs/job/src/interfaces/thumbnail-generation.interface.ts @@ -1,4 +1,4 @@ -import { AssetEntity } from '@app/database/entities/asset.entity'; +import { AssetEntity } from '@app/database'; export interface JpegGeneratorProcessor { /** diff --git a/server/libs/job/src/interfaces/user-deletion.interface.ts b/server/libs/job/src/interfaces/user-deletion.interface.ts index 88c18526a7..e58a0a09f4 100644 --- a/server/libs/job/src/interfaces/user-deletion.interface.ts +++ b/server/libs/job/src/interfaces/user-deletion.interface.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/database/entities/user.entity'; +import { UserEntity } from '@app/database'; export interface IUserDeletionJob { /** diff --git a/server/libs/job/src/interfaces/video-transcode.interface.ts b/server/libs/job/src/interfaces/video-transcode.interface.ts index 0eee715dad..ea50e69215 100644 --- a/server/libs/job/src/interfaces/video-transcode.interface.ts +++ b/server/libs/job/src/interfaces/video-transcode.interface.ts @@ -1,4 +1,4 @@ -import { AssetEntity } from '@app/database/entities/asset.entity'; +import { AssetEntity } from '@app/database'; export interface IMp4ConversionProcessor { /** diff --git a/server/libs/storage/src/storage.module.ts b/server/libs/storage/src/storage.module.ts index 2b29959a2e..793633a3c7 100644 --- a/server/libs/storage/src/storage.module.ts +++ b/server/libs/storage/src/storage.module.ts @@ -1,5 +1,4 @@ -import { AssetEntity } from '@app/database/entities/asset.entity'; -import { SystemConfigEntity } from '@app/database/entities/system-config.entity'; +import { AssetEntity, SystemConfigEntity } from '@app/database'; import { ImmichConfigModule } from '@app/immich-config'; import { Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; diff --git a/server/libs/storage/src/storage.service.ts b/server/libs/storage/src/storage.service.ts index fab6e751f6..6c572eae61 100644 --- a/server/libs/storage/src/storage.service.ts +++ b/server/libs/storage/src/storage.service.ts @@ -1,6 +1,5 @@ import { APP_UPLOAD_LOCATION } from '@app/common'; -import { AssetEntity } from '@app/database/entities/asset.entity'; -import { SystemConfig } from '@app/database/entities/system-config.entity'; +import { AssetEntity, SystemConfig } from '@app/database'; import { ImmichConfigService, INITIAL_SYSTEM_CONFIG } from '@app/immich-config'; import { Inject, Injectable, Logger } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm';