diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dcc7d9e607..2b3a07d425 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -110,13 +110,13 @@ jobs: continue-on-error: true run: | cd server - npm run typeorm:migrations:generate ./libs/infra/src/db/migrations/TestMigration + npm run typeorm:migrations:generate ./libs/infra/src/migrations/TestMigration - name: Find file changes uses: tj-actions/verify-changed-files@v13.1 id: verify-changed-files with: files: | - server/libs/infra/src/db/migrations/ + server/libs/infra/src/migrations/ - name: Verify files have not changed if: steps.verify-changed-files.outputs.files_changed == 'true' run: | 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 a107a26d69..b6c40271cd 100644 --- a/server/apps/immich/src/api-v1/album/album-repository.ts +++ b/server/apps/immich/src/api-v1/album/album-repository.ts @@ -1,5 +1,5 @@ -import { AlbumEntity, AssetEntity, UserEntity } from '@app/infra/db/entities'; -import { dataSource } from '@app/infra/db/config'; +import { AlbumEntity, AssetEntity, UserEntity } from '@app/infra/entities'; +import { dataSource } from '@app/infra/database.config'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; 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 68f77a0467..414584243d 100644 --- a/server/apps/immich/src/api-v1/album/album.module.ts +++ b/server/apps/immich/src/api-v1/album/album.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { AlbumService } from './album.service'; import { AlbumController } from './album.controller'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { AlbumEntity, AssetEntity } from '@app/infra/db/entities'; +import { AlbumEntity, AssetEntity } from '@app/infra/entities'; import { AlbumRepository, IAlbumRepository } from './album-repository'; import { DownloadModule } from '../../modules/download/download.module'; 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 2d2b066078..69a08485ca 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, UserEntity } from '@app/infra/db/entities'; +import { AlbumEntity, UserEntity } from '@app/infra/entities'; import { AlbumResponseDto, ICryptoRepository, IJobRepository, JobName, mapUser } from '@app/domain'; import { AddAssetsResponseDto } from './response-dto/add-assets-response.dto'; import { IAlbumRepository } from './album-repository'; 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 08ab9a951b..d5c1de91f2 100644 --- a/server/apps/immich/src/api-v1/album/album.service.ts +++ b/server/apps/immich/src/api-v1/album/album.service.ts @@ -1,7 +1,7 @@ import { BadRequestException, Inject, Injectable, NotFoundException, ForbiddenException, Logger } from '@nestjs/common'; import { AuthUserDto } from '../../decorators/auth-user.decorator'; import { CreateAlbumDto } from './dto/create-album.dto'; -import { AlbumEntity, SharedLinkType } from '@app/infra/db/entities'; +import { AlbumEntity, SharedLinkType } from '@app/infra/entities'; import { AddUsersDto } from './dto/add-users.dto'; import { RemoveAssetsDto } from './dto/remove-assets.dto'; import { UpdateAlbumDto } from './dto/update-album.dto'; 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 66a8bd6312..9d7fa77ad1 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/infra/db/entities'; +import { AssetEntity, AssetType } from '@app/infra/entities'; import { Inject, Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm/repository/Repository'; diff --git a/server/apps/immich/src/api-v1/asset/asset.core.ts b/server/apps/immich/src/api-v1/asset/asset.core.ts index 3ca0dd0bac..0798d82f74 100644 --- a/server/apps/immich/src/api-v1/asset/asset.core.ts +++ b/server/apps/immich/src/api-v1/asset/asset.core.ts @@ -1,5 +1,5 @@ import { AuthUserDto, IJobRepository, JobName } from '@app/domain'; -import { AssetEntity, UserEntity } from '@app/infra/db/entities'; +import { AssetEntity, UserEntity } from '@app/infra/entities'; import { IAssetRepository } from './asset-repository'; import { CreateAssetDto, UploadFile } from './dto/create-asset.dto'; 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 0b28657c48..48e7d6502b 100644 --- a/server/apps/immich/src/api-v1/asset/asset.module.ts +++ b/server/apps/immich/src/api-v1/asset/asset.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { AssetService } from './asset.service'; import { AssetController } from './asset.controller'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { AssetEntity } from '@app/infra/db/entities'; +import { AssetEntity } from '@app/infra/entities'; import { AssetRepository, IAssetRepository } from './asset-repository'; import { DownloadModule } from '../../modules/download/download.module'; import { TagModule } from '../tag/tag.module'; 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 5883b30ca4..e71bda605e 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 @@ -1,7 +1,7 @@ import { IAssetRepository } from './asset-repository'; import { AssetService } from './asset.service'; import { QueryFailedError, Repository } from 'typeorm'; -import { AssetEntity, AssetType } from '@app/infra/db/entities'; +import { AssetEntity, AssetType } from '@app/infra/entities'; 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 116faf340e..59d14e3d1c 100644 --- a/server/apps/immich/src/api-v1/asset/asset.service.ts +++ b/server/apps/immich/src/api-v1/asset/asset.service.ts @@ -12,7 +12,7 @@ import { import { InjectRepository } from '@nestjs/typeorm'; import { QueryFailedError, Repository } from 'typeorm'; import { AuthUserDto } from '../../decorators/auth-user.decorator'; -import { AssetEntity, AssetType, SharedLinkType } from '@app/infra/db/entities'; +import { AssetEntity, AssetType, SharedLinkType } from '@app/infra/entities'; import { constants, createReadStream, stat } from 'fs'; import { ServeFileDto } from './dto/serve-file.dto'; import { Response as Res } from 'express'; 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 527d52d85d..4f76964e68 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,4 +1,4 @@ -import { AssetType } from '@app/infra/db/entities'; +import { AssetType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { IsBoolean, IsEnum, IsNotEmpty, IsOptional } from 'class-validator'; import { ImmichFile } from '../../../config/asset-upload.config'; 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 beeb9530dd..69dd946ebf 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/infra/db/entities'; +import { TagType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { IsEnum, IsNotEmpty, IsString } from 'class-validator'; 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 a7ac3885d9..38b7924a67 100644 --- a/server/apps/immich/src/api-v1/tag/tag.module.ts +++ b/server/apps/immich/src/api-v1/tag/tag.module.ts @@ -1,7 +1,7 @@ import { Module } from '@nestjs/common'; import { TagService } from './tag.service'; import { TagController } from './tag.controller'; -import { TagEntity } from '@app/infra/db/entities'; +import { TagEntity } from '@app/infra/entities'; import { TypeOrmModule } from '@nestjs/typeorm'; import { TagRepository, ITagRepository } from './tag.repository'; 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 02750e5891..ec32d8b747 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/infra/db/entities'; +import { TagEntity, TagType } from '@app/infra/entities'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { In, Repository } from 'typeorm'; 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 b17f587f91..918a0994ef 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,4 +1,4 @@ -import { TagEntity, TagType, UserEntity } from '@app/infra/db/entities'; +import { TagEntity, TagType, UserEntity } from '@app/infra/entities'; 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 dbb6cf3ed9..71998661a2 100644 --- a/server/apps/immich/src/api-v1/tag/tag.service.ts +++ b/server/apps/immich/src/api-v1/tag/tag.service.ts @@ -1,4 +1,4 @@ -import { TagEntity } from '@app/infra/db/entities'; +import { TagEntity } from '@app/infra/entities'; import { BadRequestException, Inject, Injectable, Logger } from '@nestjs/common'; import { AuthUserDto } from '../../decorators/auth-user.decorator'; import { CreateTagDto } from './dto/create-tag.dto'; diff --git a/server/apps/immich/src/modules/download/download.service.ts b/server/apps/immich/src/modules/download/download.service.ts index 2413173885..d5e800578b 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/infra/db/entities'; +import { AssetEntity } from '@app/infra/entities'; import { BadRequestException, Injectable, InternalServerErrorException, Logger, StreamableFile } from '@nestjs/common'; import archiver from 'archiver'; import { extname } from 'path'; diff --git a/server/apps/microservices/src/microservices.module.ts b/server/apps/microservices/src/microservices.module.ts index b3eadfad11..f1b0d641d2 100644 --- a/server/apps/microservices/src/microservices.module.ts +++ b/server/apps/microservices/src/microservices.module.ts @@ -1,6 +1,6 @@ import { DomainModule } from '@app/domain'; import { InfraModule } from '@app/infra'; -import { ExifEntity } from '@app/infra/db/entities'; +import { ExifEntity } from '@app/infra/entities'; import { Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; import { diff --git a/server/apps/microservices/src/processors/metadata-extraction.processor.ts b/server/apps/microservices/src/processors/metadata-extraction.processor.ts index aae60773d3..bd308a7fd4 100644 --- a/server/apps/microservices/src/processors/metadata-extraction.processor.ts +++ b/server/apps/microservices/src/processors/metadata-extraction.processor.ts @@ -10,7 +10,7 @@ import { QueueName, WithoutProperty, } from '@app/domain'; -import { AssetType, ExifEntity } from '@app/infra/db/entities'; +import { AssetType, ExifEntity } from '@app/infra/entities'; import { Process, Processor } from '@nestjs/bull'; import { Inject, Logger } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; diff --git a/server/apps/microservices/src/processors/video-transcode.processor.ts b/server/apps/microservices/src/processors/video-transcode.processor.ts index 18c18d4910..3e6e867f29 100644 --- a/server/apps/microservices/src/processors/video-transcode.processor.ts +++ b/server/apps/microservices/src/processors/video-transcode.processor.ts @@ -12,7 +12,7 @@ import { SystemConfigService, WithoutProperty, } from '@app/domain'; -import { AssetEntity, AssetType, TranscodePreset } from '@app/infra/db/entities'; +import { AssetEntity, AssetType, TranscodePreset } from '@app/infra/entities'; import { Process, Processor } from '@nestjs/bull'; import { Inject, Logger } from '@nestjs/common'; import { Job } from 'bull'; diff --git a/server/libs/domain/src/album/album.repository.ts b/server/libs/domain/src/album/album.repository.ts index e19be5bb9f..c6cc40a05d 100644 --- a/server/libs/domain/src/album/album.repository.ts +++ b/server/libs/domain/src/album/album.repository.ts @@ -1,4 +1,4 @@ -import { AlbumEntity } from '@app/infra/db/entities'; +import { AlbumEntity } from '@app/infra/entities'; export const IAlbumRepository = 'IAlbumRepository'; diff --git a/server/libs/domain/src/album/album.service.ts b/server/libs/domain/src/album/album.service.ts index 05789a71e1..16b9184563 100644 --- a/server/libs/domain/src/album/album.service.ts +++ b/server/libs/domain/src/album/album.service.ts @@ -1,4 +1,4 @@ -import { AlbumEntity } from '@app/infra/db/entities'; +import { AlbumEntity } from '@app/infra/entities'; import { Inject, Injectable } from '@nestjs/common'; import { IAssetRepository } from '../asset'; import { AuthUserDto } from '../auth'; diff --git a/server/libs/domain/src/album/response-dto/album-response.dto.ts b/server/libs/domain/src/album/response-dto/album-response.dto.ts index 1199609497..9f911e0208 100644 --- a/server/libs/domain/src/album/response-dto/album-response.dto.ts +++ b/server/libs/domain/src/album/response-dto/album-response.dto.ts @@ -1,4 +1,4 @@ -import { AlbumEntity } from '@app/infra/db/entities'; +import { AlbumEntity } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { AssetResponseDto, mapAsset } from '../../asset'; import { mapUser, UserResponseDto } from '../../user'; diff --git a/server/libs/domain/src/api-key/api-key.repository.ts b/server/libs/domain/src/api-key/api-key.repository.ts index 2bcff0b20b..68b9c7d1e7 100644 --- a/server/libs/domain/src/api-key/api-key.repository.ts +++ b/server/libs/domain/src/api-key/api-key.repository.ts @@ -1,4 +1,4 @@ -import { APIKeyEntity } from '@app/infra/db/entities'; +import { APIKeyEntity } from '@app/infra/entities'; export const IKeyRepository = 'IKeyRepository'; diff --git a/server/libs/domain/src/api-key/response-dto/api-key-response.dto.ts b/server/libs/domain/src/api-key/response-dto/api-key-response.dto.ts index 05cd717aaf..aee5fcd10b 100644 --- a/server/libs/domain/src/api-key/response-dto/api-key-response.dto.ts +++ b/server/libs/domain/src/api-key/response-dto/api-key-response.dto.ts @@ -1,4 +1,4 @@ -import { APIKeyEntity } from '@app/infra/db/entities'; +import { APIKeyEntity } from '@app/infra/entities'; export class APIKeyResponseDto { id!: string; diff --git a/server/libs/domain/src/asset/asset.core.ts b/server/libs/domain/src/asset/asset.core.ts index 164c373809..308cbd48f6 100644 --- a/server/libs/domain/src/asset/asset.core.ts +++ b/server/libs/domain/src/asset/asset.core.ts @@ -1,4 +1,4 @@ -import { AssetEntity, AssetType } from '@app/infra/db/entities'; +import { AssetEntity, AssetType } from '@app/infra/entities'; import { IJobRepository, JobName } from '../job'; import { AssetSearchOptions, IAssetRepository } from './asset.repository'; diff --git a/server/libs/domain/src/asset/asset.repository.ts b/server/libs/domain/src/asset/asset.repository.ts index d4c6f0e8cf..c8ab4dd155 100644 --- a/server/libs/domain/src/asset/asset.repository.ts +++ b/server/libs/domain/src/asset/asset.repository.ts @@ -1,4 +1,4 @@ -import { AssetEntity, AssetType } from '@app/infra/db/entities'; +import { AssetEntity, AssetType } from '@app/infra/entities'; export interface AssetSearchOptions { isVisible?: boolean; diff --git a/server/libs/domain/src/asset/asset.service.spec.ts b/server/libs/domain/src/asset/asset.service.spec.ts index 608ce4985a..debf488afa 100644 --- a/server/libs/domain/src/asset/asset.service.spec.ts +++ b/server/libs/domain/src/asset/asset.service.spec.ts @@ -1,4 +1,4 @@ -import { AssetEntity, AssetType } from '@app/infra/db/entities'; +import { AssetEntity, AssetType } from '@app/infra/entities'; import { assetEntityStub, newAssetRepositoryMock, newJobRepositoryMock } from '../../test'; import { AssetService, IAssetRepository } from '../asset'; import { IJobRepository, JobName } from '../job'; diff --git a/server/libs/domain/src/asset/asset.service.ts b/server/libs/domain/src/asset/asset.service.ts index 22d6b4dc48..89cb15e95e 100644 --- a/server/libs/domain/src/asset/asset.service.ts +++ b/server/libs/domain/src/asset/asset.service.ts @@ -1,4 +1,4 @@ -import { AssetEntity, AssetType } from '@app/infra/db/entities'; +import { AssetEntity, AssetType } from '@app/infra/entities'; import { Inject } from '@nestjs/common'; import { IAssetUploadedJob, IJobRepository, JobName } from '../job'; import { AssetCore } from './asset.core'; diff --git a/server/libs/domain/src/asset/response-dto/asset-response.dto.ts b/server/libs/domain/src/asset/response-dto/asset-response.dto.ts index 01275fd6c7..d057dabad2 100644 --- a/server/libs/domain/src/asset/response-dto/asset-response.dto.ts +++ b/server/libs/domain/src/asset/response-dto/asset-response.dto.ts @@ -1,4 +1,4 @@ -import { AssetEntity, AssetType } from '@app/infra/db/entities'; +import { AssetEntity, AssetType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import { mapTag, TagResponseDto } from '../../tag'; import { ExifResponseDto, mapExif } from './exif-response.dto'; diff --git a/server/libs/domain/src/asset/response-dto/exif-response.dto.ts b/server/libs/domain/src/asset/response-dto/exif-response.dto.ts index f47b753cfa..036e7e64ab 100644 --- a/server/libs/domain/src/asset/response-dto/exif-response.dto.ts +++ b/server/libs/domain/src/asset/response-dto/exif-response.dto.ts @@ -1,4 +1,4 @@ -import { ExifEntity } from '@app/infra/db/entities'; +import { ExifEntity } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; export class ExifResponseDto { diff --git a/server/libs/domain/src/asset/response-dto/smart-info-response.dto.ts b/server/libs/domain/src/asset/response-dto/smart-info-response.dto.ts index 5e73cc594a..72c336205d 100644 --- a/server/libs/domain/src/asset/response-dto/smart-info-response.dto.ts +++ b/server/libs/domain/src/asset/response-dto/smart-info-response.dto.ts @@ -1,4 +1,4 @@ -import { SmartInfoEntity } from '@app/infra/db/entities'; +import { SmartInfoEntity } from '@app/infra/entities'; export class SmartInfoResponseDto { tags?: string[] | null; diff --git a/server/libs/domain/src/auth/auth.core.ts b/server/libs/domain/src/auth/auth.core.ts index c1618cb39e..7731d46de9 100644 --- a/server/libs/domain/src/auth/auth.core.ts +++ b/server/libs/domain/src/auth/auth.core.ts @@ -1,4 +1,4 @@ -import { SystemConfig, UserEntity } from '@app/infra/db/entities'; +import { SystemConfig, UserEntity } from '@app/infra/entities'; import { ISystemConfigRepository } from '../system-config'; import { SystemConfigCore } from '../system-config/system-config.core'; import { AuthType, IMMICH_ACCESS_COOKIE, IMMICH_AUTH_TYPE_COOKIE } from './auth.constant'; diff --git a/server/libs/domain/src/auth/auth.service.spec.ts b/server/libs/domain/src/auth/auth.service.spec.ts index a8f858da72..e819650103 100644 --- a/server/libs/domain/src/auth/auth.service.spec.ts +++ b/server/libs/domain/src/auth/auth.service.spec.ts @@ -1,4 +1,4 @@ -import { SystemConfig, UserEntity } from '@app/infra/db/entities'; +import { SystemConfig, UserEntity } from '@app/infra/entities'; import { BadRequestException, UnauthorizedException } from '@nestjs/common'; import { IncomingHttpHeaders } from 'http'; import { generators, Issuer } from 'openid-client'; diff --git a/server/libs/domain/src/auth/auth.service.ts b/server/libs/domain/src/auth/auth.service.ts index d5e8e668a3..83602130c3 100644 --- a/server/libs/domain/src/auth/auth.service.ts +++ b/server/libs/domain/src/auth/auth.service.ts @@ -1,4 +1,4 @@ -import { SystemConfig } from '@app/infra/db/entities'; +import { SystemConfig } from '@app/infra/entities'; import { BadRequestException, Inject, diff --git a/server/libs/domain/src/auth/response-dto/admin-signup-response.dto.ts b/server/libs/domain/src/auth/response-dto/admin-signup-response.dto.ts index 68216b4df2..436405c903 100644 --- a/server/libs/domain/src/auth/response-dto/admin-signup-response.dto.ts +++ b/server/libs/domain/src/auth/response-dto/admin-signup-response.dto.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/infra/db/entities'; +import { UserEntity } from '@app/infra/entities'; export class AdminSignupResponseDto { id!: string; diff --git a/server/libs/domain/src/auth/response-dto/login-response.dto.ts b/server/libs/domain/src/auth/response-dto/login-response.dto.ts index 823f94cca6..1be8049962 100644 --- a/server/libs/domain/src/auth/response-dto/login-response.dto.ts +++ b/server/libs/domain/src/auth/response-dto/login-response.dto.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/infra/db/entities'; +import { UserEntity } from '@app/infra/entities'; import { ApiResponseProperty } from '@nestjs/swagger'; export class LoginResponseDto { diff --git a/server/libs/domain/src/device-info/device-info.core.ts b/server/libs/domain/src/device-info/device-info.core.ts index dc1cf727b9..b2a5a1a11e 100644 --- a/server/libs/domain/src/device-info/device-info.core.ts +++ b/server/libs/domain/src/device-info/device-info.core.ts @@ -1,4 +1,4 @@ -import { DeviceInfoEntity } from '@app/infra/db/entities'; +import { DeviceInfoEntity } from '@app/infra/entities'; import { IDeviceInfoRepository } from './device-info.repository'; type UpsertKeys = Pick; diff --git a/server/libs/domain/src/device-info/device-info.repository.ts b/server/libs/domain/src/device-info/device-info.repository.ts index 5a48cc8c0c..d3f3343b66 100644 --- a/server/libs/domain/src/device-info/device-info.repository.ts +++ b/server/libs/domain/src/device-info/device-info.repository.ts @@ -1,4 +1,4 @@ -import { DeviceInfoEntity } from '@app/infra/db/entities'; +import { DeviceInfoEntity } from '@app/infra/entities'; export const IDeviceInfoRepository = 'IDeviceInfoRepository'; diff --git a/server/libs/domain/src/device-info/device-info.service.spec.ts b/server/libs/domain/src/device-info/device-info.service.spec.ts index a131861da3..bc05cda55f 100644 --- a/server/libs/domain/src/device-info/device-info.service.spec.ts +++ b/server/libs/domain/src/device-info/device-info.service.spec.ts @@ -1,4 +1,4 @@ -import { DeviceInfoEntity, DeviceType } from '@app/infra/db/entities'; +import { DeviceInfoEntity, DeviceType } from '@app/infra/entities'; import { authStub, newDeviceInfoRepositoryMock } from '../../test'; import { IDeviceInfoRepository } from './device-info.repository'; import { DeviceInfoService } from './device-info.service'; diff --git a/server/libs/domain/src/device-info/dto/upsert-device-info.dto.ts b/server/libs/domain/src/device-info/dto/upsert-device-info.dto.ts index f764a1b7ba..5c540b8116 100644 --- a/server/libs/domain/src/device-info/dto/upsert-device-info.dto.ts +++ b/server/libs/domain/src/device-info/dto/upsert-device-info.dto.ts @@ -1,5 +1,5 @@ import { IsNotEmpty, IsOptional } from 'class-validator'; -import { DeviceType } from '@app/infra/db/entities'; +import { DeviceType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; export class UpsertDeviceInfoDto { diff --git a/server/libs/domain/src/device-info/response-dto/device-info-response.dto.ts b/server/libs/domain/src/device-info/response-dto/device-info-response.dto.ts index 07edb2e129..dbbc902f5a 100644 --- a/server/libs/domain/src/device-info/response-dto/device-info-response.dto.ts +++ b/server/libs/domain/src/device-info/response-dto/device-info-response.dto.ts @@ -1,4 +1,4 @@ -import { DeviceInfoEntity, DeviceType } from '@app/infra/db/entities'; +import { DeviceInfoEntity, DeviceType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; export class DeviceInfoResponseDto { diff --git a/server/libs/domain/src/job/job.interface.ts b/server/libs/domain/src/job/job.interface.ts index 640cc12944..6b758b0916 100644 --- a/server/libs/domain/src/job/job.interface.ts +++ b/server/libs/domain/src/job/job.interface.ts @@ -1,4 +1,4 @@ -import { AlbumEntity, AssetEntity, UserEntity } from '@app/infra/db/entities'; +import { AlbumEntity, AssetEntity, UserEntity } from '@app/infra/entities'; export interface IBaseJob { force?: boolean; diff --git a/server/libs/domain/src/media/media.service.ts b/server/libs/domain/src/media/media.service.ts index 8d470928c9..76b57a3353 100644 --- a/server/libs/domain/src/media/media.service.ts +++ b/server/libs/domain/src/media/media.service.ts @@ -1,4 +1,4 @@ -import { AssetType } from '@app/infra/db/entities'; +import { AssetType } from '@app/infra/entities'; import { Inject, Injectable, Logger } from '@nestjs/common'; import { join } from 'path'; import { IAssetRepository, mapAsset, WithoutProperty } from '../asset'; diff --git a/server/libs/domain/src/oauth/oauth.core.ts b/server/libs/domain/src/oauth/oauth.core.ts index d21eaad5d2..a901d2bd68 100644 --- a/server/libs/domain/src/oauth/oauth.core.ts +++ b/server/libs/domain/src/oauth/oauth.core.ts @@ -1,4 +1,4 @@ -import { SystemConfig } from '@app/infra/db/entities'; +import { SystemConfig } from '@app/infra/entities'; import { BadRequestException, Injectable, Logger } from '@nestjs/common'; import { ClientMetadata, custom, generators, Issuer, UserinfoResponse } from 'openid-client'; import { ISystemConfigRepository } from '../system-config'; diff --git a/server/libs/domain/src/oauth/oauth.service.spec.ts b/server/libs/domain/src/oauth/oauth.service.spec.ts index f6b4f3e1cc..504d91307c 100644 --- a/server/libs/domain/src/oauth/oauth.service.spec.ts +++ b/server/libs/domain/src/oauth/oauth.service.spec.ts @@ -1,4 +1,4 @@ -import { SystemConfig, UserEntity } from '@app/infra/db/entities'; +import { SystemConfig, UserEntity } from '@app/infra/entities'; import { BadRequestException } from '@nestjs/common'; import { generators, Issuer } from 'openid-client'; import { diff --git a/server/libs/domain/src/oauth/oauth.service.ts b/server/libs/domain/src/oauth/oauth.service.ts index 1eb8a5c496..4001b75700 100644 --- a/server/libs/domain/src/oauth/oauth.service.ts +++ b/server/libs/domain/src/oauth/oauth.service.ts @@ -1,4 +1,4 @@ -import { SystemConfig } from '@app/infra/db/entities'; +import { SystemConfig } from '@app/infra/entities'; import { BadRequestException, Inject, Injectable, Logger } from '@nestjs/common'; import { AuthType, AuthUserDto, LoginResponseDto } from '../auth'; import { AuthCore } from '../auth/auth.core'; diff --git a/server/libs/domain/src/search/dto/search.dto.ts b/server/libs/domain/src/search/dto/search.dto.ts index 83fbcb5de7..b30acb0cf7 100644 --- a/server/libs/domain/src/search/dto/search.dto.ts +++ b/server/libs/domain/src/search/dto/search.dto.ts @@ -1,4 +1,4 @@ -import { AssetType } from '@app/infra/db/entities'; +import { AssetType } from '@app/infra/entities'; import { Transform } from 'class-transformer'; import { IsArray, IsBoolean, IsEnum, IsNotEmpty, IsOptional, IsString } from 'class-validator'; import { toBoolean } from '../../../../../apps/immich/src/utils/transform.util'; diff --git a/server/libs/domain/src/search/search.repository.ts b/server/libs/domain/src/search/search.repository.ts index 8db6eb14b4..ac7f211a24 100644 --- a/server/libs/domain/src/search/search.repository.ts +++ b/server/libs/domain/src/search/search.repository.ts @@ -1,4 +1,4 @@ -import { AlbumEntity, AssetEntity, AssetType } from '@app/infra/db/entities'; +import { AlbumEntity, AssetEntity, AssetType } from '@app/infra/entities'; export enum SearchCollection { ASSETS = 'assets', diff --git a/server/libs/domain/src/search/search.service.ts b/server/libs/domain/src/search/search.service.ts index 744657f375..f026a0695a 100644 --- a/server/libs/domain/src/search/search.service.ts +++ b/server/libs/domain/src/search/search.service.ts @@ -1,4 +1,4 @@ -import { AlbumEntity, AssetEntity } from '@app/infra/db/entities'; +import { AlbumEntity, AssetEntity } from '@app/infra/entities'; import { BadRequestException, Inject, Injectable, Logger } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { mapAlbum } from '../album'; diff --git a/server/libs/domain/src/share/dto/create-shared-link.dto.ts b/server/libs/domain/src/share/dto/create-shared-link.dto.ts index ffaba65608..7f5af8b08e 100644 --- a/server/libs/domain/src/share/dto/create-shared-link.dto.ts +++ b/server/libs/domain/src/share/dto/create-shared-link.dto.ts @@ -1,4 +1,4 @@ -import { AlbumEntity, AssetEntity, SharedLinkType } from '@app/infra/db/entities'; +import { AlbumEntity, AssetEntity, SharedLinkType } from '@app/infra/entities'; export class CreateSharedLinkDto { description?: string; diff --git a/server/libs/domain/src/share/response-dto/shared-link-response.dto.ts b/server/libs/domain/src/share/response-dto/shared-link-response.dto.ts index bce9901697..2618a264c7 100644 --- a/server/libs/domain/src/share/response-dto/shared-link-response.dto.ts +++ b/server/libs/domain/src/share/response-dto/shared-link-response.dto.ts @@ -1,4 +1,4 @@ -import { SharedLinkEntity, SharedLinkType } from '@app/infra/db/entities'; +import { SharedLinkEntity, SharedLinkType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; import _ from 'lodash'; import { AlbumResponseDto, mapAlbumExcludeAssetInfo } from '../../album'; diff --git a/server/libs/domain/src/share/share.core.ts b/server/libs/domain/src/share/share.core.ts index 0fa62cbb6e..6d33c2fd5a 100644 --- a/server/libs/domain/src/share/share.core.ts +++ b/server/libs/domain/src/share/share.core.ts @@ -1,4 +1,4 @@ -import { AssetEntity, SharedLinkEntity } from '@app/infra/db/entities'; +import { AssetEntity, SharedLinkEntity } from '@app/infra/entities'; import { BadRequestException, ForbiddenException, diff --git a/server/libs/domain/src/share/shared-link.repository.ts b/server/libs/domain/src/share/shared-link.repository.ts index 50741f9d97..e6d7c40356 100644 --- a/server/libs/domain/src/share/shared-link.repository.ts +++ b/server/libs/domain/src/share/shared-link.repository.ts @@ -1,4 +1,4 @@ -import { SharedLinkEntity } from '@app/infra/db/entities'; +import { SharedLinkEntity } from '@app/infra/entities'; export const ISharedLinkRepository = 'ISharedLinkRepository'; diff --git a/server/libs/domain/src/smart-info/smart-info.repository.ts b/server/libs/domain/src/smart-info/smart-info.repository.ts index 3fb04d4263..fdc61cda25 100644 --- a/server/libs/domain/src/smart-info/smart-info.repository.ts +++ b/server/libs/domain/src/smart-info/smart-info.repository.ts @@ -1,4 +1,4 @@ -import { SmartInfoEntity } from '@app/infra/db/entities'; +import { SmartInfoEntity } from '@app/infra/entities'; export const ISmartInfoRepository = 'ISmartInfoRepository'; diff --git a/server/libs/domain/src/smart-info/smart-info.service.spec.ts b/server/libs/domain/src/smart-info/smart-info.service.spec.ts index 2a763a8481..3f22bc0449 100644 --- a/server/libs/domain/src/smart-info/smart-info.service.spec.ts +++ b/server/libs/domain/src/smart-info/smart-info.service.spec.ts @@ -1,4 +1,4 @@ -import { AssetEntity } from '@app/infra/db/entities'; +import { AssetEntity } from '@app/infra/entities'; import { assetEntityStub, newAssetRepositoryMock, diff --git a/server/libs/domain/src/storage-template/storage-template.core.ts b/server/libs/domain/src/storage-template/storage-template.core.ts index 66f9e4ef69..2350811c62 100644 --- a/server/libs/domain/src/storage-template/storage-template.core.ts +++ b/server/libs/domain/src/storage-template/storage-template.core.ts @@ -1,4 +1,4 @@ -import { AssetEntity, AssetType, SystemConfig } from '@app/infra/db/entities'; +import { AssetEntity, AssetType, SystemConfig } from '@app/infra/entities'; import { Logger } from '@nestjs/common'; import handlebar from 'handlebars'; import * as luxon from 'luxon'; diff --git a/server/libs/domain/src/storage-template/storage-template.service.ts b/server/libs/domain/src/storage-template/storage-template.service.ts index 028114d771..b6df125c18 100644 --- a/server/libs/domain/src/storage-template/storage-template.service.ts +++ b/server/libs/domain/src/storage-template/storage-template.service.ts @@ -1,4 +1,4 @@ -import { AssetEntity, SystemConfig } from '@app/infra/db/entities'; +import { AssetEntity, SystemConfig } from '@app/infra/entities'; import { Inject, Injectable, Logger } from '@nestjs/common'; import { IAssetRepository } from '../asset/asset.repository'; import { APP_MEDIA_LOCATION } from '../domain.constant'; diff --git a/server/libs/domain/src/system-config/dto/system-config-ffmpeg.dto.ts b/server/libs/domain/src/system-config/dto/system-config-ffmpeg.dto.ts index 6ccae3b95d..07b1723797 100644 --- a/server/libs/domain/src/system-config/dto/system-config-ffmpeg.dto.ts +++ b/server/libs/domain/src/system-config/dto/system-config-ffmpeg.dto.ts @@ -1,5 +1,5 @@ import { IsEnum, IsString } from 'class-validator'; -import { TranscodePreset } from '@app/infra/db/entities'; +import { TranscodePreset } from '@app/infra/entities'; export class SystemConfigFFmpegDto { @IsString() diff --git a/server/libs/domain/src/system-config/dto/system-config.dto.ts b/server/libs/domain/src/system-config/dto/system-config.dto.ts index 19a6fb4ab9..e593ed96da 100644 --- a/server/libs/domain/src/system-config/dto/system-config.dto.ts +++ b/server/libs/domain/src/system-config/dto/system-config.dto.ts @@ -1,4 +1,4 @@ -import { SystemConfig } from '@app/infra/db/entities'; +import { SystemConfig } from '@app/infra/entities'; import { ValidateNested } from 'class-validator'; import { SystemConfigFFmpegDto } from './system-config-ffmpeg.dto'; import { SystemConfigOAuthDto } from './system-config-oauth.dto'; diff --git a/server/libs/domain/src/system-config/system-config.core.ts b/server/libs/domain/src/system-config/system-config.core.ts index 57458cee23..d91ffa1e51 100644 --- a/server/libs/domain/src/system-config/system-config.core.ts +++ b/server/libs/domain/src/system-config/system-config.core.ts @@ -1,4 +1,4 @@ -import { SystemConfig, SystemConfigEntity, SystemConfigKey, TranscodePreset } from '@app/infra/db/entities'; +import { SystemConfig, SystemConfigEntity, SystemConfigKey, TranscodePreset } from '@app/infra/entities'; import { BadRequestException, Injectable, Logger } from '@nestjs/common'; import * as _ from 'lodash'; import { Subject } from 'rxjs'; diff --git a/server/libs/domain/src/system-config/system-config.repository.ts b/server/libs/domain/src/system-config/system-config.repository.ts index c95e73ae24..6b04669ccc 100644 --- a/server/libs/domain/src/system-config/system-config.repository.ts +++ b/server/libs/domain/src/system-config/system-config.repository.ts @@ -1,4 +1,4 @@ -import { SystemConfigEntity } from '@app/infra/db/entities'; +import { SystemConfigEntity } from '@app/infra/entities'; export const ISystemConfigRepository = 'ISystemConfigRepository'; diff --git a/server/libs/domain/src/system-config/system-config.service.spec.ts b/server/libs/domain/src/system-config/system-config.service.spec.ts index a0bd08dfb1..32562c5b89 100644 --- a/server/libs/domain/src/system-config/system-config.service.spec.ts +++ b/server/libs/domain/src/system-config/system-config.service.spec.ts @@ -1,4 +1,4 @@ -import { SystemConfigEntity, SystemConfigKey, TranscodePreset } from '@app/infra/db/entities'; +import { SystemConfigEntity, SystemConfigKey, TranscodePreset } from '@app/infra/entities'; import { BadRequestException } from '@nestjs/common'; import { newJobRepositoryMock, newSystemConfigRepositoryMock, systemConfigStub } from '../../test'; import { IJobRepository, JobName } from '../job'; diff --git a/server/libs/domain/src/tag/response-dto/tag-response.dto.ts b/server/libs/domain/src/tag/response-dto/tag-response.dto.ts index 90a3273331..b679a378c6 100644 --- a/server/libs/domain/src/tag/response-dto/tag-response.dto.ts +++ b/server/libs/domain/src/tag/response-dto/tag-response.dto.ts @@ -1,4 +1,4 @@ -import { TagEntity, TagType } from '@app/infra/db/entities'; +import { TagEntity, TagType } from '@app/infra/entities'; import { ApiProperty } from '@nestjs/swagger'; export class TagResponseDto { diff --git a/server/libs/domain/src/user-token/user-token.core.ts b/server/libs/domain/src/user-token/user-token.core.ts index 80743b9c32..d430034f47 100644 --- a/server/libs/domain/src/user-token/user-token.core.ts +++ b/server/libs/domain/src/user-token/user-token.core.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/infra/db/entities'; +import { UserEntity } from '@app/infra/entities'; import { Injectable, UnauthorizedException } from '@nestjs/common'; import { ICryptoRepository } from '../crypto'; import { IUserTokenRepository } from './user-token.repository'; diff --git a/server/libs/domain/src/user-token/user-token.repository.ts b/server/libs/domain/src/user-token/user-token.repository.ts index b2309e9feb..30285aa5cb 100644 --- a/server/libs/domain/src/user-token/user-token.repository.ts +++ b/server/libs/domain/src/user-token/user-token.repository.ts @@ -1,4 +1,4 @@ -import { UserTokenEntity } from '@app/infra/db/entities'; +import { UserTokenEntity } from '@app/infra/entities'; export const IUserTokenRepository = 'IUserTokenRepository'; diff --git a/server/libs/domain/src/user/response-dto/user-response.dto.ts b/server/libs/domain/src/user/response-dto/user-response.dto.ts index b83bc93fcb..cc9a75f4d0 100644 --- a/server/libs/domain/src/user/response-dto/user-response.dto.ts +++ b/server/libs/domain/src/user/response-dto/user-response.dto.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/infra/db/entities'; +import { UserEntity } from '@app/infra/entities'; export class UserResponseDto { id!: string; diff --git a/server/libs/domain/src/user/user.core.ts b/server/libs/domain/src/user/user.core.ts index 5536fea0d6..0e7dd1dc59 100644 --- a/server/libs/domain/src/user/user.core.ts +++ b/server/libs/domain/src/user/user.core.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/infra/db/entities'; +import { UserEntity } from '@app/infra/entities'; import { BadRequestException, ForbiddenException, diff --git a/server/libs/domain/src/user/user.repository.ts b/server/libs/domain/src/user/user.repository.ts index 126922a5f8..4a3f55de90 100644 --- a/server/libs/domain/src/user/user.repository.ts +++ b/server/libs/domain/src/user/user.repository.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/infra/db/entities'; +import { UserEntity } from '@app/infra/entities'; export interface UserListFilter { excludeId?: string; diff --git a/server/libs/domain/src/user/user.service.spec.ts b/server/libs/domain/src/user/user.service.spec.ts index ac2c6db7e1..647c059345 100644 --- a/server/libs/domain/src/user/user.service.spec.ts +++ b/server/libs/domain/src/user/user.service.spec.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/infra/db/entities'; +import { UserEntity } from '@app/infra/entities'; import { BadRequestException, ForbiddenException, NotFoundException } from '@nestjs/common'; import { when } from 'jest-when'; import { diff --git a/server/libs/domain/src/user/user.service.ts b/server/libs/domain/src/user/user.service.ts index e999f12b3c..4bce62ed86 100644 --- a/server/libs/domain/src/user/user.service.ts +++ b/server/libs/domain/src/user/user.service.ts @@ -1,4 +1,4 @@ -import { UserEntity } from '@app/infra/db/entities'; +import { UserEntity } from '@app/infra/entities'; import { BadRequestException, Inject, Injectable, Logger, NotFoundException } from '@nestjs/common'; import { randomBytes } from 'crypto'; import { ReadStream } from 'fs'; diff --git a/server/libs/domain/test/fixtures.ts b/server/libs/domain/test/fixtures.ts index ef4f79bd6d..ea092d44e7 100644 --- a/server/libs/domain/test/fixtures.ts +++ b/server/libs/domain/test/fixtures.ts @@ -9,7 +9,7 @@ import { TranscodePreset, UserEntity, UserTokenEntity, -} from '@app/infra/db/entities'; +} from '@app/infra/entities'; import { AlbumResponseDto, AssetResponseDto, diff --git a/server/libs/infra/src/communication/communication.gateway.ts b/server/libs/infra/src/communication.gateway.ts similarity index 100% rename from server/libs/infra/src/communication/communication.gateway.ts rename to server/libs/infra/src/communication.gateway.ts diff --git a/server/libs/infra/src/communication/index.ts b/server/libs/infra/src/communication/index.ts deleted file mode 100644 index 88ed49b907..0000000000 --- a/server/libs/infra/src/communication/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './communication.gateway'; -export * from './communication.repository'; diff --git a/server/libs/infra/src/db/config/database.config.ts b/server/libs/infra/src/database.config.ts similarity index 80% rename from server/libs/infra/src/db/config/database.config.ts rename to server/libs/infra/src/database.config.ts index b79ae32cb7..8df8777051 100644 --- a/server/libs/infra/src/db/config/database.config.ts +++ b/server/libs/infra/src/database.config.ts @@ -1,5 +1,5 @@ -import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions'; import { DataSource } from 'typeorm'; +import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions'; const url = process.env.DB_URL; const urlOrParts = url @@ -14,12 +14,13 @@ const urlOrParts = url export const databaseConfig: PostgresConnectionOptions = { type: 'postgres', - entities: [__dirname + '/../**/*.entity.{js,ts}'], + entities: [__dirname + '/entities/*.entity.{js,ts}'], synchronize: false, - migrations: [__dirname + '/../migrations/*.{js,ts}'], + migrations: [__dirname + '/migrations/*.{js,ts}'], migrationsRun: true, connectTimeoutMS: 10000, // 10 seconds ...urlOrParts, }; +// this export is used by TypeORM commands in package.json#scripts export const dataSource = new DataSource(databaseConfig); diff --git a/server/libs/infra/src/db/config/index.ts b/server/libs/infra/src/db/config/index.ts deleted file mode 100644 index 64341a62e5..0000000000 --- a/server/libs/infra/src/db/config/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './database.config'; diff --git a/server/libs/infra/src/db/entities/index.ts b/server/libs/infra/src/db/entities/index.ts deleted file mode 100644 index 971700dbd1..0000000000 --- a/server/libs/infra/src/db/entities/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -export * from './album.entity'; -export * from './api-key.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.entity'; -export * from './user-token.entity'; -export * from './shared-link.entity'; diff --git a/server/libs/infra/src/db/index.ts b/server/libs/infra/src/db/index.ts deleted file mode 100644 index 7ab3eb208b..0000000000 --- a/server/libs/infra/src/db/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './config'; -export * from './entities'; -export * from './repository'; diff --git a/server/libs/infra/src/db/entities/album.entity.ts b/server/libs/infra/src/entities/album.entity.ts similarity index 100% rename from server/libs/infra/src/db/entities/album.entity.ts rename to server/libs/infra/src/entities/album.entity.ts diff --git a/server/libs/infra/src/db/entities/api-key.entity.ts b/server/libs/infra/src/entities/api-key.entity.ts similarity index 100% rename from server/libs/infra/src/db/entities/api-key.entity.ts rename to server/libs/infra/src/entities/api-key.entity.ts diff --git a/server/libs/infra/src/db/entities/asset.entity.ts b/server/libs/infra/src/entities/asset.entity.ts similarity index 100% rename from server/libs/infra/src/db/entities/asset.entity.ts rename to server/libs/infra/src/entities/asset.entity.ts diff --git a/server/libs/infra/src/db/entities/device-info.entity.ts b/server/libs/infra/src/entities/device-info.entity.ts similarity index 100% rename from server/libs/infra/src/db/entities/device-info.entity.ts rename to server/libs/infra/src/entities/device-info.entity.ts diff --git a/server/libs/infra/src/db/entities/exif.entity.ts b/server/libs/infra/src/entities/exif.entity.ts similarity index 100% rename from server/libs/infra/src/db/entities/exif.entity.ts rename to server/libs/infra/src/entities/exif.entity.ts diff --git a/server/libs/infra/src/entities/index.ts b/server/libs/infra/src/entities/index.ts new file mode 100644 index 0000000000..778ff33db0 --- /dev/null +++ b/server/libs/infra/src/entities/index.ts @@ -0,0 +1,33 @@ +import { AlbumEntity } from './album.entity'; +import { APIKeyEntity } from './api-key.entity'; +import { AssetEntity } from './asset.entity'; +import { DeviceInfoEntity } from './device-info.entity'; +import { SharedLinkEntity } from './shared-link.entity'; +import { SmartInfoEntity } from './smart-info.entity'; +import { SystemConfigEntity } from './system-config.entity'; +import { UserTokenEntity } from './user-token.entity'; +import { UserEntity } from './user.entity'; + +export * from './album.entity'; +export * from './api-key.entity'; +export * from './asset.entity'; +export * from './device-info.entity'; +export * from './exif.entity'; +export * from './shared-link.entity'; +export * from './smart-info.entity'; +export * from './system-config.entity'; +export * from './tag.entity'; +export * from './user-token.entity'; +export * from './user.entity'; + +export const databaseEntities = [ + AssetEntity, + AlbumEntity, + APIKeyEntity, + DeviceInfoEntity, + UserEntity, + SharedLinkEntity, + SmartInfoEntity, + SystemConfigEntity, + UserTokenEntity, +]; diff --git a/server/libs/infra/src/db/entities/shared-link.entity.ts b/server/libs/infra/src/entities/shared-link.entity.ts similarity index 100% rename from server/libs/infra/src/db/entities/shared-link.entity.ts rename to server/libs/infra/src/entities/shared-link.entity.ts diff --git a/server/libs/infra/src/db/entities/smart-info.entity.ts b/server/libs/infra/src/entities/smart-info.entity.ts similarity index 100% rename from server/libs/infra/src/db/entities/smart-info.entity.ts rename to server/libs/infra/src/entities/smart-info.entity.ts diff --git a/server/libs/infra/src/db/entities/system-config.entity.ts b/server/libs/infra/src/entities/system-config.entity.ts similarity index 100% rename from server/libs/infra/src/db/entities/system-config.entity.ts rename to server/libs/infra/src/entities/system-config.entity.ts diff --git a/server/libs/infra/src/db/entities/tag.entity.ts b/server/libs/infra/src/entities/tag.entity.ts similarity index 100% rename from server/libs/infra/src/db/entities/tag.entity.ts rename to server/libs/infra/src/entities/tag.entity.ts diff --git a/server/libs/infra/src/db/entities/user-token.entity.ts b/server/libs/infra/src/entities/user-token.entity.ts similarity index 100% rename from server/libs/infra/src/db/entities/user-token.entity.ts rename to server/libs/infra/src/entities/user-token.entity.ts diff --git a/server/libs/infra/src/db/entities/user.entity.ts b/server/libs/infra/src/entities/user.entity.ts similarity index 100% rename from server/libs/infra/src/db/entities/user.entity.ts rename to server/libs/infra/src/entities/user.entity.ts diff --git a/server/libs/infra/src/index.ts b/server/libs/infra/src/index.ts index debca9ed35..27d0864535 100644 --- a/server/libs/infra/src/index.ts +++ b/server/libs/infra/src/index.ts @@ -1,2 +1,3 @@ -export * from './db'; +export * from './database.config'; +export * from './infra.config'; export * from './infra.module'; diff --git a/server/libs/infra/src/infra.config.ts b/server/libs/infra/src/infra.config.ts new file mode 100644 index 0000000000..0fa88760e5 --- /dev/null +++ b/server/libs/infra/src/infra.config.ts @@ -0,0 +1,35 @@ +import { BullModuleOptions } from '@nestjs/bull'; +import { ConfigurationOptions } from 'typesense/lib/Typesense/Configuration'; +import { QueueName } from '../../domain/src'; + +export const bullConfig: BullModuleOptions = { + prefix: 'immich_bull', + redis: { + host: process.env.REDIS_HOSTNAME || 'immich_redis', + port: parseInt(process.env.REDIS_PORT || '6379'), + db: parseInt(process.env.REDIS_DBINDEX || '0'), + password: process.env.REDIS_PASSWORD || undefined, + path: process.env.REDIS_SOCKET || undefined, + }, + defaultJobOptions: { + attempts: 3, + removeOnComplete: true, + removeOnFail: false, + }, +}; + +export const bullQueues: BullModuleOptions[] = Object.values(QueueName).map((name) => ({ name })); + +export const typesenseConfig: ConfigurationOptions = { + nodes: [ + { + host: process.env.TYPESENSE_HOST || 'typesense', + port: Number(process.env.TYPESENSE_PORT) || 8108, + protocol: process.env.TYPESENSE_PROTOCOL || 'http', + }, + ], + apiKey: process.env.TYPESENSE_API_KEY as string, + numRetries: 15, + retryIntervalSeconds: 4, + connectionTimeoutSeconds: 10, +}; diff --git a/server/libs/infra/src/infra.module.ts b/server/libs/infra/src/infra.module.ts index c3dcb4987e..34347c1502 100644 --- a/server/libs/infra/src/infra.module.ts +++ b/server/libs/infra/src/infra.module.ts @@ -16,40 +16,33 @@ import { ISystemConfigRepository, IUserRepository, IUserTokenRepository, - QueueName, } from '@app/domain'; import { BullModule } from '@nestjs/bull'; import { Global, Module, Provider } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { CryptoRepository } from './auth/crypto.repository'; -import { CommunicationGateway, CommunicationRepository } from './communication'; +import { CommunicationGateway } from './communication.gateway'; +import { databaseConfig } from './database.config'; +import { databaseEntities } from './entities'; +import { bullConfig, bullQueues } from './infra.config'; import { - AlbumEntity, AlbumRepository, - APIKeyEntity, APIKeyRepository, - AssetEntity, AssetRepository, - databaseConfig, - DeviceInfoEntity, + CommunicationRepository, + CryptoRepository, DeviceInfoRepository, - SharedLinkEntity, + FilesystemProvider, + JobRepository, + MachineLearningRepository, + MediaRepository, SharedLinkRepository, - SmartInfoEntity, SmartInfoRepository, - SystemConfigEntity, SystemConfigRepository, - UserEntity, + TypesenseRepository, UserRepository, - UserTokenEntity, UserTokenRepository, -} from './db'; -import { JobRepository } from './job'; -import { MachineLearningRepository } from './machine-learning'; -import { MediaRepository } from './media'; -import { TypesenseRepository } from './search'; -import { FilesystemProvider } from './storage'; +} from './repositories'; const providers: Provider[] = [ { provide: IAlbumRepository, useClass: AlbumRepository }, @@ -74,38 +67,10 @@ const providers: Provider[] = [ @Module({ imports: [ ConfigModule.forRoot(immichAppConfig), - TypeOrmModule.forRoot(databaseConfig), - TypeOrmModule.forFeature([ - AssetEntity, - AlbumEntity, - APIKeyEntity, - DeviceInfoEntity, - UserEntity, - SharedLinkEntity, - SmartInfoEntity, - SystemConfigEntity, - UserTokenEntity, - ]), - - BullModule.forRootAsync({ - useFactory: async () => ({ - prefix: 'immich_bull', - redis: { - host: process.env.REDIS_HOSTNAME || 'immich_redis', - port: parseInt(process.env.REDIS_PORT || '6379'), - db: parseInt(process.env.REDIS_DBINDEX || '0'), - password: process.env.REDIS_PASSWORD || undefined, - path: process.env.REDIS_SOCKET || undefined, - }, - defaultJobOptions: { - attempts: 3, - removeOnComplete: true, - removeOnFail: false, - }, - }), - }), - BullModule.registerQueue(...Object.values(QueueName).map((name) => ({ name }))), + TypeOrmModule.forFeature(databaseEntities), + BullModule.forRoot(bullConfig), + BullModule.registerQueue(...bullQueues), ], providers: [...providers, CommunicationGateway], exports: [...providers, BullModule], diff --git a/server/libs/infra/src/job/index.ts b/server/libs/infra/src/job/index.ts deleted file mode 100644 index 39d17bf115..0000000000 --- a/server/libs/infra/src/job/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './job.repository'; diff --git a/server/libs/infra/src/machine-learning/index.ts b/server/libs/infra/src/machine-learning/index.ts deleted file mode 100644 index dde6fa72a5..0000000000 --- a/server/libs/infra/src/machine-learning/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './machine-learning.repository'; diff --git a/server/libs/infra/src/media/index.ts b/server/libs/infra/src/media/index.ts deleted file mode 100644 index 3c1dba5e64..0000000000 --- a/server/libs/infra/src/media/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './media.repository'; diff --git a/server/libs/infra/src/db/migrations/1645130759468-CreateUserTable.ts b/server/libs/infra/src/migrations/1645130759468-CreateUserTable.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1645130759468-CreateUserTable.ts rename to server/libs/infra/src/migrations/1645130759468-CreateUserTable.ts diff --git a/server/libs/infra/src/db/migrations/1645130777674-CreateDeviceInfoTable.ts b/server/libs/infra/src/migrations/1645130777674-CreateDeviceInfoTable.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1645130777674-CreateDeviceInfoTable.ts rename to server/libs/infra/src/migrations/1645130777674-CreateDeviceInfoTable.ts diff --git a/server/libs/infra/src/db/migrations/1645130805273-CreateAssetsTable.ts b/server/libs/infra/src/migrations/1645130805273-CreateAssetsTable.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1645130805273-CreateAssetsTable.ts rename to server/libs/infra/src/migrations/1645130805273-CreateAssetsTable.ts diff --git a/server/libs/infra/src/db/migrations/1645130817965-CreateExifTable.ts b/server/libs/infra/src/migrations/1645130817965-CreateExifTable.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1645130817965-CreateExifTable.ts rename to server/libs/infra/src/migrations/1645130817965-CreateExifTable.ts diff --git a/server/libs/infra/src/db/migrations/1645130870184-CreateSmartInfoTable.ts b/server/libs/infra/src/migrations/1645130870184-CreateSmartInfoTable.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1645130870184-CreateSmartInfoTable.ts rename to server/libs/infra/src/migrations/1645130870184-CreateSmartInfoTable.ts diff --git a/server/libs/infra/src/db/migrations/1646249209023-AddExifTextSearchColumn.ts b/server/libs/infra/src/migrations/1646249209023-AddExifTextSearchColumn.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1646249209023-AddExifTextSearchColumn.ts rename to server/libs/infra/src/migrations/1646249209023-AddExifTextSearchColumn.ts diff --git a/server/libs/infra/src/db/migrations/1646249734844-CreateExifTextSearchIndex.ts b/server/libs/infra/src/migrations/1646249734844-CreateExifTextSearchIndex.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1646249734844-CreateExifTextSearchIndex.ts rename to server/libs/infra/src/migrations/1646249734844-CreateExifTextSearchIndex.ts diff --git a/server/libs/infra/src/db/migrations/1646709533213-AddRegionCityToExIf.ts b/server/libs/infra/src/migrations/1646709533213-AddRegionCityToExIf.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1646709533213-AddRegionCityToExIf.ts rename to server/libs/infra/src/migrations/1646709533213-AddRegionCityToExIf.ts diff --git a/server/libs/infra/src/db/migrations/1646710459852-AddLocationToExifTextSearch.ts b/server/libs/infra/src/migrations/1646710459852-AddLocationToExifTextSearch.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1646710459852-AddLocationToExifTextSearch.ts rename to server/libs/infra/src/migrations/1646710459852-AddLocationToExifTextSearch.ts diff --git a/server/libs/infra/src/db/migrations/1648317474768-AddObjectColumnToSmartInfo.ts b/server/libs/infra/src/migrations/1648317474768-AddObjectColumnToSmartInfo.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1648317474768-AddObjectColumnToSmartInfo.ts rename to server/libs/infra/src/migrations/1648317474768-AddObjectColumnToSmartInfo.ts diff --git a/server/libs/infra/src/db/migrations/1649643216111-CreateSharedAlbumAndRelatedTables.ts b/server/libs/infra/src/migrations/1649643216111-CreateSharedAlbumAndRelatedTables.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1649643216111-CreateSharedAlbumAndRelatedTables.ts rename to server/libs/infra/src/migrations/1649643216111-CreateSharedAlbumAndRelatedTables.ts diff --git a/server/libs/infra/src/db/migrations/1652633525943-UpdateUserTableWithAdminAndName.ts b/server/libs/infra/src/migrations/1652633525943-UpdateUserTableWithAdminAndName.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1652633525943-UpdateUserTableWithAdminAndName.ts rename to server/libs/infra/src/migrations/1652633525943-UpdateUserTableWithAdminAndName.ts diff --git a/server/libs/infra/src/db/migrations/1653214255670-UpdateAssetTableWithWebpPath.ts b/server/libs/infra/src/migrations/1653214255670-UpdateAssetTableWithWebpPath.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1653214255670-UpdateAssetTableWithWebpPath.ts rename to server/libs/infra/src/migrations/1653214255670-UpdateAssetTableWithWebpPath.ts diff --git a/server/libs/infra/src/db/migrations/1654299904583-UpdateAssetTableWithEncodeVideoPath.ts b/server/libs/infra/src/migrations/1654299904583-UpdateAssetTableWithEncodeVideoPath.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1654299904583-UpdateAssetTableWithEncodeVideoPath.ts rename to server/libs/infra/src/migrations/1654299904583-UpdateAssetTableWithEncodeVideoPath.ts diff --git a/server/libs/infra/src/db/migrations/1655401127251-RenameSharedAlbums.ts b/server/libs/infra/src/migrations/1655401127251-RenameSharedAlbums.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1655401127251-RenameSharedAlbums.ts rename to server/libs/infra/src/migrations/1655401127251-RenameSharedAlbums.ts diff --git a/server/libs/infra/src/db/migrations/1656338626260-RenameIsFirstLoggedInColumn.ts b/server/libs/infra/src/migrations/1656338626260-RenameIsFirstLoggedInColumn.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1656338626260-RenameIsFirstLoggedInColumn.ts rename to server/libs/infra/src/migrations/1656338626260-RenameIsFirstLoggedInColumn.ts diff --git a/server/libs/infra/src/db/migrations/1656888591977-RenameAssetAlbumIdSequence.ts b/server/libs/infra/src/migrations/1656888591977-RenameAssetAlbumIdSequence.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1656888591977-RenameAssetAlbumIdSequence.ts rename to server/libs/infra/src/migrations/1656888591977-RenameAssetAlbumIdSequence.ts diff --git a/server/libs/infra/src/db/migrations/1656888918620-DropExifTextSearchableColumn.ts b/server/libs/infra/src/migrations/1656888918620-DropExifTextSearchableColumn.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1656888918620-DropExifTextSearchableColumn.ts rename to server/libs/infra/src/migrations/1656888918620-DropExifTextSearchableColumn.ts diff --git a/server/libs/infra/src/db/migrations/1656889061566-MatchMigrationsWithTypeORMEntities.ts b/server/libs/infra/src/migrations/1656889061566-MatchMigrationsWithTypeORMEntities.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1656889061566-MatchMigrationsWithTypeORMEntities.ts rename to server/libs/infra/src/migrations/1656889061566-MatchMigrationsWithTypeORMEntities.ts diff --git a/server/libs/infra/src/db/migrations/1658860470248-AddExifImageNameAsSearchableText.ts b/server/libs/infra/src/migrations/1658860470248-AddExifImageNameAsSearchableText.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1658860470248-AddExifImageNameAsSearchableText.ts rename to server/libs/infra/src/migrations/1658860470248-AddExifImageNameAsSearchableText.ts diff --git a/server/libs/infra/src/db/migrations/1661011331242-AddCaption.ts b/server/libs/infra/src/migrations/1661011331242-AddCaption.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1661011331242-AddCaption.ts rename to server/libs/infra/src/migrations/1661011331242-AddCaption.ts diff --git a/server/libs/infra/src/db/migrations/1661528919411-ChangeExifFileSizeInByteToBigInt.ts b/server/libs/infra/src/migrations/1661528919411-ChangeExifFileSizeInByteToBigInt.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1661528919411-ChangeExifFileSizeInByteToBigInt.ts rename to server/libs/infra/src/migrations/1661528919411-ChangeExifFileSizeInByteToBigInt.ts diff --git a/server/libs/infra/src/db/migrations/1661881837496-AddAssetChecksum.ts b/server/libs/infra/src/migrations/1661881837496-AddAssetChecksum.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1661881837496-AddAssetChecksum.ts rename to server/libs/infra/src/migrations/1661881837496-AddAssetChecksum.ts diff --git a/server/libs/infra/src/db/migrations/1661971370662-UpdateAssetTableWithNewUniqueConstraint.ts b/server/libs/infra/src/migrations/1661971370662-UpdateAssetTableWithNewUniqueConstraint.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1661971370662-UpdateAssetTableWithNewUniqueConstraint.ts rename to server/libs/infra/src/migrations/1661971370662-UpdateAssetTableWithNewUniqueConstraint.ts diff --git a/server/libs/infra/src/db/migrations/1662427365521-FixTimestampDataTypeInAssetTable.ts b/server/libs/infra/src/migrations/1662427365521-FixTimestampDataTypeInAssetTable.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1662427365521-FixTimestampDataTypeInAssetTable.ts rename to server/libs/infra/src/migrations/1662427365521-FixTimestampDataTypeInAssetTable.ts diff --git a/server/libs/infra/src/db/migrations/1665540663419-CreateSystemConfigTable.ts b/server/libs/infra/src/migrations/1665540663419-CreateSystemConfigTable.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1665540663419-CreateSystemConfigTable.ts rename to server/libs/infra/src/migrations/1665540663419-CreateSystemConfigTable.ts diff --git a/server/libs/infra/src/db/migrations/1667762360744-AddingDeletedAtColumnInUserEntity.ts b/server/libs/infra/src/migrations/1667762360744-AddingDeletedAtColumnInUserEntity.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1667762360744-AddingDeletedAtColumnInUserEntity.ts rename to server/libs/infra/src/migrations/1667762360744-AddingDeletedAtColumnInUserEntity.ts diff --git a/server/libs/infra/src/db/migrations/1668383120461-AddLivePhotosRelatedColumnToAssetTable.ts b/server/libs/infra/src/migrations/1668383120461-AddLivePhotosRelatedColumnToAssetTable.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1668383120461-AddLivePhotosRelatedColumnToAssetTable.ts rename to server/libs/infra/src/migrations/1668383120461-AddLivePhotosRelatedColumnToAssetTable.ts diff --git a/server/libs/infra/src/db/migrations/1668835311083-UpdateUserTableForOIDC.ts b/server/libs/infra/src/migrations/1668835311083-UpdateUserTableForOIDC.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1668835311083-UpdateUserTableForOIDC.ts rename to server/libs/infra/src/migrations/1668835311083-UpdateUserTableForOIDC.ts diff --git a/server/libs/infra/src/db/migrations/1670104716264-OAuthId.ts b/server/libs/infra/src/migrations/1670104716264-OAuthId.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1670104716264-OAuthId.ts rename to server/libs/infra/src/migrations/1670104716264-OAuthId.ts diff --git a/server/libs/infra/src/db/migrations/1670257571385-CreateTagsTable.ts b/server/libs/infra/src/migrations/1670257571385-CreateTagsTable.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1670257571385-CreateTagsTable.ts rename to server/libs/infra/src/migrations/1670257571385-CreateTagsTable.ts diff --git a/server/libs/infra/src/db/migrations/1670607437008-TruncateOldConfigItems.ts b/server/libs/infra/src/migrations/1670607437008-TruncateOldConfigItems.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1670607437008-TruncateOldConfigItems.ts rename to server/libs/infra/src/migrations/1670607437008-TruncateOldConfigItems.ts diff --git a/server/libs/infra/src/db/migrations/1670633210032-AddUserEmailUniqueConstraint.ts b/server/libs/infra/src/migrations/1670633210032-AddUserEmailUniqueConstraint.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1670633210032-AddUserEmailUniqueConstraint.ts rename to server/libs/infra/src/migrations/1670633210032-AddUserEmailUniqueConstraint.ts diff --git a/server/libs/infra/src/db/migrations/1672109862870-DropSaltColumn.ts b/server/libs/infra/src/migrations/1672109862870-DropSaltColumn.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1672109862870-DropSaltColumn.ts rename to server/libs/infra/src/migrations/1672109862870-DropSaltColumn.ts diff --git a/server/libs/infra/src/db/migrations/1672502270115-AddAPIKeys.ts b/server/libs/infra/src/migrations/1672502270115-AddAPIKeys.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1672502270115-AddAPIKeys.ts rename to server/libs/infra/src/migrations/1672502270115-AddAPIKeys.ts diff --git a/server/libs/infra/src/db/migrations/1673150490490-AddSharedLinkTable.ts b/server/libs/infra/src/migrations/1673150490490-AddSharedLinkTable.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1673150490490-AddSharedLinkTable.ts rename to server/libs/infra/src/migrations/1673150490490-AddSharedLinkTable.ts diff --git a/server/libs/infra/src/db/migrations/1673907194740-AddMorePermissionToSharedLink.ts b/server/libs/infra/src/migrations/1673907194740-AddMorePermissionToSharedLink.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1673907194740-AddMorePermissionToSharedLink.ts rename to server/libs/infra/src/migrations/1673907194740-AddMorePermissionToSharedLink.ts diff --git a/server/libs/infra/src/db/migrations/1674263302005-RemoveVideoCodecConfigOption.ts b/server/libs/infra/src/migrations/1674263302005-RemoveVideoCodecConfigOption.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1674263302005-RemoveVideoCodecConfigOption.ts rename to server/libs/infra/src/migrations/1674263302005-RemoveVideoCodecConfigOption.ts diff --git a/server/libs/infra/src/db/migrations/1674342044239-CreateUserTokenEntity.ts b/server/libs/infra/src/migrations/1674342044239-CreateUserTokenEntity.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1674342044239-CreateUserTokenEntity.ts rename to server/libs/infra/src/migrations/1674342044239-CreateUserTokenEntity.ts diff --git a/server/libs/infra/src/db/migrations/1674757936889-AlterExifExposureTimeToString.ts b/server/libs/infra/src/migrations/1674757936889-AlterExifExposureTimeToString.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1674757936889-AlterExifExposureTimeToString.ts rename to server/libs/infra/src/migrations/1674757936889-AlterExifExposureTimeToString.ts diff --git a/server/libs/infra/src/db/migrations/1674774248319-TruncateAPIKeys.ts b/server/libs/infra/src/migrations/1674774248319-TruncateAPIKeys.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1674774248319-TruncateAPIKeys.ts rename to server/libs/infra/src/migrations/1674774248319-TruncateAPIKeys.ts diff --git a/server/libs/infra/src/db/migrations/1674939383309-AddSharedLinkUserForeignKeyConstraint.ts b/server/libs/infra/src/migrations/1674939383309-AddSharedLinkUserForeignKeyConstraint.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1674939383309-AddSharedLinkUserForeignKeyConstraint.ts rename to server/libs/infra/src/migrations/1674939383309-AddSharedLinkUserForeignKeyConstraint.ts diff --git a/server/libs/infra/src/db/migrations/1675667878312-AddUpdatedAtColumnToAlbumsUsersAssets.ts b/server/libs/infra/src/migrations/1675667878312-AddUpdatedAtColumnToAlbumsUsersAssets.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1675667878312-AddUpdatedAtColumnToAlbumsUsersAssets.ts rename to server/libs/infra/src/migrations/1675667878312-AddUpdatedAtColumnToAlbumsUsersAssets.ts diff --git a/server/libs/infra/src/db/migrations/1675701909594-AddAlbumUserForeignKeyConstraint.ts b/server/libs/infra/src/migrations/1675701909594-AddAlbumUserForeignKeyConstraint.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1675701909594-AddAlbumUserForeignKeyConstraint.ts rename to server/libs/infra/src/migrations/1675701909594-AddAlbumUserForeignKeyConstraint.ts diff --git a/server/libs/infra/src/db/migrations/1675808874445-APIKeyUUIDPrimaryKey.ts b/server/libs/infra/src/migrations/1675808874445-APIKeyUUIDPrimaryKey.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1675808874445-APIKeyUUIDPrimaryKey.ts rename to server/libs/infra/src/migrations/1675808874445-APIKeyUUIDPrimaryKey.ts diff --git a/server/libs/infra/src/db/migrations/1675812532822-FixAlbumEntityTypeORM.ts b/server/libs/infra/src/migrations/1675812532822-FixAlbumEntityTypeORM.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1675812532822-FixAlbumEntityTypeORM.ts rename to server/libs/infra/src/migrations/1675812532822-FixAlbumEntityTypeORM.ts diff --git a/server/libs/infra/src/db/migrations/1676437878377-AppleContentIdentifier.ts b/server/libs/infra/src/migrations/1676437878377-AppleContentIdentifier.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1676437878377-AppleContentIdentifier.ts rename to server/libs/infra/src/migrations/1676437878377-AppleContentIdentifier.ts diff --git a/server/libs/infra/src/db/migrations/1676680127415-FixAssetRelations.ts b/server/libs/infra/src/migrations/1676680127415-FixAssetRelations.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1676680127415-FixAssetRelations.ts rename to server/libs/infra/src/migrations/1676680127415-FixAssetRelations.ts diff --git a/server/libs/infra/src/db/migrations/1676721296440-AssetCreatedAtField.ts b/server/libs/infra/src/migrations/1676721296440-AssetCreatedAtField.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1676721296440-AssetCreatedAtField.ts rename to server/libs/infra/src/migrations/1676721296440-AssetCreatedAtField.ts diff --git a/server/libs/infra/src/db/migrations/1676848629119-ExifEntityDefinitionFixes.ts b/server/libs/infra/src/migrations/1676848629119-ExifEntityDefinitionFixes.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1676848629119-ExifEntityDefinitionFixes.ts rename to server/libs/infra/src/migrations/1676848629119-ExifEntityDefinitionFixes.ts diff --git a/server/libs/infra/src/db/migrations/1676848694786-SharedLinkEntityDefinitionFixes.ts b/server/libs/infra/src/migrations/1676848694786-SharedLinkEntityDefinitionFixes.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1676848694786-SharedLinkEntityDefinitionFixes.ts rename to server/libs/infra/src/migrations/1676848694786-SharedLinkEntityDefinitionFixes.ts diff --git a/server/libs/infra/src/db/migrations/1676852143506-SmartInfoEntityDefinitionFixes.ts b/server/libs/infra/src/migrations/1676852143506-SmartInfoEntityDefinitionFixes.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1676852143506-SmartInfoEntityDefinitionFixes.ts rename to server/libs/infra/src/migrations/1676852143506-SmartInfoEntityDefinitionFixes.ts diff --git a/server/libs/infra/src/db/migrations/1677535643119-AddIndexForAlbumInSharedLinkTable.ts b/server/libs/infra/src/migrations/1677535643119-AddIndexForAlbumInSharedLinkTable.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1677535643119-AddIndexForAlbumInSharedLinkTable.ts rename to server/libs/infra/src/migrations/1677535643119-AddIndexForAlbumInSharedLinkTable.ts diff --git a/server/libs/infra/src/db/migrations/1677613712565-AlbumThumbnailRelation.ts b/server/libs/infra/src/migrations/1677613712565-AlbumThumbnailRelation.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1677613712565-AlbumThumbnailRelation.ts rename to server/libs/infra/src/migrations/1677613712565-AlbumThumbnailRelation.ts diff --git a/server/libs/infra/src/db/migrations/1677971458822-AddCLIPEncodeDataColumn.ts b/server/libs/infra/src/migrations/1677971458822-AddCLIPEncodeDataColumn.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1677971458822-AddCLIPEncodeDataColumn.ts rename to server/libs/infra/src/migrations/1677971458822-AddCLIPEncodeDataColumn.ts diff --git a/server/libs/infra/src/db/migrations/1679751316282-UpdateTranscodeOption.ts b/server/libs/infra/src/migrations/1679751316282-UpdateTranscodeOption.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1679751316282-UpdateTranscodeOption.ts rename to server/libs/infra/src/migrations/1679751316282-UpdateTranscodeOption.ts diff --git a/server/libs/infra/src/db/migrations/1679901204458-ClipEmbeddingFloat4.ts b/server/libs/infra/src/migrations/1679901204458-ClipEmbeddingFloat4.ts similarity index 100% rename from server/libs/infra/src/db/migrations/1679901204458-ClipEmbeddingFloat4.ts rename to server/libs/infra/src/migrations/1679901204458-ClipEmbeddingFloat4.ts diff --git a/server/libs/infra/src/db/repository/album.repository.ts b/server/libs/infra/src/repositories/album.repository.ts similarity index 98% rename from server/libs/infra/src/db/repository/album.repository.ts rename to server/libs/infra/src/repositories/album.repository.ts index 2187ceabdd..94eb17ad76 100644 --- a/server/libs/infra/src/db/repository/album.repository.ts +++ b/server/libs/infra/src/repositories/album.repository.ts @@ -2,7 +2,7 @@ import { AlbumAssetCount, IAlbumRepository } from '@app/domain'; import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { In, IsNull, Not, Repository } from 'typeorm'; -import { dataSource } from '../config'; +import { dataSource } from '../database.config'; import { AlbumEntity } from '../entities'; @Injectable() diff --git a/server/libs/infra/src/db/repository/api-key.repository.ts b/server/libs/infra/src/repositories/api-key.repository.ts similarity index 100% rename from server/libs/infra/src/db/repository/api-key.repository.ts rename to server/libs/infra/src/repositories/api-key.repository.ts diff --git a/server/libs/infra/src/db/repository/asset.repository.ts b/server/libs/infra/src/repositories/asset.repository.ts similarity index 100% rename from server/libs/infra/src/db/repository/asset.repository.ts rename to server/libs/infra/src/repositories/asset.repository.ts diff --git a/server/libs/infra/src/communication/communication.repository.ts b/server/libs/infra/src/repositories/communication.repository.ts similarity index 83% rename from server/libs/infra/src/communication/communication.repository.ts rename to server/libs/infra/src/repositories/communication.repository.ts index e0320076cc..e2158c9fc0 100644 --- a/server/libs/infra/src/communication/communication.repository.ts +++ b/server/libs/infra/src/repositories/communication.repository.ts @@ -1,6 +1,6 @@ import { CommunicationEvent } from '@app/domain'; import { Injectable } from '@nestjs/common'; -import { CommunicationGateway } from './communication.gateway'; +import { CommunicationGateway } from '../communication.gateway'; @Injectable() export class CommunicationRepository { diff --git a/server/libs/infra/src/auth/crypto.repository.ts b/server/libs/infra/src/repositories/crypto.repository.ts similarity index 100% rename from server/libs/infra/src/auth/crypto.repository.ts rename to server/libs/infra/src/repositories/crypto.repository.ts diff --git a/server/libs/infra/src/db/repository/device-info.repository.ts b/server/libs/infra/src/repositories/device-info.repository.ts similarity index 100% rename from server/libs/infra/src/db/repository/device-info.repository.ts rename to server/libs/infra/src/repositories/device-info.repository.ts diff --git a/server/libs/infra/src/storage/filesystem.provider.ts b/server/libs/infra/src/repositories/filesystem.provider.ts similarity index 100% rename from server/libs/infra/src/storage/filesystem.provider.ts rename to server/libs/infra/src/repositories/filesystem.provider.ts diff --git a/server/libs/infra/src/db/repository/index.ts b/server/libs/infra/src/repositories/index.ts similarity index 56% rename from server/libs/infra/src/db/repository/index.ts rename to server/libs/infra/src/repositories/index.ts index 1696cc6d97..dca8e811bb 100644 --- a/server/libs/infra/src/db/repository/index.ts +++ b/server/libs/infra/src/repositories/index.ts @@ -1,9 +1,16 @@ export * from './album.repository'; export * from './api-key.repository'; export * from './asset.repository'; +export * from './communication.repository'; +export * from './crypto.repository'; export * from './device-info.repository'; +export * from './filesystem.provider'; +export * from './job.repository'; +export * from './machine-learning.repository'; +export * from './media.repository'; export * from './shared-link.repository'; export * from './smart-info.repository'; export * from './system-config.repository'; +export * from './typesense.repository'; export * from './user-token.repository'; export * from './user.repository'; diff --git a/server/libs/infra/src/job/job.repository.ts b/server/libs/infra/src/repositories/job.repository.ts similarity index 100% rename from server/libs/infra/src/job/job.repository.ts rename to server/libs/infra/src/repositories/job.repository.ts diff --git a/server/libs/infra/src/machine-learning/machine-learning.repository.ts b/server/libs/infra/src/repositories/machine-learning.repository.ts similarity index 100% rename from server/libs/infra/src/machine-learning/machine-learning.repository.ts rename to server/libs/infra/src/repositories/machine-learning.repository.ts diff --git a/server/libs/infra/src/media/media.repository.ts b/server/libs/infra/src/repositories/media.repository.ts similarity index 100% rename from server/libs/infra/src/media/media.repository.ts rename to server/libs/infra/src/repositories/media.repository.ts diff --git a/server/libs/infra/src/db/repository/shared-link.repository.ts b/server/libs/infra/src/repositories/shared-link.repository.ts similarity index 100% rename from server/libs/infra/src/db/repository/shared-link.repository.ts rename to server/libs/infra/src/repositories/shared-link.repository.ts diff --git a/server/libs/infra/src/db/repository/smart-info.repository.ts b/server/libs/infra/src/repositories/smart-info.repository.ts similarity index 100% rename from server/libs/infra/src/db/repository/smart-info.repository.ts rename to server/libs/infra/src/repositories/smart-info.repository.ts diff --git a/server/libs/infra/src/db/repository/system-config.repository.ts b/server/libs/infra/src/repositories/system-config.repository.ts similarity index 100% rename from server/libs/infra/src/db/repository/system-config.repository.ts rename to server/libs/infra/src/repositories/system-config.repository.ts diff --git a/server/libs/infra/src/search/typesense.repository.ts b/server/libs/infra/src/repositories/typesense.repository.ts similarity index 95% rename from server/libs/infra/src/search/typesense.repository.ts rename to server/libs/infra/src/repositories/typesense.repository.ts index 136071351b..6e3a2115f8 100644 --- a/server/libs/infra/src/search/typesense.repository.ts +++ b/server/libs/infra/src/repositories/typesense.repository.ts @@ -12,9 +12,9 @@ import { catchError, filter, firstValueFrom, from, map, mergeMap, of, toArray } import { Client } from 'typesense'; import { CollectionCreateSchema } from 'typesense/lib/Typesense/Collections'; import { DocumentSchema, SearchResponse } from 'typesense/lib/Typesense/Documents'; -import { AlbumEntity, AssetEntity } from '../db'; -import { albumSchema } from './schemas/album.schema'; -import { assetSchema } from './schemas/asset.schema'; +import { AlbumEntity, AssetEntity } from '../entities'; +import { typesenseConfig } from '../infra.config'; +import { albumSchema, assetSchema } from '../typesense-schemas'; function removeNil>(item: T): T { _.forOwn(item, (value, key) => { @@ -51,24 +51,11 @@ export class TypesenseRepository implements ISearchRepository { } constructor() { - const apiKey = process.env.TYPESENSE_API_KEY; - if (!apiKey) { + if (!typesenseConfig.apiKey) { return; } - this._client = new Client({ - nodes: [ - { - host: process.env.TYPESENSE_HOST || 'typesense', - port: Number(process.env.TYPESENSE_PORT) || 8108, - protocol: process.env.TYPESENSE_PROTOCOL || 'http', - }, - ], - apiKey, - numRetries: 15, - retryIntervalSeconds: 4, - connectionTimeoutSeconds: 10, - }); + this._client = new Client(typesenseConfig); } async setup(): Promise { diff --git a/server/libs/infra/src/db/repository/user-token.repository.ts b/server/libs/infra/src/repositories/user-token.repository.ts similarity index 93% rename from server/libs/infra/src/db/repository/user-token.repository.ts rename to server/libs/infra/src/repositories/user-token.repository.ts index 0f42dfa2a7..6a1802397f 100644 --- a/server/libs/infra/src/db/repository/user-token.repository.ts +++ b/server/libs/infra/src/repositories/user-token.repository.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; -import { UserTokenEntity } from '../entities/user-token.entity'; +import { UserTokenEntity } from '../entities'; import { IUserTokenRepository } from '@app/domain/user-token'; @Injectable() diff --git a/server/libs/infra/src/db/repository/user.repository.ts b/server/libs/infra/src/repositories/user.repository.ts similarity index 100% rename from server/libs/infra/src/db/repository/user.repository.ts rename to server/libs/infra/src/repositories/user.repository.ts index b6849d30f8..9206415576 100644 --- a/server/libs/infra/src/db/repository/user.repository.ts +++ b/server/libs/infra/src/repositories/user.repository.ts @@ -1,8 +1,8 @@ -import { UserEntity } from '../entities'; import { IUserRepository, UserListFilter, UserStatsQueryResponse } from '@app/domain'; import { Injectable, InternalServerErrorException } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { IsNull, Not, Repository } from 'typeorm'; +import { UserEntity } from '../entities'; @Injectable() export class UserRepository implements IUserRepository { diff --git a/server/libs/infra/src/search/index.ts b/server/libs/infra/src/search/index.ts deleted file mode 100644 index c7673993aa..0000000000 --- a/server/libs/infra/src/search/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './typesense.repository'; diff --git a/server/libs/infra/src/storage/index.ts b/server/libs/infra/src/storage/index.ts deleted file mode 100644 index ae8187f1fe..0000000000 --- a/server/libs/infra/src/storage/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './filesystem.provider'; diff --git a/server/libs/infra/src/search/schemas/album.schema.ts b/server/libs/infra/src/typesense-schemas/album.schema.ts similarity index 100% rename from server/libs/infra/src/search/schemas/album.schema.ts rename to server/libs/infra/src/typesense-schemas/album.schema.ts diff --git a/server/libs/infra/src/search/schemas/asset.schema.ts b/server/libs/infra/src/typesense-schemas/asset.schema.ts similarity index 100% rename from server/libs/infra/src/search/schemas/asset.schema.ts rename to server/libs/infra/src/typesense-schemas/asset.schema.ts diff --git a/server/libs/infra/src/typesense-schemas/index.ts b/server/libs/infra/src/typesense-schemas/index.ts new file mode 100644 index 0000000000..d002910221 --- /dev/null +++ b/server/libs/infra/src/typesense-schemas/index.ts @@ -0,0 +1,2 @@ +export * from './album.schema'; +export * from './asset.schema'; diff --git a/server/package.json b/server/package.json index 84b01457bc..7a6d609ada 100644 --- a/server/package.json +++ b/server/package.json @@ -30,10 +30,10 @@ "test:e2e": "jest --config ./apps/immich/test/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/db/config/database.config.ts", - "typeorm:migrations:run": "node --require ts-node/register ./node_modules/typeorm/cli.js migration:run -d ./libs/infra/src/db/config/database.config.ts", - "typeorm:migrations:revert": "node --require ts-node/register ./node_modules/typeorm/cli.js migration:revert -d ./libs/infra/src/db/config/database.config.ts", - "typeorm:schema:drop": "node --require ts-node/register ./node_modules/typeorm/cli.js schema:drop -d ./libs/infra/src/db/config/database.config.ts", + "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: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",