mirror of
https://github.com/immich-app/immich.git
synced 2024-12-28 22:51:59 +00:00
refactor(server): flatten infra folders (#2120)
* refactor: flatten infra folders * fix: database migrations * fix: test related import * fix: github actions workflow * chore: rename schemas to typesense-schemas
This commit is contained in:
parent
468e620372
commit
34d300d1da
176 changed files with 185 additions and 176 deletions
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
|
@ -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: |
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { AlbumEntity } from '@app/infra/db/entities';
|
||||
import { AlbumEntity } from '@app/infra/entities';
|
||||
|
||||
export const IAlbumRepository = 'IAlbumRepository';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { APIKeyEntity } from '@app/infra/db/entities';
|
||||
import { APIKeyEntity } from '@app/infra/entities';
|
||||
|
||||
export const IKeyRepository = 'IKeyRepository';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { APIKeyEntity } from '@app/infra/db/entities';
|
||||
import { APIKeyEntity } from '@app/infra/entities';
|
||||
|
||||
export class APIKeyResponseDto {
|
||||
id!: string;
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { AssetEntity, AssetType } from '@app/infra/db/entities';
|
||||
import { AssetEntity, AssetType } from '@app/infra/entities';
|
||||
|
||||
export interface AssetSearchOptions {
|
||||
isVisible?: boolean;
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { SmartInfoEntity } from '@app/infra/db/entities';
|
||||
import { SmartInfoEntity } from '@app/infra/entities';
|
||||
|
||||
export class SmartInfoResponseDto {
|
||||
tags?: string[] | null;
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { SystemConfig } from '@app/infra/db/entities';
|
||||
import { SystemConfig } from '@app/infra/entities';
|
||||
import {
|
||||
BadRequestException,
|
||||
Inject,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { UserEntity } from '@app/infra/db/entities';
|
||||
import { UserEntity } from '@app/infra/entities';
|
||||
|
||||
export class AdminSignupResponseDto {
|
||||
id!: string;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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<DeviceInfoEntity, 'deviceId' | 'userId'>;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { DeviceInfoEntity } from '@app/infra/db/entities';
|
||||
import { DeviceInfoEntity } from '@app/infra/entities';
|
||||
|
||||
export const IDeviceInfoRepository = 'IDeviceInfoRepository';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { AssetEntity, SharedLinkEntity } from '@app/infra/db/entities';
|
||||
import { AssetEntity, SharedLinkEntity } from '@app/infra/entities';
|
||||
import {
|
||||
BadRequestException,
|
||||
ForbiddenException,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { SharedLinkEntity } from '@app/infra/db/entities';
|
||||
import { SharedLinkEntity } from '@app/infra/entities';
|
||||
|
||||
export const ISharedLinkRepository = 'ISharedLinkRepository';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { SmartInfoEntity } from '@app/infra/db/entities';
|
||||
import { SmartInfoEntity } from '@app/infra/entities';
|
||||
|
||||
export const ISmartInfoRepository = 'ISmartInfoRepository';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { AssetEntity } from '@app/infra/db/entities';
|
||||
import { AssetEntity } from '@app/infra/entities';
|
||||
import {
|
||||
assetEntityStub,
|
||||
newAssetRepositoryMock,
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { SystemConfigEntity } from '@app/infra/db/entities';
|
||||
import { SystemConfigEntity } from '@app/infra/entities';
|
||||
|
||||
export const ISystemConfigRepository = 'ISystemConfigRepository';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { UserTokenEntity } from '@app/infra/db/entities';
|
||||
import { UserTokenEntity } from '@app/infra/entities';
|
||||
|
||||
export const IUserTokenRepository = 'IUserTokenRepository';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { UserEntity } from '@app/infra/db/entities';
|
||||
import { UserEntity } from '@app/infra/entities';
|
||||
|
||||
export class UserResponseDto {
|
||||
id!: string;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { UserEntity } from '@app/infra/db/entities';
|
||||
import { UserEntity } from '@app/infra/entities';
|
||||
import {
|
||||
BadRequestException,
|
||||
ForbiddenException,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { UserEntity } from '@app/infra/db/entities';
|
||||
import { UserEntity } from '@app/infra/entities';
|
||||
|
||||
export interface UserListFilter {
|
||||
excludeId?: string;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
TranscodePreset,
|
||||
UserEntity,
|
||||
UserTokenEntity,
|
||||
} from '@app/infra/db/entities';
|
||||
} from '@app/infra/entities';
|
||||
import {
|
||||
AlbumResponseDto,
|
||||
AssetResponseDto,
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
export * from './communication.gateway';
|
||||
export * from './communication.repository';
|
|
@ -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);
|
|
@ -1 +0,0 @@
|
|||
export * from './database.config';
|
|
@ -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';
|
|
@ -1,3 +0,0 @@
|
|||
export * from './config';
|
||||
export * from './entities';
|
||||
export * from './repository';
|
33
server/libs/infra/src/entities/index.ts
Normal file
33
server/libs/infra/src/entities/index.ts
Normal file
|
@ -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,
|
||||
];
|
|
@ -1,2 +1,3 @@
|
|||
export * from './db';
|
||||
export * from './database.config';
|
||||
export * from './infra.config';
|
||||
export * from './infra.module';
|
||||
|
|
35
server/libs/infra/src/infra.config.ts
Normal file
35
server/libs/infra/src/infra.config.ts
Normal file
|
@ -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,
|
||||
};
|
|
@ -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],
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
export * from './job.repository';
|
|
@ -1 +0,0 @@
|
|||
export * from './machine-learning.repository';
|
|
@ -1 +0,0 @@
|
|||
export * from './media.repository';
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue