mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	chore(server): organize imports (#2779)
* feat: lint rule for organize imports * chore: organize imports
This commit is contained in:
		| @@ -2,5 +2,6 @@ | ||||
|   "singleQuote": true, | ||||
|   "trailingComma": "all", | ||||
|   "printWidth": 120, | ||||
|   "semi": true | ||||
|   "semi": true, | ||||
|   "organizeImportsSkipDestructiveCodeActions": true | ||||
| } | ||||
|   | ||||
| @@ -1,13 +1,12 @@ | ||||
| import { Test, TestingModule } from '@nestjs/testing'; | ||||
| import { INestApplication } from '@nestjs/common'; | ||||
| import request from 'supertest'; | ||||
| import { clearDb, getAuthUser, authCustom } from '../test/test-utils'; | ||||
| import { CreateAlbumDto } from '@app/domain'; | ||||
| import { AlbumResponseDto, AuthService, CreateAlbumDto, SharedLinkResponseDto, UserService } from '@app/domain'; | ||||
| import { CreateAlbumShareLinkDto } from '@app/immich/api-v1/album/dto/create-album-shared-link.dto'; | ||||
| import { AuthUserDto } from '@app/immich/decorators/auth-user.decorator'; | ||||
| import { AlbumResponseDto, AuthService, SharedLinkResponseDto, UserService } from '@app/domain'; | ||||
| import { DataSource } from 'typeorm'; | ||||
| import { AppModule } from '@app/immich/app.module'; | ||||
| import { AuthUserDto } from '@app/immich/decorators/auth-user.decorator'; | ||||
| import { INestApplication } from '@nestjs/common'; | ||||
| import { Test, TestingModule } from '@nestjs/testing'; | ||||
| import request from 'supertest'; | ||||
| import { DataSource } from 'typeorm'; | ||||
| import { authCustom, clearDb, getAuthUser } from '../test/test-utils'; | ||||
|  | ||||
| async function _createAlbum(app: INestApplication, data: CreateAlbumDto) { | ||||
|   const res = await request(app.getHttpServer()).post('/album').send(data); | ||||
|   | ||||
| @@ -1,11 +1,10 @@ | ||||
| import { Test, TestingModule } from '@nestjs/testing'; | ||||
| import { INestApplication } from '@nestjs/common'; | ||||
| import request from 'supertest'; | ||||
| import { clearDb, authCustom } from '../test/test-utils'; | ||||
| import { CreateUserDto, UserService, AuthUserDto, UserResponseDto } from '@app/domain'; | ||||
| import { DataSource } from 'typeorm'; | ||||
| import { AuthService } from '@app/domain'; | ||||
| import { AuthService, AuthUserDto, CreateUserDto, UserResponseDto, UserService } from '@app/domain'; | ||||
| import { AppModule } from '@app/immich/app.module'; | ||||
| import { INestApplication } from '@nestjs/common'; | ||||
| import { Test, TestingModule } from '@nestjs/testing'; | ||||
| import request from 'supertest'; | ||||
| import { DataSource } from 'typeorm'; | ||||
| import { authCustom, clearDb } from '../test/test-utils'; | ||||
|  | ||||
| function _createUser(userService: UserService, data: CreateUserDto) { | ||||
|   return userService.createUser(data); | ||||
|   | ||||
							
								
								
									
										28
									
								
								server/package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										28
									
								
								server/package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -83,6 +83,7 @@ | ||||
|         "jest": "^27.2.5", | ||||
|         "jest-when": "^3.5.2", | ||||
|         "prettier": "^2.3.2", | ||||
|         "prettier-plugin-organize-imports": "^3.2.2", | ||||
|         "rimraf": "^3.0.2", | ||||
|         "source-map-support": "^0.5.20", | ||||
|         "supertest": "^6.1.3", | ||||
| @@ -9374,6 +9375,26 @@ | ||||
|         "node": ">=6.0.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/prettier-plugin-organize-imports": { | ||||
|       "version": "3.2.2", | ||||
|       "resolved": "https://registry.npmjs.org/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-3.2.2.tgz", | ||||
|       "integrity": "sha512-e97lE6odGSiHonHJMTYC0q0iLXQyw0u5z/PJpvP/3vRy6/Zi9kLBwFAbEGjDzIowpjQv8b+J04PDamoUSQbzGA==", | ||||
|       "dev": true, | ||||
|       "peerDependencies": { | ||||
|         "@volar/vue-language-plugin-pug": "^1.0.4", | ||||
|         "@volar/vue-typescript": "^1.0.4", | ||||
|         "prettier": ">=2.0", | ||||
|         "typescript": ">=2.9" | ||||
|       }, | ||||
|       "peerDependenciesMeta": { | ||||
|         "@volar/vue-language-plugin-pug": { | ||||
|           "optional": true | ||||
|         }, | ||||
|         "@volar/vue-typescript": { | ||||
|           "optional": true | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/pretty-format": { | ||||
|       "version": "27.5.1", | ||||
|       "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", | ||||
| @@ -19106,6 +19127,13 @@ | ||||
|         "fast-diff": "^1.1.2" | ||||
|       } | ||||
|     }, | ||||
|     "prettier-plugin-organize-imports": { | ||||
|       "version": "3.2.2", | ||||
|       "resolved": "https://registry.npmjs.org/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-3.2.2.tgz", | ||||
|       "integrity": "sha512-e97lE6odGSiHonHJMTYC0q0iLXQyw0u5z/PJpvP/3vRy6/Zi9kLBwFAbEGjDzIowpjQv8b+J04PDamoUSQbzGA==", | ||||
|       "dev": true, | ||||
|       "requires": {} | ||||
|     }, | ||||
|     "pretty-format": { | ||||
|       "version": "27.5.1", | ||||
|       "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", | ||||
|   | ||||
| @@ -109,6 +109,7 @@ | ||||
|     "jest": "^27.2.5", | ||||
|     "jest-when": "^3.5.2", | ||||
|     "prettier": "^2.3.2", | ||||
|     "prettier-plugin-organize-imports": "^3.2.2", | ||||
|     "rimraf": "^3.0.2", | ||||
|     "source-map-support": "^0.5.20", | ||||
|     "supertest": "^6.1.3", | ||||
|   | ||||
| @@ -1,5 +1,4 @@ | ||||
| import { BadRequestException, ForbiddenException } from '@nestjs/common'; | ||||
| import _ from 'lodash'; | ||||
| import { | ||||
|   albumStub, | ||||
|   authStub, | ||||
| @@ -9,6 +8,7 @@ import { | ||||
|   newUserRepositoryMock, | ||||
|   userEntityStub, | ||||
| } from '@test'; | ||||
| import _ from 'lodash'; | ||||
| import { IAssetRepository } from '../asset'; | ||||
| import { IJobRepository, JobName } from '../job'; | ||||
| import { IUserRepository } from '../user'; | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| import { ArrayNotEmpty } from 'class-validator'; | ||||
| import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator'; | ||||
| import { ArrayNotEmpty } from 'class-validator'; | ||||
|  | ||||
| export class AddUsersDto { | ||||
|   @ValidateUUID({ each: true }) | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| import { ApiProperty } from '@nestjs/swagger'; | ||||
| import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator'; | ||||
| import { ApiProperty } from '@nestjs/swagger'; | ||||
| import { IsNotEmpty, IsString } from 'class-validator'; | ||||
|  | ||||
| export class CreateAlbumDto { | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator'; | ||||
| import { ApiProperty } from '@nestjs/swagger'; | ||||
| import { IsOptional } from 'class-validator'; | ||||
| import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator'; | ||||
|  | ||||
| export class UpdateAlbumDto { | ||||
|   @IsOptional() | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator'; | ||||
| import { toBoolean } from '@app/immich/utils/transform.util'; | ||||
| import { ApiProperty } from '@nestjs/swagger'; | ||||
| import { Transform } from 'class-transformer'; | ||||
| import { IsBoolean, IsOptional } from 'class-validator'; | ||||
| import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator'; | ||||
| import { toBoolean } from '@app/immich/utils/transform.util'; | ||||
|  | ||||
| export class GetAlbumsDto { | ||||
|   @IsOptional() | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { toBoolean } from '@app/immich/utils/transform.util'; | ||||
| import { ApiProperty } from '@nestjs/swagger'; | ||||
| import { Transform, Type } from 'class-transformer'; | ||||
| import { IsBoolean, IsDate, IsOptional } from 'class-validator'; | ||||
| import { toBoolean } from '@app/immich/utils/transform.util'; | ||||
|  | ||||
| export class MapMarkerDto { | ||||
|   @ApiProperty() | ||||
|   | ||||
| @@ -1,8 +1,5 @@ | ||||
| import { SystemConfig, UserEntity } from '@app/infra/entities'; | ||||
| import { BadRequestException, UnauthorizedException } from '@nestjs/common'; | ||||
| import { IncomingHttpHeaders } from 'http'; | ||||
| import { generators, Issuer } from 'openid-client'; | ||||
| import { Socket } from 'socket.io'; | ||||
| import { | ||||
|   authStub, | ||||
|   keyStub, | ||||
| @@ -18,6 +15,9 @@ import { | ||||
|   userEntityStub, | ||||
|   userTokenEntityStub, | ||||
| } from '@test'; | ||||
| import { IncomingHttpHeaders } from 'http'; | ||||
| import { generators, Issuer } from 'openid-client'; | ||||
| import { Socket } from 'socket.io'; | ||||
| import { IKeyRepository } from '../api-key'; | ||||
| import { ICryptoRepository } from '../crypto/crypto.repository'; | ||||
| import { ISharedLinkRepository } from '../shared-link'; | ||||
|   | ||||
| @@ -7,21 +7,27 @@ import { | ||||
|   Logger, | ||||
|   UnauthorizedException, | ||||
| } from '@nestjs/common'; | ||||
| import cookieParser from 'cookie'; | ||||
| import { IncomingHttpHeaders } from 'http'; | ||||
| import { IKeyRepository } from '../api-key'; | ||||
| import { APIKeyCore } from '../api-key/api-key.core'; | ||||
| import { ICryptoRepository } from '../crypto/crypto.repository'; | ||||
| import { OAuthCore } from '../oauth/oauth.core'; | ||||
| import { ISharedLinkRepository, SharedLinkCore } from '../shared-link'; | ||||
| import { INITIAL_SYSTEM_CONFIG, ISystemConfigRepository } from '../system-config'; | ||||
| import { IUserRepository, UserCore } from '../user'; | ||||
| import { IUserTokenRepository, UserTokenCore } from '../user-token'; | ||||
| import { AuthType, IMMICH_ACCESS_COOKIE, IMMICH_API_KEY_HEADER } from './auth.constant'; | ||||
| import { AuthCore, LoginDetails } from './auth.core'; | ||||
| import { ICryptoRepository } from '../crypto/crypto.repository'; | ||||
| import { AuthUserDto, ChangePasswordDto, LoginCredentialDto, SignUpDto } from './dto'; | ||||
| import { AdminSignupResponseDto, LoginResponseDto, LogoutResponseDto, mapAdminSignupResponse } from './response-dto'; | ||||
| import { IUserTokenRepository, UserTokenCore } from '../user-token'; | ||||
| import cookieParser from 'cookie'; | ||||
| import { ISharedLinkRepository, SharedLinkCore } from '../shared-link'; | ||||
| import { APIKeyCore } from '../api-key/api-key.core'; | ||||
| import { IKeyRepository } from '../api-key'; | ||||
| import { AuthDeviceResponseDto, mapUserToken } from './response-dto'; | ||||
| import { | ||||
|   AdminSignupResponseDto, | ||||
|   AuthDeviceResponseDto, | ||||
|   LoginResponseDto, | ||||
|   LogoutResponseDto, | ||||
|   mapAdminSignupResponse, | ||||
|   mapUserToken, | ||||
| } from './response-dto'; | ||||
|  | ||||
| @Injectable() | ||||
| export class AuthService { | ||||
|   | ||||
| @@ -1,2 +1,2 @@ | ||||
| export * from './facial-recognition.services'; | ||||
| export * from './face.repository'; | ||||
| export * from './facial-recognition.services'; | ||||
|   | ||||
| @@ -7,9 +7,9 @@ import { | ||||
|   newJobRepositoryMock, | ||||
|   newSystemConfigRepositoryMock, | ||||
| } from '@test'; | ||||
| import { IJobRepository, JobCommand, JobHandler, JobItem, JobName, JobService, QueueName } from '.'; | ||||
| import { IAssetRepository } from '../asset'; | ||||
| import { ICommunicationRepository } from '../communication'; | ||||
| import { IJobRepository, JobCommand, JobHandler, JobItem, JobName, JobService, QueueName } from '.'; | ||||
| import { ISystemConfigRepository } from '../system-config'; | ||||
| import { SystemConfigCore } from '../system-config/system-config.core'; | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| import { constants } from 'fs/promises'; | ||||
| import { assetEntityStub, newAssetRepositoryMock, newJobRepositoryMock, newStorageRepositoryMock } from '@test'; | ||||
| import { constants } from 'fs/promises'; | ||||
| import { IAssetRepository, WithoutProperty, WithProperty } from '../asset'; | ||||
| import { IJobRepository, JobName } from '../job'; | ||||
| import { IStorageRepository } from '../storage'; | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| import { SystemConfig, UserEntity } from '@app/infra/entities'; | ||||
| import { BadRequestException } from '@nestjs/common'; | ||||
| import { generators, Issuer } from 'openid-client'; | ||||
| import { | ||||
|   authStub, | ||||
|   loginResponseStub, | ||||
| @@ -12,6 +11,7 @@ import { | ||||
|   userEntityStub, | ||||
|   userTokenEntityStub, | ||||
| } from '@test'; | ||||
| import { generators, Issuer } from 'openid-client'; | ||||
| import { OAuthService } from '.'; | ||||
| import { LoginDetails } from '../auth'; | ||||
| import { ICryptoRepository } from '../crypto'; | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { PartnerEntity } from '@app/infra/entities'; | ||||
| import { BadRequestException, Inject, Injectable } from '@nestjs/common'; | ||||
| import { AuthUserDto } from '../auth'; | ||||
| import { IPartnerRepository, PartnerDirection, PartnerIds } from '.'; | ||||
| import { AuthUserDto } from '../auth'; | ||||
| import { mapUser, UserResponseDto } from '../user'; | ||||
|  | ||||
| @Injectable() | ||||
|   | ||||
| @@ -1,5 +1,4 @@ | ||||
| import { BadRequestException, NotFoundException } from '@nestjs/common'; | ||||
| import { IJobRepository, JobName } from '..'; | ||||
| import { | ||||
|   assetEntityStub, | ||||
|   authStub, | ||||
| @@ -8,6 +7,7 @@ import { | ||||
|   newStorageRepositoryMock, | ||||
|   personStub, | ||||
| } from '@test'; | ||||
| import { IJobRepository, JobName } from '..'; | ||||
| import { IStorageRepository } from '../storage'; | ||||
| import { IPersonRepository } from './person.repository'; | ||||
| import { PersonService } from './person.service'; | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { toBoolean } from '@app/immich/utils/transform.util'; | ||||
| import { AssetType } from '@app/infra/entities'; | ||||
| import { Transform } from 'class-transformer'; | ||||
| import { IsArray, IsBoolean, IsEnum, IsNotEmpty, IsOptional, IsString } from 'class-validator'; | ||||
| import { toBoolean } from '@app/immich/utils/transform.util'; | ||||
|  | ||||
| export class SearchDto { | ||||
|   @IsString() | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| import { BadRequestException } from '@nestjs/common'; | ||||
| import { ConfigService } from '@nestjs/config'; | ||||
| import { plainToInstance } from 'class-transformer'; | ||||
| import { | ||||
|   albumStub, | ||||
|   assetEntityStub, | ||||
| @@ -15,6 +14,7 @@ import { | ||||
|   newSearchRepositoryMock, | ||||
|   searchStub, | ||||
| } from '@test'; | ||||
| import { plainToInstance } from 'class-transformer'; | ||||
| import { IAlbumRepository } from '../album/album.repository'; | ||||
| import { IAssetRepository } from '../asset/asset.repository'; | ||||
| import { IFaceRepository } from '../facial-recognition'; | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| import { ApiProperty } from '@nestjs/swagger'; | ||||
| import { IServerVersion } from '@app/domain'; | ||||
| import { ApiProperty } from '@nestjs/swagger'; | ||||
|  | ||||
| export class ServerVersionReponseDto implements IServerVersion { | ||||
|   @ApiProperty({ type: 'integer' }) | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| export * from './dto'; | ||||
| export * from './response-dto'; | ||||
| export * from './shared-link.core'; | ||||
| export * from './shared-link.service'; | ||||
| export * from './shared-link.repository'; | ||||
| export * from './shared-link.service'; | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { BadRequestException, ForbiddenException } from '@nestjs/common'; | ||||
| import { authStub, newSharedLinkRepositoryMock, sharedLinkResponseStub, sharedLinkStub } from '@test'; | ||||
| import { SharedLinkService } from './shared-link.service'; | ||||
| import { ISharedLinkRepository } from './shared-link.repository'; | ||||
| import { SharedLinkService } from './shared-link.service'; | ||||
|  | ||||
| describe(SharedLinkService.name, () => { | ||||
|   let sut: SharedLinkService; | ||||
|   | ||||
| @@ -1,4 +1,3 @@ | ||||
| import { when } from 'jest-when'; | ||||
| import { | ||||
|   assetEntityStub, | ||||
|   newAssetRepositoryMock, | ||||
| @@ -8,8 +7,9 @@ import { | ||||
|   systemConfigStub, | ||||
|   userEntityStub, | ||||
| } from '@test'; | ||||
| import { IAssetRepository } from '../asset'; | ||||
| import { when } from 'jest-when'; | ||||
| import { StorageTemplateService } from '.'; | ||||
| import { IAssetRepository } from '../asset'; | ||||
| import { IStorageRepository } from '../storage/storage.repository'; | ||||
| import { ISystemConfigRepository } from '../system-config'; | ||||
| import { IUserRepository } from '../user'; | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { IsEnum, IsString, IsInt, IsBoolean, Min, Max } from 'class-validator'; | ||||
| import { TranscodePreset } from '@app/infra/entities'; | ||||
| import { Type } from 'class-transformer'; | ||||
| import { ApiProperty } from '@nestjs/swagger'; | ||||
| import { Type } from 'class-transformer'; | ||||
| import { IsBoolean, IsEnum, IsInt, IsString, Max, Min } from 'class-validator'; | ||||
|  | ||||
| export class SystemConfigFFmpegDto { | ||||
|   @IsInt() | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| import { SystemConfig } from '@app/infra/entities'; | ||||
| import { Type } from 'class-transformer'; | ||||
| import { IsObject, ValidateNested } from 'class-validator'; | ||||
| import { SystemConfigJobDto } from './system-config-job.dto'; | ||||
| import { SystemConfigFFmpegDto } from './system-config-ffmpeg.dto'; | ||||
| import { SystemConfigJobDto } from './system-config-job.dto'; | ||||
| import { SystemConfigOAuthDto } from './system-config-oauth.dto'; | ||||
| import { SystemConfigPasswordLoginDto } from './system-config-password-login.dto'; | ||||
| import { SystemConfigStorageTemplateDto } from './system-config-storage-template.dto'; | ||||
|   | ||||
| @@ -1,4 +1,8 @@ | ||||
| import { Inject, Injectable } from '@nestjs/common'; | ||||
| import { ISystemConfigRepository } from '.'; | ||||
| import { IJobRepository, JobName } from '../job'; | ||||
| import { mapConfig, SystemConfigDto } from './dto/system-config.dto'; | ||||
| import { SystemConfigTemplateStorageOptionDto } from './response-dto/system-config-template-storage-option.dto'; | ||||
| import { | ||||
|   supportedDayTokens, | ||||
|   supportedHourTokens, | ||||
| @@ -8,10 +12,6 @@ import { | ||||
|   supportedSecondTokens, | ||||
|   supportedYearTokens, | ||||
| } from './system-config.constants'; | ||||
| import { Inject, Injectable } from '@nestjs/common'; | ||||
| import { IJobRepository, JobName } from '../job'; | ||||
| import { mapConfig, SystemConfigDto } from './dto/system-config.dto'; | ||||
| import { SystemConfigTemplateStorageOptionDto } from './response-dto/system-config-template-storage-option.dto'; | ||||
| import { SystemConfigCore, SystemConfigValidator } from './system-config.core'; | ||||
|  | ||||
| @Injectable() | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { TagType } from '@app/infra/entities'; | ||||
| import { BadRequestException } from '@nestjs/common'; | ||||
| import { when } from 'jest-when'; | ||||
| import { assetEntityStub, authStub, newTagRepositoryMock, tagResponseStub, tagStub } from '@test'; | ||||
| import { when } from 'jest-when'; | ||||
| import { AssetIdErrorReason } from '../asset'; | ||||
| import { ITagRepository } from './tag.repository'; | ||||
| import { TagService } from './tag.service'; | ||||
|   | ||||
| @@ -1,2 +1,2 @@ | ||||
| export * from './user-token.repository'; | ||||
| export * from './user-token.core'; | ||||
| export * from './user-token.repository'; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| import { toEmail, toSanitized } from '@app/immich/utils/transform.util'; | ||||
| import { Transform } from 'class-transformer'; | ||||
| import { IsEmail, IsNotEmpty, IsOptional, IsString } from 'class-validator'; | ||||
| import { toEmail, toSanitized } from '@app/immich/utils/transform.util'; | ||||
|  | ||||
| export class CreateUserDto { | ||||
|   @IsEmail({ require_tld: false }) | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { toEmail, toSanitized } from '@app/immich/utils/transform.util'; | ||||
| import { ApiProperty } from '@nestjs/swagger'; | ||||
| import { Transform } from 'class-transformer'; | ||||
| import { IsBoolean, IsEmail, IsNotEmpty, IsOptional, IsString, IsUUID } from 'class-validator'; | ||||
| import { toEmail, toSanitized } from '@app/immich/utils/transform.util'; | ||||
|  | ||||
| export class UpdateUserDto { | ||||
|   @IsOptional() | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| import { UserEntity } from '@app/infra/entities'; | ||||
| import { BadRequestException, ForbiddenException, NotFoundException } from '@nestjs/common'; | ||||
| import { when } from 'jest-when'; | ||||
| import { | ||||
|   newAlbumRepositoryMock, | ||||
|   newAssetRepositoryMock, | ||||
| @@ -9,6 +8,7 @@ import { | ||||
|   newStorageRepositoryMock, | ||||
|   newUserRepositoryMock, | ||||
| } from '@test'; | ||||
| import { when } from 'jest-when'; | ||||
| import { IAlbumRepository } from '../album'; | ||||
| import { IAssetRepository } from '../asset'; | ||||
| import { AuthUserDto } from '../auth'; | ||||
|   | ||||
| @@ -9,7 +9,6 @@ import { ICryptoRepository } from '../crypto/crypto.repository'; | ||||
| import { IEntityJob, IJobRepository, JobName } from '../job'; | ||||
| import { StorageCore, StorageFolder } from '../storage'; | ||||
| import { IStorageRepository } from '../storage/storage.repository'; | ||||
| import { IUserRepository } from './user.repository'; | ||||
| import { CreateUserDto, UpdateUserDto, UserCountDto } from './dto'; | ||||
| import { | ||||
|   CreateProfileImageResponseDto, | ||||
| @@ -20,6 +19,7 @@ import { | ||||
|   UserResponseDto, | ||||
| } from './response-dto'; | ||||
| import { UserCore } from './user.core'; | ||||
| import { IUserRepository } from './user.repository'; | ||||
|  | ||||
| @Injectable() | ||||
| export class UserService { | ||||
|   | ||||
| @@ -1,10 +1,10 @@ | ||||
| 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/entities'; | ||||
| import { AlbumRepository, IAlbumRepository } from './album-repository'; | ||||
| import { Module } from '@nestjs/common'; | ||||
| import { TypeOrmModule } from '@nestjs/typeorm'; | ||||
| import { DownloadModule } from '../../modules/download/download.module'; | ||||
| import { AlbumRepository, IAlbumRepository } from './album-repository'; | ||||
| import { AlbumController } from './album.controller'; | ||||
| import { AlbumService } from './album.service'; | ||||
|  | ||||
| @Module({ | ||||
|   imports: [TypeOrmModule.forFeature([AlbumEntity, AssetEntity]), DownloadModule], | ||||
|   | ||||
| @@ -1,21 +1,22 @@ | ||||
| import { BadRequestException, Inject, Injectable, NotFoundException, ForbiddenException, Logger } from '@nestjs/common'; | ||||
| import { AuthUserDto } from '../../decorators/auth-user.decorator'; | ||||
| import { | ||||
|   AlbumResponseDto, | ||||
|   ICryptoRepository, | ||||
|   ISharedLinkRepository, | ||||
|   mapAlbum, | ||||
|   mapSharedLink, | ||||
|   SharedLinkCore, | ||||
|   SharedLinkResponseDto, | ||||
| } from '@app/domain'; | ||||
| import { AlbumEntity, SharedLinkType } from '@app/infra/entities'; | ||||
| import { RemoveAssetsDto } from './dto/remove-assets.dto'; | ||||
| import { AlbumResponseDto, mapAlbum } from '@app/domain'; | ||||
| import { IAlbumRepository } from './album-repository'; | ||||
| import { AddAssetsResponseDto } from './response-dto/add-assets-response.dto'; | ||||
| import { AddAssetsDto } from './dto/add-assets.dto'; | ||||
| import { BadRequestException, ForbiddenException, Inject, Injectable, Logger, NotFoundException } from '@nestjs/common'; | ||||
| import { AuthUserDto } from '../../decorators/auth-user.decorator'; | ||||
| import { DownloadService } from '../../modules/download/download.service'; | ||||
| import { DownloadDto } from '../asset/dto/download-library.dto'; | ||||
| import { | ||||
|   SharedLinkCore, | ||||
|   ISharedLinkRepository, | ||||
|   mapSharedLink, | ||||
|   SharedLinkResponseDto, | ||||
|   ICryptoRepository, | ||||
| } from '@app/domain'; | ||||
| import { IAlbumRepository } from './album-repository'; | ||||
| import { AddAssetsDto } from './dto/add-assets.dto'; | ||||
| import { CreateAlbumShareLinkDto } from './dto/create-album-shared-link.dto'; | ||||
| import { RemoveAssetsDto } from './dto/remove-assets.dto'; | ||||
| import { AddAssetsResponseDto } from './response-dto/add-assets-response.dto'; | ||||
|  | ||||
| @Injectable() | ||||
| export class AlbumService { | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| import { ApiProperty } from '@nestjs/swagger'; | ||||
| import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator'; | ||||
| import { ApiProperty } from '@nestjs/swagger'; | ||||
| import { Type } from 'class-transformer'; | ||||
| import { IsBoolean, IsDate, IsOptional, IsString } from 'class-validator'; | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| import { ApiProperty } from '@nestjs/swagger'; | ||||
| import { AlbumResponseDto } from '@app/domain'; | ||||
| import { ApiProperty } from '@nestjs/swagger'; | ||||
|  | ||||
| export class AddAssetsResponseDto { | ||||
|   @ApiProperty({ type: 'integer' }) | ||||
|   | ||||
| @@ -1,19 +1,19 @@ | ||||
| import { SearchPropertiesDto } from './dto/search-properties.dto'; | ||||
| import { CuratedLocationsResponseDto } from './response-dto/curated-locations-response.dto'; | ||||
| import { AssetEntity, AssetType, ExifEntity } from '@app/infra/entities'; | ||||
| import { Injectable } from '@nestjs/common'; | ||||
| import { InjectRepository } from '@nestjs/typeorm'; | ||||
| import { Repository } from 'typeorm/repository/Repository'; | ||||
| import { CuratedObjectsResponseDto } from './response-dto/curated-objects-response.dto'; | ||||
| import { AssetCountByTimeBucket } from './response-dto/asset-count-by-time-group-response.dto'; | ||||
| import { GetAssetCountByTimeBucketDto, TimeGroupEnum } from './dto/get-asset-count-by-time-bucket.dto'; | ||||
| import { GetAssetByTimeBucketDto } from './dto/get-asset-by-time-bucket.dto'; | ||||
| import { AssetCountByUserIdResponseDto } from './response-dto/asset-count-by-user-id-response.dto'; | ||||
| import { CheckExistingAssetsDto } from './dto/check-existing-assets.dto'; | ||||
| import { In } from 'typeorm/find-options/operator/In'; | ||||
| import { UpdateAssetDto } from './dto/update-asset.dto'; | ||||
| import { IsNull, Not } from 'typeorm'; | ||||
| import { In } from 'typeorm/find-options/operator/In'; | ||||
| import { Repository } from 'typeorm/repository/Repository'; | ||||
| import { AssetSearchDto } from './dto/asset-search.dto'; | ||||
| import { CheckExistingAssetsDto } from './dto/check-existing-assets.dto'; | ||||
| import { GetAssetByTimeBucketDto } from './dto/get-asset-by-time-bucket.dto'; | ||||
| import { GetAssetCountByTimeBucketDto, TimeGroupEnum } from './dto/get-asset-count-by-time-bucket.dto'; | ||||
| import { SearchPropertiesDto } from './dto/search-properties.dto'; | ||||
| import { UpdateAssetDto } from './dto/update-asset.dto'; | ||||
| import { AssetCountByTimeBucket } from './response-dto/asset-count-by-time-group-response.dto'; | ||||
| import { AssetCountByUserIdResponseDto } from './response-dto/asset-count-by-user-id-response.dto'; | ||||
| import { CuratedLocationsResponseDto } from './response-dto/curated-locations-response.dto'; | ||||
| import { CuratedObjectsResponseDto } from './response-dto/curated-objects-response.dto'; | ||||
|  | ||||
| export interface AssetCheck { | ||||
|   id: string; | ||||
|   | ||||
| @@ -1,62 +1,61 @@ | ||||
| import { AddAssetsDto } from '../album/dto/add-assets.dto'; | ||||
| import { AssetResponseDto, ImmichReadStream, SharedLinkResponseDto } from '@app/domain'; | ||||
| import { | ||||
|   Controller, | ||||
|   Post, | ||||
|   UseInterceptors, | ||||
|   Body, | ||||
|   Controller, | ||||
|   Delete, | ||||
|   Get, | ||||
|   Header, | ||||
|   Headers, | ||||
|   HttpCode, | ||||
|   Param, | ||||
|   ValidationPipe, | ||||
|   ParseFilePipe, | ||||
|   Patch, | ||||
|   Post, | ||||
|   Put, | ||||
|   Query, | ||||
|   Response, | ||||
|   Headers, | ||||
|   Delete, | ||||
|   HttpCode, | ||||
|   Header, | ||||
|   Put, | ||||
|   UploadedFiles, | ||||
|   Patch, | ||||
|   StreamableFile, | ||||
|   ParseFilePipe, | ||||
|   UploadedFiles, | ||||
|   UseInterceptors, | ||||
|   ValidationPipe, | ||||
| } from '@nestjs/common'; | ||||
| import { Authenticated, SharedLinkRoute } from '../../decorators/authenticated.decorator'; | ||||
| import { AssetService } from './asset.service'; | ||||
| import { FileFieldsInterceptor } from '@nestjs/platform-express'; | ||||
| import { AuthUserDto, AuthUser } from '../../decorators/auth-user.decorator'; | ||||
| import { ServeFileDto } from './dto/serve-file.dto'; | ||||
| import { Response as Res } from 'express'; | ||||
| import { DeleteAssetDto } from './dto/delete-asset.dto'; | ||||
| import { SearchAssetDto } from './dto/search-asset.dto'; | ||||
| import { CheckDuplicateAssetDto } from './dto/check-duplicate-asset.dto'; | ||||
| import { ApiBody, ApiConsumes, ApiHeader, ApiOkResponse, ApiTags } from '@nestjs/swagger'; | ||||
| import { CuratedObjectsResponseDto } from './response-dto/curated-objects-response.dto'; | ||||
| import { CuratedLocationsResponseDto } from './response-dto/curated-locations-response.dto'; | ||||
| import { AssetResponseDto, ImmichReadStream } from '@app/domain'; | ||||
| import { CheckDuplicateAssetResponseDto } from './response-dto/check-duplicate-asset-response.dto'; | ||||
| import { CreateAssetDto, mapToUploadFile } from './dto/create-asset.dto'; | ||||
| import { AssetFileUploadResponseDto } from './response-dto/asset-file-upload-response.dto'; | ||||
| import { DeleteAssetResponseDto } from './response-dto/delete-asset-response.dto'; | ||||
| import { GetAssetThumbnailDto } from './dto/get-asset-thumbnail.dto'; | ||||
| import { AssetCountByTimeBucketResponseDto } from './response-dto/asset-count-by-time-group-response.dto'; | ||||
| import { GetAssetCountByTimeBucketDto } from './dto/get-asset-count-by-time-bucket.dto'; | ||||
| import { GetAssetByTimeBucketDto } from './dto/get-asset-by-time-bucket.dto'; | ||||
| import { AssetCountByUserIdResponseDto } from './response-dto/asset-count-by-user-id-response.dto'; | ||||
| import { CheckExistingAssetsDto } from './dto/check-existing-assets.dto'; | ||||
| import { CheckExistingAssetsResponseDto } from './response-dto/check-existing-assets-response.dto'; | ||||
| import { UpdateAssetDto } from './dto/update-asset.dto'; | ||||
| import { DownloadDto } from './dto/download-library.dto'; | ||||
| import { DownloadFilesDto } from './dto/download-files.dto'; | ||||
| import { CreateAssetsShareLinkDto } from './dto/create-asset-shared-link.dto'; | ||||
| import { SharedLinkResponseDto } from '@app/domain'; | ||||
| import { AssetSearchDto } from './dto/asset-search.dto'; | ||||
| import { assetUploadOption, ImmichFile } from '../../config/asset-upload.config'; | ||||
| import FileNotEmptyValidator from '../validation/file-not-empty-validator'; | ||||
| import { RemoveAssetsDto } from '../album/dto/remove-assets.dto'; | ||||
| import { AssetBulkUploadCheckDto } from './dto/asset-check.dto'; | ||||
| import { AssetBulkUploadCheckResponseDto } from './response-dto/asset-check-response.dto'; | ||||
| import { UUIDParamDto } from '../../controllers/dto/uuid-param.dto'; | ||||
| import { DeviceIdDto } from './dto/device-id.dto'; | ||||
| import { Response as Res } from 'express'; | ||||
| import { handleDownload } from '../../app.utils'; | ||||
| import { assetUploadOption, ImmichFile } from '../../config/asset-upload.config'; | ||||
| import { UUIDParamDto } from '../../controllers/dto/uuid-param.dto'; | ||||
| import { AuthUser, AuthUserDto } from '../../decorators/auth-user.decorator'; | ||||
| import { Authenticated, SharedLinkRoute } from '../../decorators/authenticated.decorator'; | ||||
| import { AddAssetsDto } from '../album/dto/add-assets.dto'; | ||||
| import { RemoveAssetsDto } from '../album/dto/remove-assets.dto'; | ||||
| import FileNotEmptyValidator from '../validation/file-not-empty-validator'; | ||||
| import { AssetService } from './asset.service'; | ||||
| import { AssetBulkUploadCheckDto } from './dto/asset-check.dto'; | ||||
| import { AssetSearchDto } from './dto/asset-search.dto'; | ||||
| import { CheckDuplicateAssetDto } from './dto/check-duplicate-asset.dto'; | ||||
| import { CheckExistingAssetsDto } from './dto/check-existing-assets.dto'; | ||||
| import { CreateAssetsShareLinkDto } from './dto/create-asset-shared-link.dto'; | ||||
| import { CreateAssetDto, mapToUploadFile } from './dto/create-asset.dto'; | ||||
| import { DeleteAssetDto } from './dto/delete-asset.dto'; | ||||
| import { DeviceIdDto } from './dto/device-id.dto'; | ||||
| import { DownloadFilesDto } from './dto/download-files.dto'; | ||||
| import { DownloadDto } from './dto/download-library.dto'; | ||||
| import { GetAssetByTimeBucketDto } from './dto/get-asset-by-time-bucket.dto'; | ||||
| import { GetAssetCountByTimeBucketDto } from './dto/get-asset-count-by-time-bucket.dto'; | ||||
| import { GetAssetThumbnailDto } from './dto/get-asset-thumbnail.dto'; | ||||
| import { SearchAssetDto } from './dto/search-asset.dto'; | ||||
| import { ServeFileDto } from './dto/serve-file.dto'; | ||||
| import { UpdateAssetDto } from './dto/update-asset.dto'; | ||||
| import { AssetBulkUploadCheckResponseDto } from './response-dto/asset-check-response.dto'; | ||||
| import { AssetCountByTimeBucketResponseDto } from './response-dto/asset-count-by-time-group-response.dto'; | ||||
| import { AssetCountByUserIdResponseDto } from './response-dto/asset-count-by-user-id-response.dto'; | ||||
| import { AssetFileUploadResponseDto } from './response-dto/asset-file-upload-response.dto'; | ||||
| import { CheckDuplicateAssetResponseDto } from './response-dto/check-duplicate-asset-response.dto'; | ||||
| import { CheckExistingAssetsResponseDto } from './response-dto/check-existing-assets-response.dto'; | ||||
| import { CuratedLocationsResponseDto } from './response-dto/curated-locations-response.dto'; | ||||
| import { CuratedObjectsResponseDto } from './response-dto/curated-objects-response.dto'; | ||||
| import { DeleteAssetResponseDto } from './response-dto/delete-asset-response.dto'; | ||||
|  | ||||
| function asStreamableFile({ stream, type, length }: ImmichReadStream) { | ||||
|   return new StreamableFile(stream, { type, length }); | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| import { AuthUserDto, IJobRepository, JobName } from '@app/domain'; | ||||
| import { AssetEntity, AssetType, UserEntity } from '@app/infra/entities'; | ||||
| import { parse } from 'node:path'; | ||||
| import { IAssetRepository } from './asset-repository'; | ||||
| import { CreateAssetDto, UploadFile } from './dto/create-asset.dto'; | ||||
| import { parse } from 'node:path'; | ||||
|  | ||||
| export class AssetCore { | ||||
|   constructor(private repository: IAssetRepository, private jobRepository: IJobRepository) {} | ||||
|   | ||||
| @@ -1,10 +1,10 @@ | ||||
| import { Module } from '@nestjs/common'; | ||||
| import { AssetService } from './asset.service'; | ||||
| import { AssetController } from './asset.controller'; | ||||
| import { TypeOrmModule } from '@nestjs/typeorm'; | ||||
| import { AssetEntity, ExifEntity } from '@app/infra/entities'; | ||||
| import { AssetRepository, IAssetRepository } from './asset-repository'; | ||||
| import { Module } from '@nestjs/common'; | ||||
| import { TypeOrmModule } from '@nestjs/typeorm'; | ||||
| import { DownloadModule } from '../../modules/download/download.module'; | ||||
| import { AssetRepository, IAssetRepository } from './asset-repository'; | ||||
| import { AssetController } from './asset.controller'; | ||||
| import { AssetService } from './asset.service'; | ||||
|  | ||||
| @Module({ | ||||
|   imports: [ | ||||
|   | ||||
| @@ -1,12 +1,3 @@ | ||||
| import { IAssetRepository } from './asset-repository'; | ||||
| import { AssetService } from './asset.service'; | ||||
| import { QueryFailedError, Repository } from 'typeorm'; | ||||
| import { AssetEntity, AssetType, ExifEntity } 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'; | ||||
| import { AssetCountByUserIdResponseDto } from './response-dto/asset-count-by-user-id-response.dto'; | ||||
| import { DownloadService } from '../../modules/download/download.service'; | ||||
| import { | ||||
|   IAccessRepository, | ||||
|   ICryptoRepository, | ||||
| @@ -15,6 +6,8 @@ import { | ||||
|   IStorageRepository, | ||||
|   JobName, | ||||
| } from '@app/domain'; | ||||
| import { AssetEntity, AssetType, ExifEntity } from '@app/infra/entities'; | ||||
| import { BadRequestException, ForbiddenException } from '@nestjs/common'; | ||||
| import { | ||||
|   assetEntityStub, | ||||
|   authStub, | ||||
| @@ -27,10 +20,17 @@ import { | ||||
|   sharedLinkResponseStub, | ||||
|   sharedLinkStub, | ||||
| } from '@test'; | ||||
| import { CreateAssetsShareLinkDto } from './dto/create-asset-shared-link.dto'; | ||||
| import { BadRequestException, ForbiddenException } from '@nestjs/common'; | ||||
| import { when } from 'jest-when'; | ||||
| import { QueryFailedError, Repository } from 'typeorm'; | ||||
| import { DownloadService } from '../../modules/download/download.service'; | ||||
| import { IAssetRepository } from './asset-repository'; | ||||
| import { AssetService } from './asset.service'; | ||||
| import { CreateAssetsShareLinkDto } from './dto/create-asset-shared-link.dto'; | ||||
| import { CreateAssetDto } from './dto/create-asset.dto'; | ||||
| import { TimeGroupEnum } from './dto/get-asset-count-by-time-bucket.dto'; | ||||
| import { AssetRejectReason, AssetUploadAction } from './response-dto/asset-check-response.dto'; | ||||
| import { AssetCountByTimeBucket } from './response-dto/asset-count-by-time-group-response.dto'; | ||||
| import { AssetCountByUserIdResponseDto } from './response-dto/asset-count-by-user-id-response.dto'; | ||||
|  | ||||
| const _getCreateAssetDto = (): CreateAssetDto => { | ||||
|   const createAssetDto = new CreateAssetDto(); | ||||
|   | ||||
| @@ -1,4 +1,20 @@ | ||||
| import { CuratedLocationsResponseDto } from './response-dto/curated-locations-response.dto'; | ||||
| import { | ||||
|   AssetResponseDto, | ||||
|   getLivePhotoMotionFilename, | ||||
|   IAccessRepository, | ||||
|   ICryptoRepository, | ||||
|   IJobRepository, | ||||
|   ImmichReadStream, | ||||
|   ISharedLinkRepository, | ||||
|   IStorageRepository, | ||||
|   JobName, | ||||
|   mapAsset, | ||||
|   mapAssetWithoutExif, | ||||
|   mapSharedLink, | ||||
|   SharedLinkCore, | ||||
|   SharedLinkResponseDto, | ||||
| } from '@app/domain'; | ||||
| import { AssetEntity, AssetType, SharedLinkType } from '@app/infra/entities'; | ||||
| import { | ||||
|   BadRequestException, | ||||
|   ForbiddenException, | ||||
| @@ -10,63 +26,49 @@ import { | ||||
|   StreamableFile, | ||||
| } from '@nestjs/common'; | ||||
| import { InjectRepository } from '@nestjs/typeorm'; | ||||
| import { QueryFailedError, Repository } from 'typeorm'; | ||||
| import { AuthUserDto } from '../../decorators/auth-user.decorator'; | ||||
| 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'; | ||||
| import { promisify } from 'util'; | ||||
| import { DeleteAssetDto } from './dto/delete-asset.dto'; | ||||
| import { SearchAssetDto } from './dto/search-asset.dto'; | ||||
| import { constants, createReadStream, stat } from 'fs'; | ||||
| import fs from 'fs/promises'; | ||||
| import { CheckDuplicateAssetDto } from './dto/check-duplicate-asset.dto'; | ||||
| import { CuratedObjectsResponseDto } from './response-dto/curated-objects-response.dto'; | ||||
| import { | ||||
|   AssetResponseDto, | ||||
|   getLivePhotoMotionFilename, | ||||
|   IAccessRepository, | ||||
|   ImmichReadStream, | ||||
|   IStorageRepository, | ||||
|   JobName, | ||||
|   mapAsset, | ||||
|   mapAssetWithoutExif, | ||||
| } from '@app/domain'; | ||||
| import { CreateAssetDto, UploadFile } from './dto/create-asset.dto'; | ||||
| import { DeleteAssetResponseDto, DeleteAssetStatusEnum } from './response-dto/delete-asset-response.dto'; | ||||
| import { GetAssetThumbnailDto, GetAssetThumbnailFormatEnum } from './dto/get-asset-thumbnail.dto'; | ||||
| import { CheckDuplicateAssetResponseDto } from './response-dto/check-duplicate-asset-response.dto'; | ||||
| import { QueryFailedError, Repository } from 'typeorm'; | ||||
| import { promisify } from 'util'; | ||||
| import { AuthUserDto } from '../../decorators/auth-user.decorator'; | ||||
| import { DownloadService } from '../../modules/download/download.service'; | ||||
| import { AddAssetsDto } from '../album/dto/add-assets.dto'; | ||||
| import { RemoveAssetsDto } from '../album/dto/remove-assets.dto'; | ||||
| import { IAssetRepository } from './asset-repository'; | ||||
| import { AssetCore } from './asset.core'; | ||||
| import { AssetBulkUploadCheckDto } from './dto/asset-check.dto'; | ||||
| import { AssetSearchDto } from './dto/asset-search.dto'; | ||||
| import { CheckDuplicateAssetDto } from './dto/check-duplicate-asset.dto'; | ||||
| import { CheckExistingAssetsDto } from './dto/check-existing-assets.dto'; | ||||
| import { CreateAssetsShareLinkDto } from './dto/create-asset-shared-link.dto'; | ||||
| import { CreateAssetDto, UploadFile } from './dto/create-asset.dto'; | ||||
| import { DeleteAssetDto } from './dto/delete-asset.dto'; | ||||
| import { DownloadFilesDto } from './dto/download-files.dto'; | ||||
| import { DownloadDto } from './dto/download-library.dto'; | ||||
| import { GetAssetByTimeBucketDto } from './dto/get-asset-by-time-bucket.dto'; | ||||
| import { GetAssetCountByTimeBucketDto } from './dto/get-asset-count-by-time-bucket.dto'; | ||||
| import { GetAssetThumbnailDto, GetAssetThumbnailFormatEnum } from './dto/get-asset-thumbnail.dto'; | ||||
| import { SearchAssetDto } from './dto/search-asset.dto'; | ||||
| import { SearchPropertiesDto } from './dto/search-properties.dto'; | ||||
| import { ServeFileDto } from './dto/serve-file.dto'; | ||||
| import { UpdateAssetDto } from './dto/update-asset.dto'; | ||||
| import { | ||||
|   AssetBulkUploadCheckResponseDto, | ||||
|   AssetRejectReason, | ||||
|   AssetUploadAction, | ||||
| } from './response-dto/asset-check-response.dto'; | ||||
| import { | ||||
|   AssetCountByTimeBucketResponseDto, | ||||
|   mapAssetCountByTimeBucket, | ||||
| } from './response-dto/asset-count-by-time-group-response.dto'; | ||||
| import { GetAssetCountByTimeBucketDto } from './dto/get-asset-count-by-time-bucket.dto'; | ||||
| import { GetAssetByTimeBucketDto } from './dto/get-asset-by-time-bucket.dto'; | ||||
| import { AssetCountByUserIdResponseDto } from './response-dto/asset-count-by-user-id-response.dto'; | ||||
| import { AssetCore } from './asset.core'; | ||||
| import { CheckExistingAssetsDto } from './dto/check-existing-assets.dto'; | ||||
| import { CheckExistingAssetsResponseDto } from './response-dto/check-existing-assets-response.dto'; | ||||
| import { UpdateAssetDto } from './dto/update-asset.dto'; | ||||
| import { AssetFileUploadResponseDto } from './response-dto/asset-file-upload-response.dto'; | ||||
| import { ICryptoRepository, IJobRepository } from '@app/domain'; | ||||
| import { DownloadService } from '../../modules/download/download.service'; | ||||
| import { DownloadDto } from './dto/download-library.dto'; | ||||
| import { SharedLinkCore } from '@app/domain'; | ||||
| import { ISharedLinkRepository } from '@app/domain'; | ||||
| import { DownloadFilesDto } from './dto/download-files.dto'; | ||||
| import { CreateAssetsShareLinkDto } from './dto/create-asset-shared-link.dto'; | ||||
| import { mapSharedLink, SharedLinkResponseDto } from '@app/domain'; | ||||
| import { AssetSearchDto } from './dto/asset-search.dto'; | ||||
| import { AddAssetsDto } from '../album/dto/add-assets.dto'; | ||||
| import { RemoveAssetsDto } from '../album/dto/remove-assets.dto'; | ||||
| import { AssetBulkUploadCheckDto } from './dto/asset-check.dto'; | ||||
| import { | ||||
|   AssetUploadAction, | ||||
|   AssetRejectReason, | ||||
|   AssetBulkUploadCheckResponseDto, | ||||
| } from './response-dto/asset-check-response.dto'; | ||||
| import { CheckDuplicateAssetResponseDto } from './response-dto/check-duplicate-asset-response.dto'; | ||||
| import { CheckExistingAssetsResponseDto } from './response-dto/check-existing-assets-response.dto'; | ||||
| import { CuratedLocationsResponseDto } from './response-dto/curated-locations-response.dto'; | ||||
| import { CuratedObjectsResponseDto } from './response-dto/curated-objects-response.dto'; | ||||
| import { DeleteAssetResponseDto, DeleteAssetStatusEnum } from './response-dto/delete-asset-response.dto'; | ||||
|  | ||||
| const fileInfo = promisify(stat); | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import { ParseUUIDPipe, Injectable, ArgumentMetadata } from '@nestjs/common'; | ||||
| import { ArgumentMetadata, Injectable, ParseUUIDPipe } from '@nestjs/common'; | ||||
|  | ||||
| @Injectable() | ||||
| export class ParseMeUUIDPipe extends ParseUUIDPipe { | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| import { SystemConfigService } from '@app/domain'; | ||||
| import { Controller, HttpCode, HttpStatus, Post } from '@nestjs/common'; | ||||
| import { ApiExcludeEndpoint } from '@nestjs/swagger'; | ||||
| import { SystemConfigService } from '@app/domain'; | ||||
|  | ||||
| @Controller() | ||||
| export class AppController { | ||||
|   | ||||
| @@ -1,11 +1,11 @@ | ||||
| import { AssetService, AuthUserDto, MapMarkerResponseDto, MemoryLaneDto } from '@app/domain'; | ||||
| import { MapMarkerDto } from '@app/domain/asset/dto/map-marker.dto'; | ||||
| import { MemoryLaneResponseDto } from '@app/domain/asset/response-dto/memory-lane-response.dto'; | ||||
| import { Controller, Get, Query } from '@nestjs/common'; | ||||
| import { ApiTags } from '@nestjs/swagger'; | ||||
| import { AuthUser } from '../decorators/auth-user.decorator'; | ||||
| import { Authenticated } from '../decorators/authenticated.decorator'; | ||||
| import { UseValidation } from '../decorators/use-validation.decorator'; | ||||
| import { MemoryLaneResponseDto } from '@app/domain/asset/response-dto/memory-lane-response.dto'; | ||||
|  | ||||
| @ApiTags('Asset') | ||||
| @Controller('asset') | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import { AllJobStatusResponseDto, JobCommandDto, JobStatusDto, JobIdDto, JobService } from '@app/domain'; | ||||
| import { AllJobStatusResponseDto, JobCommandDto, JobIdDto, JobService, JobStatusDto } from '@app/domain'; | ||||
| import { Body, Controller, Get, Param, Put } from '@nestjs/common'; | ||||
| import { ApiTags } from '@nestjs/swagger'; | ||||
| import { Authenticated } from '../decorators/authenticated.decorator'; | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { PartnerDirection, PartnerService, UserResponseDto } from '@app/domain'; | ||||
| import { Controller, Delete, Get, Param, Post, Query } from '@nestjs/common'; | ||||
| import { ApiQuery, ApiTags } from '@nestjs/swagger'; | ||||
| import { AuthUserDto, AuthUser } from '../decorators/auth-user.decorator'; | ||||
| import { AuthUser, AuthUserDto } from '../decorators/auth-user.decorator'; | ||||
| import { Authenticated } from '../decorators/authenticated.decorator'; | ||||
| import { UseValidation } from '../decorators/use-validation.decorator'; | ||||
| import { UUIDParamDto } from './dto/uuid-param.dto'; | ||||
|   | ||||
| @@ -9,7 +9,7 @@ import { | ||||
| } from '@app/domain'; | ||||
| import { Body, Controller, Delete, Get, Param, Patch, Post, Put } from '@nestjs/common'; | ||||
| import { ApiTags } from '@nestjs/swagger'; | ||||
| import { AuthUserDto, AuthUser } from '../decorators/auth-user.decorator'; | ||||
| import { AuthUser, AuthUserDto } from '../decorators/auth-user.decorator'; | ||||
| import { Authenticated } from '../decorators/authenticated.decorator'; | ||||
| import { UseValidation } from '../decorators/use-validation.decorator'; | ||||
| import { UUIDParamDto } from './dto/uuid-param.dto'; | ||||
|   | ||||
| @@ -1,34 +1,36 @@ | ||||
| import { | ||||
|   Controller, | ||||
|   Get, | ||||
|   Post, | ||||
|   Delete, | ||||
|   CreateProfileImageDto, | ||||
|   CreateProfileImageResponseDto, | ||||
|   CreateUserDto, | ||||
|   UpdateUserDto, | ||||
|   UserCountDto, | ||||
|   UserCountResponseDto, | ||||
|   UserResponseDto, | ||||
|   UserService, | ||||
| } from '@app/domain'; | ||||
| import { UserIdDto } from '@app/domain/user/dto/user-id.dto'; | ||||
| import { | ||||
|   Body, | ||||
|   Controller, | ||||
|   Delete, | ||||
|   Get, | ||||
|   Header, | ||||
|   Param, | ||||
|   Post, | ||||
|   Put, | ||||
|   Query, | ||||
|   UseInterceptors, | ||||
|   UploadedFile, | ||||
|   Response, | ||||
|   StreamableFile, | ||||
|   Header, | ||||
|   UploadedFile, | ||||
|   UseInterceptors, | ||||
| } from '@nestjs/common'; | ||||
| import { UserService } from '@app/domain'; | ||||
| import { AdminRoute, Authenticated, PublicRoute } from '../decorators/authenticated.decorator'; | ||||
| import { AuthUserDto, AuthUser } from '../decorators/auth-user.decorator'; | ||||
| import { CreateUserDto } from '@app/domain'; | ||||
| import { UpdateUserDto } from '@app/domain'; | ||||
| import { FileInterceptor } from '@nestjs/platform-express'; | ||||
| import { profileImageUploadOption } from '../config/profile-image-upload.config'; | ||||
| import { Response as Res } from 'express'; | ||||
| import { ApiBody, ApiConsumes, ApiTags } from '@nestjs/swagger'; | ||||
| import { UserResponseDto } from '@app/domain'; | ||||
| import { UserCountResponseDto } from '@app/domain'; | ||||
| import { CreateProfileImageDto } from '@app/domain'; | ||||
| import { CreateProfileImageResponseDto } from '@app/domain'; | ||||
| import { UserCountDto } from '@app/domain'; | ||||
| import { Response as Res } from 'express'; | ||||
| import { profileImageUploadOption } from '../config/profile-image-upload.config'; | ||||
| import { AuthUser, AuthUserDto } from '../decorators/auth-user.decorator'; | ||||
| import { AdminRoute, Authenticated, PublicRoute } from '../decorators/authenticated.decorator'; | ||||
| import { UseValidation } from '../decorators/use-validation.decorator'; | ||||
| import { UserIdDto } from '@app/domain/user/dto/user-id.dto'; | ||||
|  | ||||
| @ApiTags('User') | ||||
| @Controller('user') | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| import { asHumanReadable, HumanReadableSize } from '@app/domain'; | ||||
| import { AssetEntity } from '@app/infra/entities'; | ||||
| import { BadRequestException, Injectable, InternalServerErrorException, Logger, StreamableFile } from '@nestjs/common'; | ||||
| import archiver from 'archiver'; | ||||
| import { extname } from 'path'; | ||||
| import { asHumanReadable, HumanReadableSize } from '@app/domain'; | ||||
|  | ||||
| export interface DownloadArchive { | ||||
|   stream: StreamableFile; | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { AuthService } from '@app/domain'; | ||||
| import { Logger } from '@nestjs/common'; | ||||
| import { OnGatewayConnection, OnGatewayDisconnect, WebSocketGateway, WebSocketServer } from '@nestjs/websockets'; | ||||
| import { Server, Socket } from 'socket.io'; | ||||
| import { AuthService } from '@app/domain'; | ||||
|  | ||||
| @WebSocketGateway({ cors: true }) | ||||
| export class CommunicationGateway implements OnGatewayConnection, OnGatewayDisconnect { | ||||
|   | ||||
| @@ -9,8 +9,8 @@ import { | ||||
|   PrimaryGeneratedColumn, | ||||
|   UpdateDateColumn, | ||||
| } from 'typeorm'; | ||||
| import { SharedLinkEntity } from './shared-link.entity'; | ||||
| import { AssetEntity } from './asset.entity'; | ||||
| import { SharedLinkEntity } from './shared-link.entity'; | ||||
| import { UserEntity } from './user.entity'; | ||||
|  | ||||
| @Entity('albums') | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import { CreateDateColumn, Entity, ManyToOne, PrimaryColumn, JoinColumn, UpdateDateColumn } from 'typeorm'; | ||||
| import { CreateDateColumn, Entity, JoinColumn, ManyToOne, PrimaryColumn, UpdateDateColumn } from 'typeorm'; | ||||
|  | ||||
| import { UserEntity } from './user.entity'; | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| import { Column, Entity, PrimaryColumn } from 'typeorm'; | ||||
| import { QueueName } from '@app/domain/job/job.constants'; | ||||
| import { Column, Entity, PrimaryColumn } from 'typeorm'; | ||||
|  | ||||
| @Entity('system_config') | ||||
| export class SystemConfigEntity<T = SystemConfigValue> { | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { Logger } from '@nestjs/common'; | ||||
| import { IoAdapter } from '@nestjs/platform-socket.io'; | ||||
| import { createAdapter } from '@socket.io/redis-adapter'; | ||||
| import Redis from 'ioredis'; | ||||
| import { Logger } from '@nestjs/common'; | ||||
| import { ServerOptions } from 'socket.io'; | ||||
| import { redisConfig } from './infra.config'; | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import { ICryptoRepository } from '@app/domain'; | ||||
| import { Injectable } from '@nestjs/common'; | ||||
| import { compareSync, hash } from 'bcrypt'; | ||||
| import { randomBytes, createHash } from 'crypto'; | ||||
| import { createHash, randomBytes } from 'crypto'; | ||||
|  | ||||
| @Injectable() | ||||
| export class CryptoRepository implements ICryptoRepository { | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| import { CropOptions, IMediaRepository, ResizeOptions, TranscodeOptions, VideoInfo } from '@app/domain'; | ||||
| import ffmpeg, { FfprobeData } from 'fluent-ffmpeg'; | ||||
| import fs from 'fs/promises'; | ||||
| import sharp from 'sharp'; | ||||
| import { promisify } from 'util'; | ||||
| import fs from 'fs/promises'; | ||||
|  | ||||
| const probe = promisify<string, FfprobeData>(ffmpeg.ffprobe); | ||||
|  | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| import { IUserTokenRepository } from '@app/domain/user-token'; | ||||
| import { Injectable } from '@nestjs/common'; | ||||
| import { InjectRepository } from '@nestjs/typeorm'; | ||||
| import { Repository } from 'typeorm'; | ||||
| import { UserTokenEntity } from '../entities'; | ||||
| import { IUserTokenRepository } from '@app/domain/user-token'; | ||||
|  | ||||
| @Injectable() | ||||
| export class UserTokenRepository implements IUserTokenRepository { | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| import { bootstrap as cli } from './cli/immich'; | ||||
| import { bootstrap as immich } from './immich/main'; | ||||
| import { bootstrap as microservices } from './microservices/main'; | ||||
| import { bootstrap as cli } from './cli/immich'; | ||||
|  | ||||
| const immichApp = process.argv[2] || process.env.IMMICH_APP; | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import { describe, it, expect } from '@jest/globals'; | ||||
| import { describe, expect, it } from '@jest/globals'; | ||||
| import { parseLatitude, parseLongitude } from './coordinates'; | ||||
|  | ||||
| describe('parsing latitude from string input', () => { | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import { describe, it, expect } from '@jest/globals'; | ||||
| import { describe, expect, it } from '@jest/globals'; | ||||
| import { parseISO } from './iso'; | ||||
|  | ||||
| describe('parsing ISO values', () => { | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import { describe, it, expect } from '@jest/globals'; | ||||
| import { describe, expect, it } from '@jest/globals'; | ||||
| import { isDecimalNumber, isNumberInRange, toNumberOrNull } from './numbers'; | ||||
|  | ||||
| describe('checks if a number is a decimal number', () => { | ||||
|   | ||||
| @@ -1,3 +1,18 @@ | ||||
| import { | ||||
|   AlbumResponseDto, | ||||
|   AssetResponseDto, | ||||
|   AudioStreamInfo, | ||||
|   AuthUserDto, | ||||
|   ExifResponseDto, | ||||
|   mapUser, | ||||
|   QueueName, | ||||
|   SearchResult, | ||||
|   SharedLinkResponseDto, | ||||
|   TagResponseDto, | ||||
|   VideoFormat, | ||||
|   VideoInfo, | ||||
|   VideoStreamInfo, | ||||
| } from '@app/domain'; | ||||
| import { | ||||
|   AlbumEntity, | ||||
|   APIKeyEntity, | ||||
| @@ -16,21 +31,6 @@ import { | ||||
|   UserEntity, | ||||
|   UserTokenEntity, | ||||
| } from '@app/infra/entities'; | ||||
| import { | ||||
|   AlbumResponseDto, | ||||
|   AssetResponseDto, | ||||
|   AudioStreamInfo, | ||||
|   AuthUserDto, | ||||
|   ExifResponseDto, | ||||
|   mapUser, | ||||
|   QueueName, | ||||
|   SearchResult, | ||||
|   SharedLinkResponseDto, | ||||
|   TagResponseDto, | ||||
|   VideoFormat, | ||||
|   VideoInfo, | ||||
|   VideoStreamInfo, | ||||
| } from '@app/domain'; | ||||
|  | ||||
| const today = new Date(); | ||||
| const tomorrow = new Date(); | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| export * from './repositories'; | ||||
| export * from './fixtures'; | ||||
| export * from './repositories'; | ||||
|  | ||||
| export async function asyncTick(steps: number) { | ||||
|   for (let i = 0; i < steps; i++) { | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| import { AuthUserDto } from '@app/immich/decorators/auth-user.decorator'; | ||||
| import { AuthGuard } from '@app/immich/middlewares/auth.guard'; | ||||
| import { CanActivate, ExecutionContext } from '@nestjs/common'; | ||||
| import { TestingModuleBuilder } from '@nestjs/testing'; | ||||
| import { DataSource } from 'typeorm'; | ||||
| import { AuthUserDto } from '@app/immich/decorators/auth-user.decorator'; | ||||
| import { AuthGuard } from '@app/immich/middlewares/auth.guard'; | ||||
|  | ||||
| type CustomAuthCallback = () => AuthUserDto; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user