mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	refactor(server): imports and repository tokens (#1220)
* refactor: entity imports * refactor: rename user repository token * chore: merge imports * refactor: rename album repository token * refactor: rename asset repository token * refactor: rename tag repository token
This commit is contained in:
		@@ -1,5 +1,4 @@
 | 
				
			|||||||
import { DatabaseModule } from '@app/database';
 | 
					import { DatabaseModule, UserEntity } from '@app/database';
 | 
				
			||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					 | 
				
			||||||
import { Module } from '@nestjs/common';
 | 
					import { Module } from '@nestjs/common';
 | 
				
			||||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
					import { TypeOrmModule } from '@nestjs/typeorm';
 | 
				
			||||||
import { PromptPasswordQuestions, ResetAdminPasswordCommand } from './commands/reset-admin-password.command';
 | 
					import { PromptPasswordQuestions, ResetAdminPasswordCommand } from './commands/reset-admin-password.command';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
import { InjectRepository } from '@nestjs/typeorm';
 | 
					import { InjectRepository } from '@nestjs/typeorm';
 | 
				
			||||||
import bcrypt from 'bcrypt';
 | 
					import bcrypt from 'bcrypt';
 | 
				
			||||||
import { Command, CommandRunner, InquirerService, Question, QuestionSet } from 'nest-commander';
 | 
					import { Command, CommandRunner, InquirerService, Question, QuestionSet } from 'nest-commander';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,4 @@
 | 
				
			|||||||
import { AlbumEntity } from '@app/database/entities/album.entity';
 | 
					import { AlbumEntity, AssetAlbumEntity, UserAlbumEntity } from '@app/database';
 | 
				
			||||||
import { AssetAlbumEntity } from '@app/database/entities/asset-album.entity';
 | 
					 | 
				
			||||||
import { UserAlbumEntity } from '@app/database/entities/user-album.entity';
 | 
					 | 
				
			||||||
import { Injectable } from '@nestjs/common';
 | 
					import { Injectable } from '@nestjs/common';
 | 
				
			||||||
import { InjectRepository } from '@nestjs/typeorm';
 | 
					import { InjectRepository } from '@nestjs/typeorm';
 | 
				
			||||||
import { In, Repository, SelectQueryBuilder, DataSource, Brackets } from 'typeorm';
 | 
					import { In, Repository, SelectQueryBuilder, DataSource, Brackets } from 'typeorm';
 | 
				
			||||||
@@ -28,7 +26,7 @@ export interface IAlbumRepository {
 | 
				
			|||||||
  getSharedWithUserAlbumCount(userId: string, assetId: string): Promise<number>;
 | 
					  getSharedWithUserAlbumCount(userId: string, assetId: string): Promise<number>;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const ALBUM_REPOSITORY = 'ALBUM_REPOSITORY';
 | 
					export const IAlbumRepository = 'IAlbumRepository';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Injectable()
 | 
					@Injectable()
 | 
				
			||||||
export class AlbumRepository implements IAlbumRepository {
 | 
					export class AlbumRepository implements IAlbumRepository {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,16 +2,14 @@ import { forwardRef, Module } from '@nestjs/common';
 | 
				
			|||||||
import { AlbumService } from './album.service';
 | 
					import { AlbumService } from './album.service';
 | 
				
			||||||
import { AlbumController } from './album.controller';
 | 
					import { AlbumController } from './album.controller';
 | 
				
			||||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
					import { TypeOrmModule } from '@nestjs/typeorm';
 | 
				
			||||||
import { AlbumEntity } from '../../../../../libs/database/src/entities/album.entity';
 | 
					import { AlbumEntity, AssetAlbumEntity, UserAlbumEntity } from '@app/database';
 | 
				
			||||||
import { AssetAlbumEntity } from '@app/database/entities/asset-album.entity';
 | 
					import { AlbumRepository, IAlbumRepository } from './album-repository';
 | 
				
			||||||
import { UserAlbumEntity } from '@app/database/entities/user-album.entity';
 | 
					 | 
				
			||||||
import { AlbumRepository, ALBUM_REPOSITORY } from './album-repository';
 | 
					 | 
				
			||||||
import { DownloadModule } from '../../modules/download/download.module';
 | 
					import { DownloadModule } from '../../modules/download/download.module';
 | 
				
			||||||
import { AssetModule } from '../asset/asset.module';
 | 
					import { AssetModule } from '../asset/asset.module';
 | 
				
			||||||
import { UserModule } from '../user/user.module';
 | 
					import { UserModule } from '../user/user.module';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const ALBUM_REPOSITORY_PROVIDER = {
 | 
					const ALBUM_REPOSITORY_PROVIDER = {
 | 
				
			||||||
  provide: ALBUM_REPOSITORY,
 | 
					  provide: IAlbumRepository,
 | 
				
			||||||
  useClass: AlbumRepository,
 | 
					  useClass: AlbumRepository,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
import { AlbumService } from './album.service';
 | 
					import { AlbumService } from './album.service';
 | 
				
			||||||
import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
					import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
				
			||||||
import { BadRequestException, NotFoundException, ForbiddenException } from '@nestjs/common';
 | 
					import { BadRequestException, NotFoundException, ForbiddenException } from '@nestjs/common';
 | 
				
			||||||
import { AlbumEntity } from '@app/database/entities/album.entity';
 | 
					import { AlbumEntity } from '@app/database';
 | 
				
			||||||
import { AlbumResponseDto } from './response-dto/album-response.dto';
 | 
					import { AlbumResponseDto } from './response-dto/album-response.dto';
 | 
				
			||||||
import { IAssetRepository } from '../asset/asset-repository';
 | 
					import { IAssetRepository } from '../asset/asset-repository';
 | 
				
			||||||
import { AddAssetsResponseDto } from './response-dto/add-assets-response.dto';
 | 
					import { AddAssetsResponseDto } from './response-dto/add-assets-response.dto';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,15 +1,15 @@
 | 
				
			|||||||
import { BadRequestException, Inject, Injectable, NotFoundException, ForbiddenException } from '@nestjs/common';
 | 
					import { BadRequestException, Inject, Injectable, NotFoundException, ForbiddenException } from '@nestjs/common';
 | 
				
			||||||
import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
					import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
				
			||||||
import { CreateAlbumDto } from './dto/create-album.dto';
 | 
					import { CreateAlbumDto } from './dto/create-album.dto';
 | 
				
			||||||
import { AlbumEntity } from '@app/database/entities/album.entity';
 | 
					import { AlbumEntity } from '@app/database';
 | 
				
			||||||
import { AddUsersDto } from './dto/add-users.dto';
 | 
					import { AddUsersDto } from './dto/add-users.dto';
 | 
				
			||||||
import { RemoveAssetsDto } from './dto/remove-assets.dto';
 | 
					import { RemoveAssetsDto } from './dto/remove-assets.dto';
 | 
				
			||||||
import { UpdateAlbumDto } from './dto/update-album.dto';
 | 
					import { UpdateAlbumDto } from './dto/update-album.dto';
 | 
				
			||||||
import { GetAlbumsDto } from './dto/get-albums.dto';
 | 
					import { GetAlbumsDto } from './dto/get-albums.dto';
 | 
				
			||||||
import { AlbumResponseDto, mapAlbum, mapAlbumExcludeAssetInfo } from './response-dto/album-response.dto';
 | 
					import { AlbumResponseDto, mapAlbum, mapAlbumExcludeAssetInfo } from './response-dto/album-response.dto';
 | 
				
			||||||
import { ALBUM_REPOSITORY, IAlbumRepository } from './album-repository';
 | 
					import { IAlbumRepository } from './album-repository';
 | 
				
			||||||
import { AlbumCountResponseDto } from './response-dto/album-count-response.dto';
 | 
					import { AlbumCountResponseDto } from './response-dto/album-count-response.dto';
 | 
				
			||||||
import { ASSET_REPOSITORY, IAssetRepository } from '../asset/asset-repository';
 | 
					import { IAssetRepository } from '../asset/asset-repository';
 | 
				
			||||||
import { AddAssetsResponseDto } from './response-dto/add-assets-response.dto';
 | 
					import { AddAssetsResponseDto } from './response-dto/add-assets-response.dto';
 | 
				
			||||||
import { AddAssetsDto } from './dto/add-assets.dto';
 | 
					import { AddAssetsDto } from './dto/add-assets.dto';
 | 
				
			||||||
import { DownloadService } from '../../modules/download/download.service';
 | 
					import { DownloadService } from '../../modules/download/download.service';
 | 
				
			||||||
@@ -18,8 +18,8 @@ import { DownloadDto } from '../asset/dto/download-library.dto';
 | 
				
			|||||||
@Injectable()
 | 
					@Injectable()
 | 
				
			||||||
export class AlbumService {
 | 
					export class AlbumService {
 | 
				
			||||||
  constructor(
 | 
					  constructor(
 | 
				
			||||||
    @Inject(ALBUM_REPOSITORY) private _albumRepository: IAlbumRepository,
 | 
					    @Inject(IAlbumRepository) private _albumRepository: IAlbumRepository,
 | 
				
			||||||
    @Inject(ASSET_REPOSITORY) private _assetRepository: IAssetRepository,
 | 
					    @Inject(IAssetRepository) private _assetRepository: IAssetRepository,
 | 
				
			||||||
    private downloadService: DownloadService,
 | 
					    private downloadService: DownloadService,
 | 
				
			||||||
  ) {}
 | 
					  ) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { AlbumEntity } from '../../../../../../libs/database/src/entities/album.entity';
 | 
					import { AlbumEntity } from '@app/database';
 | 
				
			||||||
import { UserResponseDto, mapUser } from '../../user/response-dto/user-response.dto';
 | 
					import { UserResponseDto, mapUser } from '../../user/response-dto/user-response.dto';
 | 
				
			||||||
import { AssetResponseDto, mapAsset } from '../../asset/response-dto/asset-response.dto';
 | 
					import { AssetResponseDto, mapAsset } from '../../asset/response-dto/asset-response.dto';
 | 
				
			||||||
import { ApiProperty } from '@nestjs/swagger';
 | 
					import { ApiProperty } from '@nestjs/swagger';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
import { SearchPropertiesDto } from './dto/search-properties.dto';
 | 
					import { SearchPropertiesDto } from './dto/search-properties.dto';
 | 
				
			||||||
import { CuratedLocationsResponseDto } from './response-dto/curated-locations-response.dto';
 | 
					import { CuratedLocationsResponseDto } from './response-dto/curated-locations-response.dto';
 | 
				
			||||||
import { AssetEntity, AssetType } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity, AssetType } from '@app/database';
 | 
				
			||||||
import { BadRequestException, Inject, Injectable } from '@nestjs/common';
 | 
					import { BadRequestException, Inject, Injectable } from '@nestjs/common';
 | 
				
			||||||
import { InjectRepository } from '@nestjs/typeorm';
 | 
					import { InjectRepository } from '@nestjs/typeorm';
 | 
				
			||||||
import { Repository } from 'typeorm/repository/Repository';
 | 
					import { Repository } from 'typeorm/repository/Repository';
 | 
				
			||||||
@@ -14,7 +14,7 @@ import { CheckExistingAssetsDto } from './dto/check-existing-assets.dto';
 | 
				
			|||||||
import { CheckExistingAssetsResponseDto } from './response-dto/check-existing-assets-response.dto';
 | 
					import { CheckExistingAssetsResponseDto } from './response-dto/check-existing-assets-response.dto';
 | 
				
			||||||
import { In } from 'typeorm/find-options/operator/In';
 | 
					import { In } from 'typeorm/find-options/operator/In';
 | 
				
			||||||
import { UpdateAssetDto } from './dto/update-asset.dto';
 | 
					import { UpdateAssetDto } from './dto/update-asset.dto';
 | 
				
			||||||
import { ITagRepository, TAG_REPOSITORY } from '../tag/tag.repository';
 | 
					import { ITagRepository } from '../tag/tag.repository';
 | 
				
			||||||
import { IsNull } from 'typeorm';
 | 
					import { IsNull } from 'typeorm';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IAssetRepository {
 | 
					export interface IAssetRepository {
 | 
				
			||||||
@@ -48,7 +48,7 @@ export interface IAssetRepository {
 | 
				
			|||||||
  countByIdAndUser(assetId: string, userId: string): Promise<number>;
 | 
					  countByIdAndUser(assetId: string, userId: string): Promise<number>;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const ASSET_REPOSITORY = 'ASSET_REPOSITORY';
 | 
					export const IAssetRepository = 'IAssetRepository';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Injectable()
 | 
					@Injectable()
 | 
				
			||||||
export class AssetRepository implements IAssetRepository {
 | 
					export class AssetRepository implements IAssetRepository {
 | 
				
			||||||
@@ -56,7 +56,7 @@ export class AssetRepository implements IAssetRepository {
 | 
				
			|||||||
    @InjectRepository(AssetEntity)
 | 
					    @InjectRepository(AssetEntity)
 | 
				
			||||||
    private assetRepository: Repository<AssetEntity>,
 | 
					    private assetRepository: Repository<AssetEntity>,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Inject(TAG_REPOSITORY) private _tagRepository: ITagRepository,
 | 
					    @Inject(ITagRepository) private _tagRepository: ITagRepository,
 | 
				
			||||||
  ) {}
 | 
					  ) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async getAssetWithNoSmartInfo(): Promise<AssetEntity[]> {
 | 
					  async getAssetWithNoSmartInfo(): Promise<AssetEntity[]> {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,12 +2,12 @@ import { forwardRef, Module } from '@nestjs/common';
 | 
				
			|||||||
import { AssetService } from './asset.service';
 | 
					import { AssetService } from './asset.service';
 | 
				
			||||||
import { AssetController } from './asset.controller';
 | 
					import { AssetController } from './asset.controller';
 | 
				
			||||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
					import { TypeOrmModule } from '@nestjs/typeorm';
 | 
				
			||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity } from '@app/database';
 | 
				
			||||||
import { BullModule } from '@nestjs/bull';
 | 
					import { BullModule } from '@nestjs/bull';
 | 
				
			||||||
import { BackgroundTaskModule } from '../../modules/background-task/background-task.module';
 | 
					import { BackgroundTaskModule } from '../../modules/background-task/background-task.module';
 | 
				
			||||||
import { BackgroundTaskService } from '../../modules/background-task/background-task.service';
 | 
					import { BackgroundTaskService } from '../../modules/background-task/background-task.service';
 | 
				
			||||||
import { CommunicationModule } from '../communication/communication.module';
 | 
					import { CommunicationModule } from '../communication/communication.module';
 | 
				
			||||||
import { AssetRepository, ASSET_REPOSITORY } from './asset-repository';
 | 
					import { AssetRepository, IAssetRepository } from './asset-repository';
 | 
				
			||||||
import { DownloadModule } from '../../modules/download/download.module';
 | 
					import { DownloadModule } from '../../modules/download/download.module';
 | 
				
			||||||
import { TagModule } from '../tag/tag.module';
 | 
					import { TagModule } from '../tag/tag.module';
 | 
				
			||||||
import { AlbumModule } from '../album/album.module';
 | 
					import { AlbumModule } from '../album/album.module';
 | 
				
			||||||
@@ -16,7 +16,7 @@ import { StorageModule } from '@app/storage';
 | 
				
			|||||||
import { immichSharedQueues } from '@app/job/constants/bull-queue-registration.constant';
 | 
					import { immichSharedQueues } from '@app/job/constants/bull-queue-registration.constant';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const ASSET_REPOSITORY_PROVIDER = {
 | 
					const ASSET_REPOSITORY_PROVIDER = {
 | 
				
			||||||
  provide: ASSET_REPOSITORY,
 | 
					  provide: IAssetRepository,
 | 
				
			||||||
  useClass: AssetRepository,
 | 
					  useClass: AssetRepository,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@ import { IAssetRepository } from './asset-repository';
 | 
				
			|||||||
import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
					import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
				
			||||||
import { AssetService } from './asset.service';
 | 
					import { AssetService } from './asset.service';
 | 
				
			||||||
import { Repository } from 'typeorm';
 | 
					import { Repository } from 'typeorm';
 | 
				
			||||||
import { AssetEntity, AssetType } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity, AssetType } from '@app/database';
 | 
				
			||||||
import { CreateAssetDto } from './dto/create-asset.dto';
 | 
					import { CreateAssetDto } from './dto/create-asset.dto';
 | 
				
			||||||
import { AssetCountByTimeBucket } from './response-dto/asset-count-by-time-group-response.dto';
 | 
					import { AssetCountByTimeBucket } from './response-dto/asset-count-by-time-group-response.dto';
 | 
				
			||||||
import { TimeGroupEnum } from './dto/get-asset-count-by-time-bucket.dto';
 | 
					import { TimeGroupEnum } from './dto/get-asset-count-by-time-bucket.dto';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,7 @@ import { InjectRepository } from '@nestjs/typeorm';
 | 
				
			|||||||
import { createHash, randomUUID } from 'node:crypto';
 | 
					import { createHash, randomUUID } from 'node:crypto';
 | 
				
			||||||
import { QueryFailedError, Repository } from 'typeorm';
 | 
					import { QueryFailedError, Repository } from 'typeorm';
 | 
				
			||||||
import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
					import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
				
			||||||
import { AssetEntity, AssetType } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity, AssetType } from '@app/database';
 | 
				
			||||||
import { constants, createReadStream, ReadStream, stat } from 'fs';
 | 
					import { constants, createReadStream, ReadStream, stat } from 'fs';
 | 
				
			||||||
import { ServeFileDto } from './dto/serve-file.dto';
 | 
					import { ServeFileDto } from './dto/serve-file.dto';
 | 
				
			||||||
import { Response as Res } from 'express';
 | 
					import { Response as Res } from 'express';
 | 
				
			||||||
@@ -28,7 +28,7 @@ import { CreateAssetDto } from './dto/create-asset.dto';
 | 
				
			|||||||
import { DeleteAssetResponseDto, DeleteAssetStatusEnum } from './response-dto/delete-asset-response.dto';
 | 
					import { DeleteAssetResponseDto, DeleteAssetStatusEnum } from './response-dto/delete-asset-response.dto';
 | 
				
			||||||
import { GetAssetThumbnailDto, GetAssetThumbnailFormatEnum } from './dto/get-asset-thumbnail.dto';
 | 
					import { GetAssetThumbnailDto, GetAssetThumbnailFormatEnum } from './dto/get-asset-thumbnail.dto';
 | 
				
			||||||
import { CheckDuplicateAssetResponseDto } from './response-dto/check-duplicate-asset-response.dto';
 | 
					import { CheckDuplicateAssetResponseDto } from './response-dto/check-duplicate-asset-response.dto';
 | 
				
			||||||
import { ASSET_REPOSITORY, IAssetRepository } from './asset-repository';
 | 
					import { IAssetRepository } from './asset-repository';
 | 
				
			||||||
import { SearchPropertiesDto } from './dto/search-properties.dto';
 | 
					import { SearchPropertiesDto } from './dto/search-properties.dto';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  AssetCountByTimeBucketResponseDto,
 | 
					  AssetCountByTimeBucketResponseDto,
 | 
				
			||||||
@@ -54,7 +54,7 @@ import { InjectQueue } from '@nestjs/bull';
 | 
				
			|||||||
import { Queue } from 'bull';
 | 
					import { Queue } from 'bull';
 | 
				
			||||||
import { DownloadService } from '../../modules/download/download.service';
 | 
					import { DownloadService } from '../../modules/download/download.service';
 | 
				
			||||||
import { DownloadDto } from './dto/download-library.dto';
 | 
					import { DownloadDto } from './dto/download-library.dto';
 | 
				
			||||||
import { ALBUM_REPOSITORY, IAlbumRepository } from '../album/album-repository';
 | 
					import { IAlbumRepository } from '../album/album-repository';
 | 
				
			||||||
import { StorageService } from '@app/storage';
 | 
					import { StorageService } from '@app/storage';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const fileInfo = promisify(stat);
 | 
					const fileInfo = promisify(stat);
 | 
				
			||||||
@@ -62,11 +62,9 @@ const fileInfo = promisify(stat);
 | 
				
			|||||||
@Injectable()
 | 
					@Injectable()
 | 
				
			||||||
export class AssetService {
 | 
					export class AssetService {
 | 
				
			||||||
  constructor(
 | 
					  constructor(
 | 
				
			||||||
    @Inject(ASSET_REPOSITORY)
 | 
					    @Inject(IAssetRepository) private _assetRepository: IAssetRepository,
 | 
				
			||||||
    private _assetRepository: IAssetRepository,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Inject(ALBUM_REPOSITORY)
 | 
					    @Inject(IAlbumRepository) private _albumRepository: IAlbumRepository,
 | 
				
			||||||
    private _albumRepository: IAlbumRepository,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @InjectRepository(AssetEntity)
 | 
					    @InjectRepository(AssetEntity)
 | 
				
			||||||
    private assetRepository: Repository<AssetEntity>,
 | 
					    private assetRepository: Repository<AssetEntity>,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
import { IsNotEmpty, IsOptional } from 'class-validator';
 | 
					import { IsNotEmpty, IsOptional } from 'class-validator';
 | 
				
			||||||
import { AssetType } from '@app/database/entities/asset.entity';
 | 
					import { AssetType } from '@app/database';
 | 
				
			||||||
import { ApiProperty } from '@nestjs/swagger';
 | 
					import { ApiProperty } from '@nestjs/swagger';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class CreateAssetDto {
 | 
					export class CreateAssetDto {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { AssetEntity, AssetType } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity, AssetType } from '@app/database';
 | 
				
			||||||
import { ApiProperty } from '@nestjs/swagger';
 | 
					import { ApiProperty } from '@nestjs/swagger';
 | 
				
			||||||
import { mapTag, TagResponseDto } from '../../tag/response-dto/tag-response.dto';
 | 
					import { mapTag, TagResponseDto } from '../../tag/response-dto/tag-response.dto';
 | 
				
			||||||
import { ExifResponseDto, mapExif } from './exif-response.dto';
 | 
					import { ExifResponseDto, mapExif } from './exif-response.dto';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { ExifEntity } from '@app/database/entities/exif.entity';
 | 
					import { ExifEntity } from '@app/database';
 | 
				
			||||||
import { ApiProperty } from '@nestjs/swagger';
 | 
					import { ApiProperty } from '@nestjs/swagger';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class ExifResponseDto {
 | 
					export class ExifResponseDto {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { SmartInfoEntity } from '@app/database/entities/smart-info.entity';
 | 
					import { SmartInfoEntity } from '@app/database';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class SmartInfoResponseDto {
 | 
					export class SmartInfoResponseDto {
 | 
				
			||||||
  id?: string;
 | 
					  id?: string;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
import { BadRequestException, UnauthorizedException } from '@nestjs/common';
 | 
					import { BadRequestException, UnauthorizedException } from '@nestjs/common';
 | 
				
			||||||
import * as bcrypt from 'bcrypt';
 | 
					import * as bcrypt from 'bcrypt';
 | 
				
			||||||
import { AuthType } from '../../constants/jwt.constant';
 | 
					import { AuthType } from '../../constants/jwt.constant';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,11 +7,11 @@ import {
 | 
				
			|||||||
  UnauthorizedException,
 | 
					  UnauthorizedException,
 | 
				
			||||||
} from '@nestjs/common';
 | 
					} from '@nestjs/common';
 | 
				
			||||||
import * as bcrypt from 'bcrypt';
 | 
					import * as bcrypt from 'bcrypt';
 | 
				
			||||||
import { UserEntity } from '../../../../../libs/database/src/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
import { AuthType } from '../../constants/jwt.constant';
 | 
					import { AuthType } from '../../constants/jwt.constant';
 | 
				
			||||||
import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
					import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
				
			||||||
import { ImmichJwtService } from '../../modules/immich-jwt/immich-jwt.service';
 | 
					import { ImmichJwtService } from '../../modules/immich-jwt/immich-jwt.service';
 | 
				
			||||||
import { IUserRepository, USER_REPOSITORY } from '../user/user-repository';
 | 
					import { IUserRepository } from '../user/user-repository';
 | 
				
			||||||
import { ChangePasswordDto } from './dto/change-password.dto';
 | 
					import { ChangePasswordDto } from './dto/change-password.dto';
 | 
				
			||||||
import { LoginCredentialDto } from './dto/login-credential.dto';
 | 
					import { LoginCredentialDto } from './dto/login-credential.dto';
 | 
				
			||||||
import { SignUpDto } from './dto/sign-up.dto';
 | 
					import { SignUpDto } from './dto/sign-up.dto';
 | 
				
			||||||
@@ -29,7 +29,7 @@ export class AuthService {
 | 
				
			|||||||
  constructor(
 | 
					  constructor(
 | 
				
			||||||
    private oauthService: OAuthService,
 | 
					    private oauthService: OAuthService,
 | 
				
			||||||
    private immichJwtService: ImmichJwtService,
 | 
					    private immichJwtService: ImmichJwtService,
 | 
				
			||||||
    @Inject(USER_REPOSITORY) userRepository: IUserRepository,
 | 
					    @Inject(IUserRepository) userRepository: IUserRepository,
 | 
				
			||||||
  ) {
 | 
					  ) {
 | 
				
			||||||
    this.userCore = new UserCore(userRepository);
 | 
					    this.userCore = new UserCore(userRepository);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class AdminSignupResponseDto {
 | 
					export class AdminSignupResponseDto {
 | 
				
			||||||
  id!: string;
 | 
					  id!: string;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
import { ApiResponseProperty } from '@nestjs/swagger';
 | 
					import { ApiResponseProperty } from '@nestjs/swagger';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class LoginResponseDto {
 | 
					export class LoginResponseDto {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@ import { Socket, Server } from 'socket.io';
 | 
				
			|||||||
import { ImmichJwtService, JwtValidationResult } from '../../modules/immich-jwt/immich-jwt.service';
 | 
					import { ImmichJwtService, JwtValidationResult } from '../../modules/immich-jwt/immich-jwt.service';
 | 
				
			||||||
import { Logger } from '@nestjs/common';
 | 
					import { Logger } from '@nestjs/common';
 | 
				
			||||||
import { InjectRepository } from '@nestjs/typeorm';
 | 
					import { InjectRepository } from '@nestjs/typeorm';
 | 
				
			||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
import { Repository } from 'typeorm';
 | 
					import { Repository } from 'typeorm';
 | 
				
			||||||
import cookieParser from 'cookie';
 | 
					import cookieParser from 'cookie';
 | 
				
			||||||
import { IMMICH_ACCESS_COOKIE } from '../../constants/jwt.constant';
 | 
					import { IMMICH_ACCESS_COOKIE } from '../../constants/jwt.constant';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@ import { ImmichJwtService } from '../../modules/immich-jwt/immich-jwt.service';
 | 
				
			|||||||
import { JwtModule } from '@nestjs/jwt';
 | 
					import { JwtModule } from '@nestjs/jwt';
 | 
				
			||||||
import { jwtConfig } from '../../config/jwt.config';
 | 
					import { jwtConfig } from '../../config/jwt.config';
 | 
				
			||||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
					import { TypeOrmModule } from '@nestjs/typeorm';
 | 
				
			||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Module({
 | 
					@Module({
 | 
				
			||||||
  imports: [TypeOrmModule.forFeature([UserEntity]), ImmichJwtModule, JwtModule.register(jwtConfig)],
 | 
					  imports: [TypeOrmModule.forFeature([UserEntity]), ImmichJwtModule, JwtModule.register(jwtConfig)],
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@ import { Module } from '@nestjs/common';
 | 
				
			|||||||
import { DeviceInfoService } from './device-info.service';
 | 
					import { DeviceInfoService } from './device-info.service';
 | 
				
			||||||
import { DeviceInfoController } from './device-info.controller';
 | 
					import { DeviceInfoController } from './device-info.controller';
 | 
				
			||||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
					import { TypeOrmModule } from '@nestjs/typeorm';
 | 
				
			||||||
import { DeviceInfoEntity } from '@app/database/entities/device-info.entity';
 | 
					import { DeviceInfoEntity } from '@app/database';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Module({
 | 
					@Module({
 | 
				
			||||||
  imports: [TypeOrmModule.forFeature([DeviceInfoEntity])],
 | 
					  imports: [TypeOrmModule.forFeature([DeviceInfoEntity])],
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { DeviceInfoEntity, DeviceType } from '@app/database/entities/device-info.entity';
 | 
					import { DeviceInfoEntity, DeviceType } from '@app/database';
 | 
				
			||||||
import { Repository } from 'typeorm';
 | 
					import { Repository } from 'typeorm';
 | 
				
			||||||
import { DeviceInfoService } from './device-info.service';
 | 
					import { DeviceInfoService } from './device-info.service';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { DeviceInfoEntity } from '@app/database/entities/device-info.entity';
 | 
					import { DeviceInfoEntity } from '@app/database';
 | 
				
			||||||
import { Injectable } from '@nestjs/common';
 | 
					import { Injectable } from '@nestjs/common';
 | 
				
			||||||
import { InjectRepository } from '@nestjs/typeorm';
 | 
					import { InjectRepository } from '@nestjs/typeorm';
 | 
				
			||||||
import { Repository } from 'typeorm';
 | 
					import { Repository } from 'typeorm';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
import { IsNotEmpty, IsOptional } from 'class-validator';
 | 
					import { IsNotEmpty, IsOptional } from 'class-validator';
 | 
				
			||||||
import { DeviceType } from '@app/database/entities/device-info.entity';
 | 
					import { DeviceType } from '@app/database';
 | 
				
			||||||
import { ApiProperty } from '@nestjs/swagger';
 | 
					import { ApiProperty } from '@nestjs/swagger';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class UpsertDeviceInfoDto {
 | 
					export class UpsertDeviceInfoDto {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { DeviceInfoEntity, DeviceType } from '@app/database/entities/device-info.entity';
 | 
					import { DeviceInfoEntity, DeviceType } from '@app/database';
 | 
				
			||||||
import { ApiProperty } from '@nestjs/swagger';
 | 
					import { ApiProperty } from '@nestjs/swagger';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class DeviceInfoResponseDto {
 | 
					export class DeviceInfoResponseDto {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@ import { ImmichJwtModule } from '../../modules/immich-jwt/immich-jwt.module';
 | 
				
			|||||||
import { JwtModule } from '@nestjs/jwt';
 | 
					import { JwtModule } from '@nestjs/jwt';
 | 
				
			||||||
import { jwtConfig } from '../../config/jwt.config';
 | 
					import { jwtConfig } from '../../config/jwt.config';
 | 
				
			||||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
					import { TypeOrmModule } from '@nestjs/typeorm';
 | 
				
			||||||
import { ExifEntity } from '@app/database/entities/exif.entity';
 | 
					import { ExifEntity } from '@app/database';
 | 
				
			||||||
import { TagModule } from '../tag/tag.module';
 | 
					import { TagModule } from '../tag/tag.module';
 | 
				
			||||||
import { AssetModule } from '../asset/asset.module';
 | 
					import { AssetModule } from '../asset/asset.module';
 | 
				
			||||||
import { UserModule } from '../user/user.module';
 | 
					import { UserModule } from '../user/user.module';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,8 +14,8 @@ import { Queue } from 'bull';
 | 
				
			|||||||
import { BadRequestException, Inject, Injectable } from '@nestjs/common';
 | 
					import { BadRequestException, Inject, Injectable } from '@nestjs/common';
 | 
				
			||||||
import { AllJobStatusResponseDto } from './response-dto/all-job-status-response.dto';
 | 
					import { AllJobStatusResponseDto } from './response-dto/all-job-status-response.dto';
 | 
				
			||||||
import { randomUUID } from 'crypto';
 | 
					import { randomUUID } from 'crypto';
 | 
				
			||||||
import { ASSET_REPOSITORY, IAssetRepository } from '../asset/asset-repository';
 | 
					import { IAssetRepository } from '../asset/asset-repository';
 | 
				
			||||||
import { AssetType } from '@app/database/entities/asset.entity';
 | 
					import { AssetType } from '@app/database';
 | 
				
			||||||
import { GetJobDto, JobId } from './dto/get-job.dto';
 | 
					import { GetJobDto, JobId } from './dto/get-job.dto';
 | 
				
			||||||
import { JobStatusResponseDto } from './response-dto/job-status-response.dto';
 | 
					import { JobStatusResponseDto } from './response-dto/job-status-response.dto';
 | 
				
			||||||
import { IMachineLearningJob } from '@app/job/interfaces/machine-learning.interface';
 | 
					import { IMachineLearningJob } from '@app/job/interfaces/machine-learning.interface';
 | 
				
			||||||
@@ -39,7 +39,7 @@ export class JobService {
 | 
				
			|||||||
    @InjectQueue(QueueNameEnum.STORAGE_MIGRATION)
 | 
					    @InjectQueue(QueueNameEnum.STORAGE_MIGRATION)
 | 
				
			||||||
    private storageMigrationQueue: Queue,
 | 
					    private storageMigrationQueue: Queue,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Inject(ASSET_REPOSITORY)
 | 
					    @Inject(IAssetRepository)
 | 
				
			||||||
    private _assetRepository: IAssetRepository,
 | 
					    private _assetRepository: IAssetRepository,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private storageService: StorageService,
 | 
					    private storageService: StorageService,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,4 @@
 | 
				
			|||||||
import { SystemConfig } from '@app/database/entities/system-config.entity';
 | 
					import { SystemConfig, UserEntity } from '@app/database';
 | 
				
			||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					 | 
				
			||||||
import { ImmichConfigService } from '@app/immich-config';
 | 
					import { ImmichConfigService } from '@app/immich-config';
 | 
				
			||||||
import { BadRequestException } from '@nestjs/common';
 | 
					import { BadRequestException } from '@nestjs/common';
 | 
				
			||||||
import { generators, Issuer } from 'openid-client';
 | 
					import { generators, Issuer } from 'openid-client';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@ import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
				
			|||||||
import { ImmichJwtService } from '../../modules/immich-jwt/immich-jwt.service';
 | 
					import { ImmichJwtService } from '../../modules/immich-jwt/immich-jwt.service';
 | 
				
			||||||
import { LoginResponseDto } from '../auth/response-dto/login-response.dto';
 | 
					import { LoginResponseDto } from '../auth/response-dto/login-response.dto';
 | 
				
			||||||
import { UserResponseDto } from '../user/response-dto/user-response.dto';
 | 
					import { UserResponseDto } from '../user/response-dto/user-response.dto';
 | 
				
			||||||
import { IUserRepository, USER_REPOSITORY } from '../user/user-repository';
 | 
					import { IUserRepository } from '../user/user-repository';
 | 
				
			||||||
import { UserCore } from '../user/user.core';
 | 
					import { UserCore } from '../user/user.core';
 | 
				
			||||||
import { OAuthCallbackDto } from './dto/oauth-auth-code.dto';
 | 
					import { OAuthCallbackDto } from './dto/oauth-auth-code.dto';
 | 
				
			||||||
import { OAuthConfigDto } from './dto/oauth-config.dto';
 | 
					import { OAuthConfigDto } from './dto/oauth-config.dto';
 | 
				
			||||||
@@ -26,7 +26,7 @@ export class OAuthService {
 | 
				
			|||||||
  constructor(
 | 
					  constructor(
 | 
				
			||||||
    private immichJwtService: ImmichJwtService,
 | 
					    private immichJwtService: ImmichJwtService,
 | 
				
			||||||
    immichConfigService: ImmichConfigService,
 | 
					    immichConfigService: ImmichConfigService,
 | 
				
			||||||
    @Inject(USER_REPOSITORY) userRepository: IUserRepository,
 | 
					    @Inject(IUserRepository) userRepository: IUserRepository,
 | 
				
			||||||
    @Inject(INITIAL_SYSTEM_CONFIG) private config: SystemConfig,
 | 
					    @Inject(INITIAL_SYSTEM_CONFIG) private config: SystemConfig,
 | 
				
			||||||
  ) {
 | 
					  ) {
 | 
				
			||||||
    this.userCore = new UserCore(userRepository);
 | 
					    this.userCore = new UserCore(userRepository);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,9 @@
 | 
				
			|||||||
import { Module } from '@nestjs/common';
 | 
					import { Module } from '@nestjs/common';
 | 
				
			||||||
import { ServerInfoService } from './server-info.service';
 | 
					import { ServerInfoService } from './server-info.service';
 | 
				
			||||||
import { ServerInfoController } from './server-info.controller';
 | 
					import { ServerInfoController } from './server-info.controller';
 | 
				
			||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity, UserEntity } from '@app/database';
 | 
				
			||||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
					import { TypeOrmModule } from '@nestjs/typeorm';
 | 
				
			||||||
import { ImmichJwtModule } from '../../modules/immich-jwt/immich-jwt.module';
 | 
					import { ImmichJwtModule } from '../../modules/immich-jwt/immich-jwt.module';
 | 
				
			||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Module({
 | 
					@Module({
 | 
				
			||||||
  imports: [TypeOrmModule.forFeature([AssetEntity, UserEntity]), ImmichJwtModule],
 | 
					  imports: [TypeOrmModule.forFeature([AssetEntity, UserEntity]), ImmichJwtModule],
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ import { ServerInfoResponseDto } from './response-dto/server-info-response.dto';
 | 
				
			|||||||
import diskusage from 'diskusage';
 | 
					import diskusage from 'diskusage';
 | 
				
			||||||
import { ServerStatsResponseDto } from './response-dto/server-stats-response.dto';
 | 
					import { ServerStatsResponseDto } from './response-dto/server-stats-response.dto';
 | 
				
			||||||
import { UsageByUserDto } from './response-dto/usage-by-user-response.dto';
 | 
					import { UsageByUserDto } from './response-dto/usage-by-user-response.dto';
 | 
				
			||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity } from '@app/database';
 | 
				
			||||||
import { Repository } from 'typeorm';
 | 
					import { Repository } from 'typeorm';
 | 
				
			||||||
import { InjectRepository } from '@nestjs/typeorm';
 | 
					import { InjectRepository } from '@nestjs/typeorm';
 | 
				
			||||||
import { asHumanReadable } from '../../utils/human-readable.util';
 | 
					import { asHumanReadable } from '../../utils/human-readable.util';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { SystemConfig } from '@app/database/entities/system-config.entity';
 | 
					import { SystemConfig } from '@app/database';
 | 
				
			||||||
import { ValidateNested } from 'class-validator';
 | 
					import { ValidateNested } from 'class-validator';
 | 
				
			||||||
import { SystemConfigFFmpegDto } from './system-config-ffmpeg.dto';
 | 
					import { SystemConfigFFmpegDto } from './system-config-ffmpeg.dto';
 | 
				
			||||||
import { SystemConfigOAuthDto } from './system-config-oauth.dto';
 | 
					import { SystemConfigOAuthDto } from './system-config-oauth.dto';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { SystemConfigEntity } from '@app/database/entities/system-config.entity';
 | 
					import { SystemConfigEntity } from '@app/database';
 | 
				
			||||||
import { immichSharedQueues } from '@app/job/constants/bull-queue-registration.constant';
 | 
					import { immichSharedQueues } from '@app/job/constants/bull-queue-registration.constant';
 | 
				
			||||||
import { BullModule } from '@nestjs/bull';
 | 
					import { BullModule } from '@nestjs/bull';
 | 
				
			||||||
import { Module } from '@nestjs/common';
 | 
					import { Module } from '@nestjs/common';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { TagType } from '@app/database/entities/tag.entity';
 | 
					import { TagType } from '@app/database';
 | 
				
			||||||
import { ApiProperty } from '@nestjs/swagger';
 | 
					import { ApiProperty } from '@nestjs/swagger';
 | 
				
			||||||
import { IsEnum, IsNotEmpty, IsString } from 'class-validator';
 | 
					import { IsEnum, IsNotEmpty, IsString } from 'class-validator';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { TagEntity, TagType } from '@app/database/entities/tag.entity';
 | 
					import { TagEntity, TagType } from '@app/database';
 | 
				
			||||||
import { ApiProperty } from '@nestjs/swagger';
 | 
					import { ApiProperty } from '@nestjs/swagger';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class TagResponseDto {
 | 
					export class TagResponseDto {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,12 +1,12 @@
 | 
				
			|||||||
import { Module } from '@nestjs/common';
 | 
					import { Module } from '@nestjs/common';
 | 
				
			||||||
import { TagService } from './tag.service';
 | 
					import { TagService } from './tag.service';
 | 
				
			||||||
import { TagController } from './tag.controller';
 | 
					import { TagController } from './tag.controller';
 | 
				
			||||||
import { TagEntity } from '@app/database/entities/tag.entity';
 | 
					import { TagEntity } from '@app/database';
 | 
				
			||||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
					import { TypeOrmModule } from '@nestjs/typeorm';
 | 
				
			||||||
import { TagRepository, TAG_REPOSITORY } from './tag.repository';
 | 
					import { TagRepository, ITagRepository } from './tag.repository';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const TAG_REPOSITORY_PROVIDER = {
 | 
					const TAG_REPOSITORY_PROVIDER = {
 | 
				
			||||||
  provide: TAG_REPOSITORY,
 | 
					  provide: ITagRepository,
 | 
				
			||||||
  useClass: TagRepository,
 | 
					  useClass: TagRepository,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@Module({
 | 
					@Module({
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { TagEntity, TagType } from '@app/database/entities/tag.entity';
 | 
					import { TagEntity, TagType } from '@app/database';
 | 
				
			||||||
import { Injectable } from '@nestjs/common';
 | 
					import { Injectable } from '@nestjs/common';
 | 
				
			||||||
import { InjectRepository } from '@nestjs/typeorm';
 | 
					import { InjectRepository } from '@nestjs/typeorm';
 | 
				
			||||||
import { In, Repository } from 'typeorm';
 | 
					import { In, Repository } from 'typeorm';
 | 
				
			||||||
@@ -13,7 +13,7 @@ export interface ITagRepository {
 | 
				
			|||||||
  remove(tag: TagEntity): Promise<TagEntity>;
 | 
					  remove(tag: TagEntity): Promise<TagEntity>;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const TAG_REPOSITORY = 'TAG_REPOSITORY';
 | 
					export const ITagRepository = 'ITagRepository';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Injectable()
 | 
					@Injectable()
 | 
				
			||||||
export class TagRepository implements ITagRepository {
 | 
					export class TagRepository implements ITagRepository {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,4 @@
 | 
				
			|||||||
import { TagEntity, TagType } from '@app/database/entities/tag.entity';
 | 
					import { TagEntity, TagType, UserEntity } from '@app/database';
 | 
				
			||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					 | 
				
			||||||
import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
					import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
				
			||||||
import { ITagRepository } from './tag.repository';
 | 
					import { ITagRepository } from './tag.repository';
 | 
				
			||||||
import { TagService } from './tag.service';
 | 
					import { TagService } from './tag.service';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,16 +1,16 @@
 | 
				
			|||||||
import { TagEntity } from '@app/database/entities/tag.entity';
 | 
					import { TagEntity } from '@app/database';
 | 
				
			||||||
import { BadRequestException, Inject, Injectable, Logger } from '@nestjs/common';
 | 
					import { BadRequestException, Inject, Injectable, Logger } from '@nestjs/common';
 | 
				
			||||||
import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
					import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
				
			||||||
import { CreateTagDto } from './dto/create-tag.dto';
 | 
					import { CreateTagDto } from './dto/create-tag.dto';
 | 
				
			||||||
import { UpdateTagDto } from './dto/update-tag.dto';
 | 
					import { UpdateTagDto } from './dto/update-tag.dto';
 | 
				
			||||||
import { ITagRepository, TAG_REPOSITORY } from './tag.repository';
 | 
					import { ITagRepository } from './tag.repository';
 | 
				
			||||||
import { mapTag, TagResponseDto } from "./response-dto/tag-response.dto";
 | 
					import { mapTag, TagResponseDto } from './response-dto/tag-response.dto';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Injectable()
 | 
					@Injectable()
 | 
				
			||||||
export class TagService {
 | 
					export class TagService {
 | 
				
			||||||
  readonly logger = new Logger(TagService.name);
 | 
					  readonly logger = new Logger(TagService.name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor(@Inject(TAG_REPOSITORY) private _tagRepository: ITagRepository) {}
 | 
					  constructor(@Inject(ITagRepository) private _tagRepository: ITagRepository) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async create(authUser: AuthUserDto, createTagDto: CreateTagDto) {
 | 
					  async create(authUser: AuthUserDto, createTagDto: CreateTagDto) {
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class UserResponseDto {
 | 
					export class UserResponseDto {
 | 
				
			||||||
  id!: string;
 | 
					  id!: string;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
import { InternalServerErrorException } from '@nestjs/common';
 | 
					import { InternalServerErrorException } from '@nestjs/common';
 | 
				
			||||||
import { InjectRepository } from '@nestjs/typeorm';
 | 
					import { InjectRepository } from '@nestjs/typeorm';
 | 
				
			||||||
import { Not, Repository } from 'typeorm';
 | 
					import { Not, Repository } from 'typeorm';
 | 
				
			||||||
@@ -19,7 +19,7 @@ export interface UserListFilter {
 | 
				
			|||||||
  excludeId?: string;
 | 
					  excludeId?: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const USER_REPOSITORY = 'USER_REPOSITORY';
 | 
					export const IUserRepository = 'IUserRepository';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class UserRepository implements IUserRepository {
 | 
					export class UserRepository implements IUserRepository {
 | 
				
			||||||
  constructor(
 | 
					  constructor(
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  BadRequestException,
 | 
					  BadRequestException,
 | 
				
			||||||
  ForbiddenException,
 | 
					  ForbiddenException,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,16 +1,16 @@
 | 
				
			|||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
import { Module } from '@nestjs/common';
 | 
					import { Module } from '@nestjs/common';
 | 
				
			||||||
import { JwtModule } from '@nestjs/jwt';
 | 
					import { JwtModule } from '@nestjs/jwt';
 | 
				
			||||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
					import { TypeOrmModule } from '@nestjs/typeorm';
 | 
				
			||||||
import { jwtConfig } from '../../config/jwt.config';
 | 
					import { jwtConfig } from '../../config/jwt.config';
 | 
				
			||||||
import { ImmichJwtModule } from '../../modules/immich-jwt/immich-jwt.module';
 | 
					import { ImmichJwtModule } from '../../modules/immich-jwt/immich-jwt.module';
 | 
				
			||||||
import { ImmichJwtService } from '../../modules/immich-jwt/immich-jwt.service';
 | 
					import { ImmichJwtService } from '../../modules/immich-jwt/immich-jwt.service';
 | 
				
			||||||
import { UserRepository, USER_REPOSITORY } from './user-repository';
 | 
					import { UserRepository, IUserRepository } from './user-repository';
 | 
				
			||||||
import { UserController } from './user.controller';
 | 
					import { UserController } from './user.controller';
 | 
				
			||||||
import { UserService } from './user.service';
 | 
					import { UserService } from './user.service';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const USER_REPOSITORY_PROVIDER = {
 | 
					const USER_REPOSITORY_PROVIDER = {
 | 
				
			||||||
  provide: USER_REPOSITORY,
 | 
					  provide: IUserRepository,
 | 
				
			||||||
  useClass: UserRepository,
 | 
					  useClass: UserRepository,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
import { BadRequestException, ForbiddenException, NotFoundException } from '@nestjs/common';
 | 
					import { BadRequestException, ForbiddenException, NotFoundException } from '@nestjs/common';
 | 
				
			||||||
import { newUserRepositoryMock } from '../../../test/test-utils';
 | 
					import { newUserRepositoryMock } from '../../../test/test-utils';
 | 
				
			||||||
import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
					import { AuthUserDto } from '../../decorators/auth-user.decorator';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,16 +10,13 @@ import {
 | 
				
			|||||||
} from './response-dto/create-profile-image-response.dto';
 | 
					} from './response-dto/create-profile-image-response.dto';
 | 
				
			||||||
import { mapUserCountResponse, UserCountResponseDto } from './response-dto/user-count-response.dto';
 | 
					import { mapUserCountResponse, UserCountResponseDto } from './response-dto/user-count-response.dto';
 | 
				
			||||||
import { mapUser, UserResponseDto } from './response-dto/user-response.dto';
 | 
					import { mapUser, UserResponseDto } from './response-dto/user-response.dto';
 | 
				
			||||||
import { IUserRepository, USER_REPOSITORY } from './user-repository';
 | 
					import { IUserRepository } from './user-repository';
 | 
				
			||||||
import { UserCore } from './user.core';
 | 
					import { UserCore } from './user.core';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Injectable()
 | 
					@Injectable()
 | 
				
			||||||
export class UserService {
 | 
					export class UserService {
 | 
				
			||||||
  private userCore: UserCore;
 | 
					  private userCore: UserCore;
 | 
				
			||||||
  constructor(
 | 
					  constructor(@Inject(IUserRepository) userRepository: IUserRepository) {
 | 
				
			||||||
    @Inject(USER_REPOSITORY)
 | 
					 | 
				
			||||||
    userRepository: IUserRepository,
 | 
					 | 
				
			||||||
  ) {
 | 
					 | 
				
			||||||
    this.userCore = new UserCore(userRepository);
 | 
					    this.userCore = new UserCore(userRepository);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
import { createParamDecorator, ExecutionContext } from '@nestjs/common';
 | 
					import { createParamDecorator, ExecutionContext } from '@nestjs/common';
 | 
				
			||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
// import { AuthUserDto } from './dto/auth-user.dto';
 | 
					// import { AuthUserDto } from './dto/auth-user.dto';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class AuthUserDto {
 | 
					export class AuthUserDto {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,9 +1,7 @@
 | 
				
			|||||||
import { BullModule } from '@nestjs/bull';
 | 
					import { BullModule } from '@nestjs/bull';
 | 
				
			||||||
import { Module } from '@nestjs/common';
 | 
					import { Module } from '@nestjs/common';
 | 
				
			||||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
					import { TypeOrmModule } from '@nestjs/typeorm';
 | 
				
			||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity, ExifEntity, SmartInfoEntity } from '@app/database';
 | 
				
			||||||
import { ExifEntity } from '@app/database/entities/exif.entity';
 | 
					 | 
				
			||||||
import { SmartInfoEntity } from '@app/database/entities/smart-info.entity';
 | 
					 | 
				
			||||||
import { BackgroundTaskProcessor } from './background-task.processor';
 | 
					import { BackgroundTaskProcessor } from './background-task.processor';
 | 
				
			||||||
import { BackgroundTaskService } from './background-task.service';
 | 
					import { BackgroundTaskService } from './background-task.service';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,7 @@
 | 
				
			|||||||
import { Process, Processor } from '@nestjs/bull';
 | 
					import { Process, Processor } from '@nestjs/bull';
 | 
				
			||||||
import { InjectRepository } from '@nestjs/typeorm';
 | 
					import { InjectRepository } from '@nestjs/typeorm';
 | 
				
			||||||
import { Repository } from 'typeorm';
 | 
					import { Repository } from 'typeorm';
 | 
				
			||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity, SmartInfoEntity } from '@app/database';
 | 
				
			||||||
import { SmartInfoEntity } from '@app/database/entities/smart-info.entity';
 | 
					 | 
				
			||||||
import { Job } from 'bull';
 | 
					import { Job } from 'bull';
 | 
				
			||||||
import { AssetResponseDto } from '../../api-v1/asset/response-dto/asset-response.dto';
 | 
					import { AssetResponseDto } from '../../api-v1/asset/response-dto/asset-response.dto';
 | 
				
			||||||
import { assetUtils } from '@app/common/utils';
 | 
					import { assetUtils } from '@app/common/utils';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity } from '@app/database';
 | 
				
			||||||
import { BadRequestException, Injectable, InternalServerErrorException, Logger, StreamableFile } from '@nestjs/common';
 | 
					import { BadRequestException, Injectable, InternalServerErrorException, Logger, StreamableFile } from '@nestjs/common';
 | 
				
			||||||
import archiver from 'archiver';
 | 
					import archiver from 'archiver';
 | 
				
			||||||
import { extname } from 'path';
 | 
					import { extname } from 'path';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ import { JwtModule } from '@nestjs/jwt';
 | 
				
			|||||||
import { jwtConfig } from '../../config/jwt.config';
 | 
					import { jwtConfig } from '../../config/jwt.config';
 | 
				
			||||||
import { JwtStrategy } from './strategies/jwt.strategy';
 | 
					import { JwtStrategy } from './strategies/jwt.strategy';
 | 
				
			||||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
					import { TypeOrmModule } from '@nestjs/typeorm';
 | 
				
			||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Module({
 | 
					@Module({
 | 
				
			||||||
  imports: [JwtModule.register(jwtConfig), TypeOrmModule.forFeature([UserEntity])],
 | 
					  imports: [JwtModule.register(jwtConfig), TypeOrmModule.forFeature([UserEntity])],
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
import { Injectable, Logger } from '@nestjs/common';
 | 
					import { Injectable, Logger } from '@nestjs/common';
 | 
				
			||||||
import { JwtService } from '@nestjs/jwt';
 | 
					import { JwtService } from '@nestjs/jwt';
 | 
				
			||||||
import { Request } from 'express';
 | 
					import { Request } from 'express';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ import { InjectRepository } from '@nestjs/typeorm';
 | 
				
			|||||||
import { ExtractJwt, Strategy } from 'passport-jwt';
 | 
					import { ExtractJwt, Strategy } from 'passport-jwt';
 | 
				
			||||||
import { Repository } from 'typeorm';
 | 
					import { Repository } from 'typeorm';
 | 
				
			||||||
import { JwtPayloadDto } from '../../../api-v1/auth/dto/jwt-payload.dto';
 | 
					import { JwtPayloadDto } from '../../../api-v1/auth/dto/jwt-payload.dto';
 | 
				
			||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
import { jwtSecret } from '../../../constants/jwt.constant';
 | 
					import { jwtSecret } from '../../../constants/jwt.constant';
 | 
				
			||||||
import { ImmichJwtService } from '../immich-jwt.service';
 | 
					import { ImmichJwtService } from '../immich-jwt.service';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,8 @@
 | 
				
			|||||||
import { BullModule } from '@nestjs/bull';
 | 
					import { BullModule } from '@nestjs/bull';
 | 
				
			||||||
import { Module } from '@nestjs/common';
 | 
					import { Module } from '@nestjs/common';
 | 
				
			||||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
					import { TypeOrmModule } from '@nestjs/typeorm';
 | 
				
			||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity, ExifEntity, UserEntity } from '@app/database';
 | 
				
			||||||
import { ScheduleTasksService } from './schedule-tasks.service';
 | 
					import { ScheduleTasksService } from './schedule-tasks.service';
 | 
				
			||||||
import { ExifEntity } from '@app/database/entities/exif.entity';
 | 
					 | 
				
			||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					 | 
				
			||||||
import { immichSharedQueues } from '@app/job/constants/bull-queue-registration.constant';
 | 
					import { immichSharedQueues } from '@app/job/constants/bull-queue-registration.constant';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Module({
 | 
					@Module({
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,11 +2,10 @@ import { Injectable, Logger } from '@nestjs/common';
 | 
				
			|||||||
import { Cron, CronExpression } from '@nestjs/schedule';
 | 
					import { Cron, CronExpression } from '@nestjs/schedule';
 | 
				
			||||||
import { InjectRepository } from '@nestjs/typeorm';
 | 
					import { InjectRepository } from '@nestjs/typeorm';
 | 
				
			||||||
import { IsNull, Not, Repository } from 'typeorm';
 | 
					import { IsNull, Not, Repository } from 'typeorm';
 | 
				
			||||||
import { AssetEntity, AssetType } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity, AssetType, ExifEntity, UserEntity } from '@app/database';
 | 
				
			||||||
import { InjectQueue } from '@nestjs/bull';
 | 
					import { InjectQueue } from '@nestjs/bull';
 | 
				
			||||||
import { Queue } from 'bull';
 | 
					import { Queue } from 'bull';
 | 
				
			||||||
import { randomUUID } from 'crypto';
 | 
					import { randomUUID } from 'crypto';
 | 
				
			||||||
import { ExifEntity } from '@app/database/entities/exif.entity';
 | 
					 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  userDeletionProcessorName,
 | 
					  userDeletionProcessorName,
 | 
				
			||||||
  exifExtractionProcessorName,
 | 
					  exifExtractionProcessorName,
 | 
				
			||||||
@@ -19,7 +18,6 @@ import {
 | 
				
			|||||||
  videoMetadataExtractionProcessorName,
 | 
					  videoMetadataExtractionProcessorName,
 | 
				
			||||||
} from '@app/job';
 | 
					} from '@app/job';
 | 
				
			||||||
import { ConfigService } from '@nestjs/config';
 | 
					import { ConfigService } from '@nestjs/config';
 | 
				
			||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					 | 
				
			||||||
import { IUserDeletionJob } from '@app/job/interfaces/user-deletion.interface';
 | 
					import { IUserDeletionJob } from '@app/job/interfaces/user-deletion.interface';
 | 
				
			||||||
import { userUtils } from '@app/common';
 | 
					import { userUtils } from '@app/common';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@ import { INestApplication } from '@nestjs/common';
 | 
				
			|||||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
					import { TypeOrmModule } from '@nestjs/typeorm';
 | 
				
			||||||
import request from 'supertest';
 | 
					import request from 'supertest';
 | 
				
			||||||
import { clearDb, getAuthUser, authCustom } from './test-utils';
 | 
					import { clearDb, getAuthUser, authCustom } from './test-utils';
 | 
				
			||||||
import { databaseConfig } from '@app/database/config/database.config';
 | 
					import { databaseConfig } from '@app/database';
 | 
				
			||||||
import { AlbumModule } from '../src/api-v1/album/album.module';
 | 
					import { AlbumModule } from '../src/api-v1/album/album.module';
 | 
				
			||||||
import { CreateAlbumDto } from '../src/api-v1/album/dto/create-album.dto';
 | 
					import { CreateAlbumDto } from '../src/api-v1/album/dto/create-album.dto';
 | 
				
			||||||
import { ImmichJwtModule } from '../src/modules/immich-jwt/immich-jwt.module';
 | 
					import { ImmichJwtModule } from '../src/modules/immich-jwt/immich-jwt.module';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,9 +1,5 @@
 | 
				
			|||||||
import { immichAppConfig, immichBullAsyncConfig } from '@app/common/config';
 | 
					import { immichAppConfig, immichBullAsyncConfig } from '@app/common/config';
 | 
				
			||||||
import { DatabaseModule } from '@app/database';
 | 
					import { DatabaseModule, AssetEntity, ExifEntity, SmartInfoEntity, UserEntity } from '@app/database';
 | 
				
			||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					 | 
				
			||||||
import { ExifEntity } from '@app/database/entities/exif.entity';
 | 
					 | 
				
			||||||
import { SmartInfoEntity } from '@app/database/entities/smart-info.entity';
 | 
					 | 
				
			||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					 | 
				
			||||||
import { StorageModule } from '@app/storage';
 | 
					import { StorageModule } from '@app/storage';
 | 
				
			||||||
import { BullModule } from '@nestjs/bull';
 | 
					import { BullModule } from '@nestjs/bull';
 | 
				
			||||||
import { Module } from '@nestjs/common';
 | 
					import { Module } from '@nestjs/common';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { AssetType } from '@app/database/entities/asset.entity';
 | 
					import { AssetType } from '@app/database';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  IAssetUploadedJob,
 | 
					  IAssetUploadedJob,
 | 
				
			||||||
  IMetadataExtractionJob,
 | 
					  IMetadataExtractionJob,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity } from '@app/database';
 | 
				
			||||||
import { QueueNameEnum } from '@app/job';
 | 
					import { QueueNameEnum } from '@app/job';
 | 
				
			||||||
import { Process, Processor } from '@nestjs/bull';
 | 
					import { Process, Processor } from '@nestjs/bull';
 | 
				
			||||||
import { Logger } from '@nestjs/common';
 | 
					import { Logger } from '@nestjs/common';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity } from '@app/database';
 | 
				
			||||||
import { SmartInfoEntity } from '@app/database/entities/smart-info.entity';
 | 
					import { SmartInfoEntity } from '@app/database';
 | 
				
			||||||
import { MachineLearningJobNameEnum, QueueNameEnum } from '@app/job';
 | 
					import { MachineLearningJobNameEnum, QueueNameEnum } from '@app/job';
 | 
				
			||||||
import { IMachineLearningJob } from '@app/job/interfaces/machine-learning.interface';
 | 
					import { IMachineLearningJob } from '@app/job/interfaces/machine-learning.interface';
 | 
				
			||||||
import { Process, Processor } from '@nestjs/bull';
 | 
					import { Process, Processor } from '@nestjs/bull';
 | 
				
			||||||
@@ -22,12 +22,9 @@ export class MachineLearningProcessor {
 | 
				
			|||||||
  async tagImage(job: Job<IMachineLearningJob>) {
 | 
					  async tagImage(job: Job<IMachineLearningJob>) {
 | 
				
			||||||
    const { asset } = job.data;
 | 
					    const { asset } = job.data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const res = await axios.post(
 | 
					    const res = await axios.post(immich_machine_learning_url + '/image-classifier/tag-image', {
 | 
				
			||||||
      immich_machine_learning_url + '/image-classifier/tag-image',
 | 
					 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
      thumbnailPath: asset.resizePath,
 | 
					      thumbnailPath: asset.resizePath,
 | 
				
			||||||
      },
 | 
					    });
 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (res.status == 201 && res.data.length > 0) {
 | 
					    if (res.status == 201 && res.data.length > 0) {
 | 
				
			||||||
      const smartInfo = new SmartInfoEntity();
 | 
					      const smartInfo = new SmartInfoEntity();
 | 
				
			||||||
@@ -45,12 +42,9 @@ export class MachineLearningProcessor {
 | 
				
			|||||||
    try {
 | 
					    try {
 | 
				
			||||||
      const { asset }: { asset: AssetEntity } = job.data;
 | 
					      const { asset }: { asset: AssetEntity } = job.data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const res = await axios.post(
 | 
					      const res = await axios.post(immich_machine_learning_url + '/object-detection/detect-object', {
 | 
				
			||||||
        immich_machine_learning_url + '/object-detection/detect-object',
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
        thumbnailPath: asset.resizePath,
 | 
					        thumbnailPath: asset.resizePath,
 | 
				
			||||||
        },
 | 
					      });
 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (res.status == 201 && res.data.length > 0) {
 | 
					      if (res.status == 201 && res.data.length > 0) {
 | 
				
			||||||
        const smartInfo = new SmartInfoEntity();
 | 
					        const smartInfo = new SmartInfoEntity();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,5 @@
 | 
				
			|||||||
import { ImmichLogLevel } from '@app/common/constants/log-level.constant';
 | 
					import { ImmichLogLevel } from '@app/common/constants/log-level.constant';
 | 
				
			||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity, ExifEntity } from '@app/database';
 | 
				
			||||||
import { ExifEntity } from '@app/database/entities/exif.entity';
 | 
					 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  IExifExtractionProcessor,
 | 
					  IExifExtractionProcessor,
 | 
				
			||||||
  IVideoLengthExtractionProcessor,
 | 
					  IVideoLengthExtractionProcessor,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
import { APP_UPLOAD_LOCATION } from '@app/common';
 | 
					import { APP_UPLOAD_LOCATION } from '@app/common';
 | 
				
			||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity } from '@app/database';
 | 
				
			||||||
import { ImmichConfigService } from '@app/immich-config';
 | 
					import { ImmichConfigService } from '@app/immich-config';
 | 
				
			||||||
import { QueueNameEnum, templateMigrationProcessorName, updateTemplateProcessorName } from '@app/job';
 | 
					import { QueueNameEnum, templateMigrationProcessorName, updateTemplateProcessorName } from '@app/job';
 | 
				
			||||||
import { StorageService } from '@app/storage';
 | 
					import { StorageService } from '@app/storage';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
import { APP_UPLOAD_LOCATION } from '@app/common';
 | 
					import { APP_UPLOAD_LOCATION } from '@app/common';
 | 
				
			||||||
import { AssetEntity, AssetType } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity, AssetType } from '@app/database';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  WebpGeneratorProcessor,
 | 
					  WebpGeneratorProcessor,
 | 
				
			||||||
  generateJPEGThumbnailProcessorName,
 | 
					  generateJPEGThumbnailProcessorName,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,5 @@
 | 
				
			|||||||
import { APP_UPLOAD_LOCATION, userUtils } from '@app/common';
 | 
					import { APP_UPLOAD_LOCATION, userUtils } from '@app/common';
 | 
				
			||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity, UserEntity } from '@app/database';
 | 
				
			||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					 | 
				
			||||||
import { QueueNameEnum, userDeletionProcessorName } from '@app/job';
 | 
					import { QueueNameEnum, userDeletionProcessorName } from '@app/job';
 | 
				
			||||||
import { IUserDeletionJob } from '@app/job/interfaces/user-deletion.interface';
 | 
					import { IUserDeletionJob } from '@app/job/interfaces/user-deletion.interface';
 | 
				
			||||||
import { Process, Processor } from '@nestjs/bull';
 | 
					import { Process, Processor } from '@nestjs/bull';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
import { APP_UPLOAD_LOCATION } from '@app/common/constants';
 | 
					import { APP_UPLOAD_LOCATION } from '@app/common/constants';
 | 
				
			||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity } from '@app/database';
 | 
				
			||||||
import { QueueNameEnum } from '@app/job';
 | 
					import { QueueNameEnum } from '@app/job';
 | 
				
			||||||
import { mp4ConversionProcessorName } from '@app/job/constants/job-name.constant';
 | 
					import { mp4ConversionProcessorName } from '@app/job/constants/job-name.constant';
 | 
				
			||||||
import { IMp4ConversionProcessor } from '@app/job/interfaces/video-transcode.interface';
 | 
					import { IMp4ConversionProcessor } from '@app/job/interfaces/video-transcode.interface';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity } from '@app/database';
 | 
				
			||||||
import { AssetResponseDto } from 'apps/immich/src/api-v1/asset/response-dto/asset-response.dto';
 | 
					import { AssetResponseDto } from 'apps/immich/src/api-v1/asset/response-dto/asset-response.dto';
 | 
				
			||||||
import fs from 'fs';
 | 
					import fs from 'fs';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
// create unit test for user utils
 | 
					// create unit test for user utils
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
import { userUtils } from './user-utils';
 | 
					import { userUtils } from './user-utils';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('User Utilities', () => {
 | 
					describe('User Utilities', () => {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function createUserUtils() {
 | 
					function createUserUtils() {
 | 
				
			||||||
  const isReadyForDeletion = (user: UserEntity): boolean => {
 | 
					  const isReadyForDeletion = (user: UserEntity): boolean => {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								server/libs/database/src/config/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								server/libs/database/src/config/index.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					export * from './database.config';
 | 
				
			||||||
							
								
								
									
										10
									
								
								server/libs/database/src/entities/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								server/libs/database/src/entities/index.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					export * from './album.entity';
 | 
				
			||||||
 | 
					export * from './asset-album.entity';
 | 
				
			||||||
 | 
					export * from './asset.entity';
 | 
				
			||||||
 | 
					export * from './device-info.entity';
 | 
				
			||||||
 | 
					export * from './exif.entity';
 | 
				
			||||||
 | 
					export * from './smart-info.entity';
 | 
				
			||||||
 | 
					export * from './system-config.entity';
 | 
				
			||||||
 | 
					export * from './tag.entity';
 | 
				
			||||||
 | 
					export * from './user-album.entity';
 | 
				
			||||||
 | 
					export * from './user.entity';
 | 
				
			||||||
@@ -1 +1,3 @@
 | 
				
			|||||||
 | 
					export * from './config';
 | 
				
			||||||
export * from './database.module';
 | 
					export * from './database.module';
 | 
				
			||||||
 | 
					export * from './entities';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { SystemConfigEntity } from '@app/database/entities/system-config.entity';
 | 
					import { SystemConfigEntity } from '@app/database';
 | 
				
			||||||
import { Module, Provider } from '@nestjs/common';
 | 
					import { Module, Provider } from '@nestjs/common';
 | 
				
			||||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
					import { TypeOrmModule } from '@nestjs/typeorm';
 | 
				
			||||||
import { ImmichConfigService } from './immich-config.service';
 | 
					import { ImmichConfigService } from './immich-config.service';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { SystemConfig, SystemConfigEntity, SystemConfigKey } from '@app/database/entities/system-config.entity';
 | 
					import { SystemConfig, SystemConfigEntity, SystemConfigKey } from '@app/database';
 | 
				
			||||||
import { BadRequestException, Injectable, Logger } from '@nestjs/common';
 | 
					import { BadRequestException, Injectable, Logger } from '@nestjs/common';
 | 
				
			||||||
import { InjectRepository } from '@nestjs/typeorm';
 | 
					import { InjectRepository } from '@nestjs/typeorm';
 | 
				
			||||||
import * as _ from 'lodash';
 | 
					import * as _ from 'lodash';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity } from '@app/database';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IAssetUploadedJob {
 | 
					export interface IAssetUploadedJob {
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity } from '@app/database';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IMachineLearningJob {
 | 
					export interface IMachineLearningJob {
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity } from '@app/database';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IExifExtractionProcessor {
 | 
					export interface IExifExtractionProcessor {
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity } from '@app/database';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface JpegGeneratorProcessor {
 | 
					export interface JpegGeneratorProcessor {
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { UserEntity } from '@app/database/entities/user.entity';
 | 
					import { UserEntity } from '@app/database';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IUserDeletionJob {
 | 
					export interface IUserDeletionJob {
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity } from '@app/database';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IMp4ConversionProcessor {
 | 
					export interface IMp4ConversionProcessor {
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,4 @@
 | 
				
			|||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity, SystemConfigEntity } from '@app/database';
 | 
				
			||||||
import { SystemConfigEntity } from '@app/database/entities/system-config.entity';
 | 
					 | 
				
			||||||
import { ImmichConfigModule } from '@app/immich-config';
 | 
					import { ImmichConfigModule } from '@app/immich-config';
 | 
				
			||||||
import { Module } from '@nestjs/common';
 | 
					import { Module } from '@nestjs/common';
 | 
				
			||||||
import { TypeOrmModule } from '@nestjs/typeorm';
 | 
					import { TypeOrmModule } from '@nestjs/typeorm';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,5 @@
 | 
				
			|||||||
import { APP_UPLOAD_LOCATION } from '@app/common';
 | 
					import { APP_UPLOAD_LOCATION } from '@app/common';
 | 
				
			||||||
import { AssetEntity } from '@app/database/entities/asset.entity';
 | 
					import { AssetEntity, SystemConfig } from '@app/database';
 | 
				
			||||||
import { SystemConfig } from '@app/database/entities/system-config.entity';
 | 
					 | 
				
			||||||
import { ImmichConfigService, INITIAL_SYSTEM_CONFIG } from '@app/immich-config';
 | 
					import { ImmichConfigService, INITIAL_SYSTEM_CONFIG } from '@app/immich-config';
 | 
				
			||||||
import { Inject, Injectable, Logger } from '@nestjs/common';
 | 
					import { Inject, Injectable, Logger } from '@nestjs/common';
 | 
				
			||||||
import { InjectRepository } from '@nestjs/typeorm';
 | 
					import { InjectRepository } from '@nestjs/typeorm';
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user