1
0
mirror of https://github.com/immich-app/immich.git synced 2024-11-24 08:52:28 +02:00

chore(server): organize imports (#2779)

* feat: lint rule for organize imports

* chore: organize imports
This commit is contained in:
Jason Rasmussen 2023-06-16 15:54:17 -04:00 committed by GitHub
parent 652add635f
commit bff6914a73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
67 changed files with 300 additions and 262 deletions

View File

@ -2,5 +2,6 @@
"singleQuote": true, "singleQuote": true,
"trailingComma": "all", "trailingComma": "all",
"printWidth": 120, "printWidth": 120,
"semi": true "semi": true,
"organizeImportsSkipDestructiveCodeActions": true
} }

View File

@ -1,13 +1,12 @@
import { Test, TestingModule } from '@nestjs/testing'; import { AlbumResponseDto, AuthService, CreateAlbumDto, SharedLinkResponseDto, UserService } from '@app/domain';
import { INestApplication } from '@nestjs/common';
import request from 'supertest';
import { clearDb, getAuthUser, authCustom } from '../test/test-utils';
import { CreateAlbumDto } from '@app/domain';
import { CreateAlbumShareLinkDto } from '@app/immich/api-v1/album/dto/create-album-shared-link.dto'; 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 { 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) { async function _createAlbum(app: INestApplication, data: CreateAlbumDto) {
const res = await request(app.getHttpServer()).post('/album').send(data); const res = await request(app.getHttpServer()).post('/album').send(data);

View File

@ -1,11 +1,10 @@
import { Test, TestingModule } from '@nestjs/testing'; import { AuthService, AuthUserDto, CreateUserDto, UserResponseDto, UserService } from '@app/domain';
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 { AppModule } from '@app/immich/app.module'; 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) { function _createUser(userService: UserService, data: CreateUserDto) {
return userService.createUser(data); return userService.createUser(data);

View File

@ -83,6 +83,7 @@
"jest": "^27.2.5", "jest": "^27.2.5",
"jest-when": "^3.5.2", "jest-when": "^3.5.2",
"prettier": "^2.3.2", "prettier": "^2.3.2",
"prettier-plugin-organize-imports": "^3.2.2",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"source-map-support": "^0.5.20", "source-map-support": "^0.5.20",
"supertest": "^6.1.3", "supertest": "^6.1.3",
@ -9374,6 +9375,26 @@
"node": ">=6.0.0" "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": { "node_modules/pretty-format": {
"version": "27.5.1", "version": "27.5.1",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz",
@ -19106,6 +19127,13 @@
"fast-diff": "^1.1.2" "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": { "pretty-format": {
"version": "27.5.1", "version": "27.5.1",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz",

View File

@ -109,6 +109,7 @@
"jest": "^27.2.5", "jest": "^27.2.5",
"jest-when": "^3.5.2", "jest-when": "^3.5.2",
"prettier": "^2.3.2", "prettier": "^2.3.2",
"prettier-plugin-organize-imports": "^3.2.2",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"source-map-support": "^0.5.20", "source-map-support": "^0.5.20",
"supertest": "^6.1.3", "supertest": "^6.1.3",

View File

@ -1,5 +1,4 @@
import { BadRequestException, ForbiddenException } from '@nestjs/common'; import { BadRequestException, ForbiddenException } from '@nestjs/common';
import _ from 'lodash';
import { import {
albumStub, albumStub,
authStub, authStub,
@ -9,6 +8,7 @@ import {
newUserRepositoryMock, newUserRepositoryMock,
userEntityStub, userEntityStub,
} from '@test'; } from '@test';
import _ from 'lodash';
import { IAssetRepository } from '../asset'; import { IAssetRepository } from '../asset';
import { IJobRepository, JobName } from '../job'; import { IJobRepository, JobName } from '../job';
import { IUserRepository } from '../user'; import { IUserRepository } from '../user';

View File

@ -1,5 +1,5 @@
import { ArrayNotEmpty } from 'class-validator';
import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator'; import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator';
import { ArrayNotEmpty } from 'class-validator';
export class AddUsersDto { export class AddUsersDto {
@ValidateUUID({ each: true }) @ValidateUUID({ each: true })

View File

@ -1,5 +1,5 @@
import { ApiProperty } from '@nestjs/swagger';
import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator'; import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator';
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsString } from 'class-validator'; import { IsNotEmpty, IsString } from 'class-validator';
export class CreateAlbumDto { export class CreateAlbumDto {

View File

@ -1,6 +1,6 @@
import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator';
import { ApiProperty } from '@nestjs/swagger'; import { ApiProperty } from '@nestjs/swagger';
import { IsOptional } from 'class-validator'; import { IsOptional } from 'class-validator';
import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator';
export class UpdateAlbumDto { export class UpdateAlbumDto {
@IsOptional() @IsOptional()

View File

@ -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 { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer'; import { Transform } from 'class-transformer';
import { IsBoolean, IsOptional } from 'class-validator'; 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 { export class GetAlbumsDto {
@IsOptional() @IsOptional()

View File

@ -1,7 +1,7 @@
import { toBoolean } from '@app/immich/utils/transform.util';
import { ApiProperty } from '@nestjs/swagger'; import { ApiProperty } from '@nestjs/swagger';
import { Transform, Type } from 'class-transformer'; import { Transform, Type } from 'class-transformer';
import { IsBoolean, IsDate, IsOptional } from 'class-validator'; import { IsBoolean, IsDate, IsOptional } from 'class-validator';
import { toBoolean } from '@app/immich/utils/transform.util';
export class MapMarkerDto { export class MapMarkerDto {
@ApiProperty() @ApiProperty()

View File

@ -1,8 +1,5 @@
import { SystemConfig, UserEntity } from '@app/infra/entities'; import { SystemConfig, UserEntity } from '@app/infra/entities';
import { BadRequestException, UnauthorizedException } from '@nestjs/common'; import { BadRequestException, UnauthorizedException } from '@nestjs/common';
import { IncomingHttpHeaders } from 'http';
import { generators, Issuer } from 'openid-client';
import { Socket } from 'socket.io';
import { import {
authStub, authStub,
keyStub, keyStub,
@ -18,6 +15,9 @@ import {
userEntityStub, userEntityStub,
userTokenEntityStub, userTokenEntityStub,
} from '@test'; } from '@test';
import { IncomingHttpHeaders } from 'http';
import { generators, Issuer } from 'openid-client';
import { Socket } from 'socket.io';
import { IKeyRepository } from '../api-key'; import { IKeyRepository } from '../api-key';
import { ICryptoRepository } from '../crypto/crypto.repository'; import { ICryptoRepository } from '../crypto/crypto.repository';
import { ISharedLinkRepository } from '../shared-link'; import { ISharedLinkRepository } from '../shared-link';

View File

@ -7,21 +7,27 @@ import {
Logger, Logger,
UnauthorizedException, UnauthorizedException,
} from '@nestjs/common'; } from '@nestjs/common';
import cookieParser from 'cookie';
import { IncomingHttpHeaders } from 'http'; 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 { OAuthCore } from '../oauth/oauth.core';
import { ISharedLinkRepository, SharedLinkCore } from '../shared-link';
import { INITIAL_SYSTEM_CONFIG, ISystemConfigRepository } from '../system-config'; import { INITIAL_SYSTEM_CONFIG, ISystemConfigRepository } from '../system-config';
import { IUserRepository, UserCore } from '../user'; import { IUserRepository, UserCore } from '../user';
import { IUserTokenRepository, UserTokenCore } from '../user-token';
import { AuthType, IMMICH_ACCESS_COOKIE, IMMICH_API_KEY_HEADER } from './auth.constant'; import { AuthType, IMMICH_ACCESS_COOKIE, IMMICH_API_KEY_HEADER } from './auth.constant';
import { AuthCore, LoginDetails } from './auth.core'; import { AuthCore, LoginDetails } from './auth.core';
import { ICryptoRepository } from '../crypto/crypto.repository';
import { AuthUserDto, ChangePasswordDto, LoginCredentialDto, SignUpDto } from './dto'; import { AuthUserDto, ChangePasswordDto, LoginCredentialDto, SignUpDto } from './dto';
import { AdminSignupResponseDto, LoginResponseDto, LogoutResponseDto, mapAdminSignupResponse } from './response-dto'; import {
import { IUserTokenRepository, UserTokenCore } from '../user-token'; AdminSignupResponseDto,
import cookieParser from 'cookie'; AuthDeviceResponseDto,
import { ISharedLinkRepository, SharedLinkCore } from '../shared-link'; LoginResponseDto,
import { APIKeyCore } from '../api-key/api-key.core'; LogoutResponseDto,
import { IKeyRepository } from '../api-key'; mapAdminSignupResponse,
import { AuthDeviceResponseDto, mapUserToken } from './response-dto'; mapUserToken,
} from './response-dto';
@Injectable() @Injectable()
export class AuthService { export class AuthService {

View File

@ -1,2 +1,2 @@
export * from './facial-recognition.services';
export * from './face.repository'; export * from './face.repository';
export * from './facial-recognition.services';

View File

@ -7,9 +7,9 @@ import {
newJobRepositoryMock, newJobRepositoryMock,
newSystemConfigRepositoryMock, newSystemConfigRepositoryMock,
} from '@test'; } from '@test';
import { IJobRepository, JobCommand, JobHandler, JobItem, JobName, JobService, QueueName } from '.';
import { IAssetRepository } from '../asset'; import { IAssetRepository } from '../asset';
import { ICommunicationRepository } from '../communication'; import { ICommunicationRepository } from '../communication';
import { IJobRepository, JobCommand, JobHandler, JobItem, JobName, JobService, QueueName } from '.';
import { ISystemConfigRepository } from '../system-config'; import { ISystemConfigRepository } from '../system-config';
import { SystemConfigCore } from '../system-config/system-config.core'; import { SystemConfigCore } from '../system-config/system-config.core';

View File

@ -1,5 +1,5 @@
import { constants } from 'fs/promises';
import { assetEntityStub, newAssetRepositoryMock, newJobRepositoryMock, newStorageRepositoryMock } from '@test'; import { assetEntityStub, newAssetRepositoryMock, newJobRepositoryMock, newStorageRepositoryMock } from '@test';
import { constants } from 'fs/promises';
import { IAssetRepository, WithoutProperty, WithProperty } from '../asset'; import { IAssetRepository, WithoutProperty, WithProperty } from '../asset';
import { IJobRepository, JobName } from '../job'; import { IJobRepository, JobName } from '../job';
import { IStorageRepository } from '../storage'; import { IStorageRepository } from '../storage';

View File

@ -1,6 +1,5 @@
import { SystemConfig, UserEntity } from '@app/infra/entities'; import { SystemConfig, UserEntity } from '@app/infra/entities';
import { BadRequestException } from '@nestjs/common'; import { BadRequestException } from '@nestjs/common';
import { generators, Issuer } from 'openid-client';
import { import {
authStub, authStub,
loginResponseStub, loginResponseStub,
@ -12,6 +11,7 @@ import {
userEntityStub, userEntityStub,
userTokenEntityStub, userTokenEntityStub,
} from '@test'; } from '@test';
import { generators, Issuer } from 'openid-client';
import { OAuthService } from '.'; import { OAuthService } from '.';
import { LoginDetails } from '../auth'; import { LoginDetails } from '../auth';
import { ICryptoRepository } from '../crypto'; import { ICryptoRepository } from '../crypto';

View File

@ -1,7 +1,7 @@
import { PartnerEntity } from '@app/infra/entities'; import { PartnerEntity } from '@app/infra/entities';
import { BadRequestException, Inject, Injectable } from '@nestjs/common'; import { BadRequestException, Inject, Injectable } from '@nestjs/common';
import { AuthUserDto } from '../auth';
import { IPartnerRepository, PartnerDirection, PartnerIds } from '.'; import { IPartnerRepository, PartnerDirection, PartnerIds } from '.';
import { AuthUserDto } from '../auth';
import { mapUser, UserResponseDto } from '../user'; import { mapUser, UserResponseDto } from '../user';
@Injectable() @Injectable()

View File

@ -1,5 +1,4 @@
import { BadRequestException, NotFoundException } from '@nestjs/common'; import { BadRequestException, NotFoundException } from '@nestjs/common';
import { IJobRepository, JobName } from '..';
import { import {
assetEntityStub, assetEntityStub,
authStub, authStub,
@ -8,6 +7,7 @@ import {
newStorageRepositoryMock, newStorageRepositoryMock,
personStub, personStub,
} from '@test'; } from '@test';
import { IJobRepository, JobName } from '..';
import { IStorageRepository } from '../storage'; import { IStorageRepository } from '../storage';
import { IPersonRepository } from './person.repository'; import { IPersonRepository } from './person.repository';
import { PersonService } from './person.service'; import { PersonService } from './person.service';

View File

@ -1,7 +1,7 @@
import { toBoolean } from '@app/immich/utils/transform.util';
import { AssetType } from '@app/infra/entities'; import { AssetType } from '@app/infra/entities';
import { Transform } from 'class-transformer'; import { Transform } from 'class-transformer';
import { IsArray, IsBoolean, IsEnum, IsNotEmpty, IsOptional, IsString } from 'class-validator'; import { IsArray, IsBoolean, IsEnum, IsNotEmpty, IsOptional, IsString } from 'class-validator';
import { toBoolean } from '@app/immich/utils/transform.util';
export class SearchDto { export class SearchDto {
@IsString() @IsString()

View File

@ -1,6 +1,5 @@
import { BadRequestException } from '@nestjs/common'; import { BadRequestException } from '@nestjs/common';
import { ConfigService } from '@nestjs/config'; import { ConfigService } from '@nestjs/config';
import { plainToInstance } from 'class-transformer';
import { import {
albumStub, albumStub,
assetEntityStub, assetEntityStub,
@ -15,6 +14,7 @@ import {
newSearchRepositoryMock, newSearchRepositoryMock,
searchStub, searchStub,
} from '@test'; } from '@test';
import { plainToInstance } from 'class-transformer';
import { IAlbumRepository } from '../album/album.repository'; import { IAlbumRepository } from '../album/album.repository';
import { IAssetRepository } from '../asset/asset.repository'; import { IAssetRepository } from '../asset/asset.repository';
import { IFaceRepository } from '../facial-recognition'; import { IFaceRepository } from '../facial-recognition';

View File

@ -1,5 +1,5 @@
import { ApiProperty } from '@nestjs/swagger';
import { IServerVersion } from '@app/domain'; import { IServerVersion } from '@app/domain';
import { ApiProperty } from '@nestjs/swagger';
export class ServerVersionReponseDto implements IServerVersion { export class ServerVersionReponseDto implements IServerVersion {
@ApiProperty({ type: 'integer' }) @ApiProperty({ type: 'integer' })

View File

@ -1,5 +1,5 @@
export * from './dto'; export * from './dto';
export * from './response-dto'; export * from './response-dto';
export * from './shared-link.core'; export * from './shared-link.core';
export * from './shared-link.service';
export * from './shared-link.repository'; export * from './shared-link.repository';
export * from './shared-link.service';

View File

@ -1,7 +1,7 @@
import { BadRequestException, ForbiddenException } from '@nestjs/common'; import { BadRequestException, ForbiddenException } from '@nestjs/common';
import { authStub, newSharedLinkRepositoryMock, sharedLinkResponseStub, sharedLinkStub } from '@test'; import { authStub, newSharedLinkRepositoryMock, sharedLinkResponseStub, sharedLinkStub } from '@test';
import { SharedLinkService } from './shared-link.service';
import { ISharedLinkRepository } from './shared-link.repository'; import { ISharedLinkRepository } from './shared-link.repository';
import { SharedLinkService } from './shared-link.service';
describe(SharedLinkService.name, () => { describe(SharedLinkService.name, () => {
let sut: SharedLinkService; let sut: SharedLinkService;

View File

@ -1,4 +1,3 @@
import { when } from 'jest-when';
import { import {
assetEntityStub, assetEntityStub,
newAssetRepositoryMock, newAssetRepositoryMock,
@ -8,8 +7,9 @@ import {
systemConfigStub, systemConfigStub,
userEntityStub, userEntityStub,
} from '@test'; } from '@test';
import { IAssetRepository } from '../asset'; import { when } from 'jest-when';
import { StorageTemplateService } from '.'; import { StorageTemplateService } from '.';
import { IAssetRepository } from '../asset';
import { IStorageRepository } from '../storage/storage.repository'; import { IStorageRepository } from '../storage/storage.repository';
import { ISystemConfigRepository } from '../system-config'; import { ISystemConfigRepository } from '../system-config';
import { IUserRepository } from '../user'; import { IUserRepository } from '../user';

View File

@ -1,7 +1,7 @@
import { IsEnum, IsString, IsInt, IsBoolean, Min, Max } from 'class-validator';
import { TranscodePreset } from '@app/infra/entities'; import { TranscodePreset } from '@app/infra/entities';
import { Type } from 'class-transformer';
import { ApiProperty } from '@nestjs/swagger'; import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsBoolean, IsEnum, IsInt, IsString, Max, Min } from 'class-validator';
export class SystemConfigFFmpegDto { export class SystemConfigFFmpegDto {
@IsInt() @IsInt()

View File

@ -1,8 +1,8 @@
import { SystemConfig } from '@app/infra/entities'; import { SystemConfig } from '@app/infra/entities';
import { Type } from 'class-transformer'; import { Type } from 'class-transformer';
import { IsObject, ValidateNested } from 'class-validator'; import { IsObject, ValidateNested } from 'class-validator';
import { SystemConfigJobDto } from './system-config-job.dto';
import { SystemConfigFFmpegDto } from './system-config-ffmpeg.dto'; import { SystemConfigFFmpegDto } from './system-config-ffmpeg.dto';
import { SystemConfigJobDto } from './system-config-job.dto';
import { SystemConfigOAuthDto } from './system-config-oauth.dto'; import { SystemConfigOAuthDto } from './system-config-oauth.dto';
import { SystemConfigPasswordLoginDto } from './system-config-password-login.dto'; import { SystemConfigPasswordLoginDto } from './system-config-password-login.dto';
import { SystemConfigStorageTemplateDto } from './system-config-storage-template.dto'; import { SystemConfigStorageTemplateDto } from './system-config-storage-template.dto';

View File

@ -1,4 +1,8 @@
import { Inject, Injectable } from '@nestjs/common';
import { ISystemConfigRepository } from '.'; 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 { import {
supportedDayTokens, supportedDayTokens,
supportedHourTokens, supportedHourTokens,
@ -8,10 +12,6 @@ import {
supportedSecondTokens, supportedSecondTokens,
supportedYearTokens, supportedYearTokens,
} from './system-config.constants'; } 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'; import { SystemConfigCore, SystemConfigValidator } from './system-config.core';
@Injectable() @Injectable()

View File

@ -1,7 +1,7 @@
import { TagType } from '@app/infra/entities'; import { TagType } from '@app/infra/entities';
import { BadRequestException } from '@nestjs/common'; import { BadRequestException } from '@nestjs/common';
import { when } from 'jest-when';
import { assetEntityStub, authStub, newTagRepositoryMock, tagResponseStub, tagStub } from '@test'; import { assetEntityStub, authStub, newTagRepositoryMock, tagResponseStub, tagStub } from '@test';
import { when } from 'jest-when';
import { AssetIdErrorReason } from '../asset'; import { AssetIdErrorReason } from '../asset';
import { ITagRepository } from './tag.repository'; import { ITagRepository } from './tag.repository';
import { TagService } from './tag.service'; import { TagService } from './tag.service';

View File

@ -1,2 +1,2 @@
export * from './user-token.repository';
export * from './user-token.core'; export * from './user-token.core';
export * from './user-token.repository';

View File

@ -1,6 +1,6 @@
import { toEmail, toSanitized } from '@app/immich/utils/transform.util';
import { Transform } from 'class-transformer'; import { Transform } from 'class-transformer';
import { IsEmail, IsNotEmpty, IsOptional, IsString } from 'class-validator'; import { IsEmail, IsNotEmpty, IsOptional, IsString } from 'class-validator';
import { toEmail, toSanitized } from '@app/immich/utils/transform.util';
export class CreateUserDto { export class CreateUserDto {
@IsEmail({ require_tld: false }) @IsEmail({ require_tld: false })

View File

@ -1,7 +1,7 @@
import { toEmail, toSanitized } from '@app/immich/utils/transform.util';
import { ApiProperty } from '@nestjs/swagger'; import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer'; import { Transform } from 'class-transformer';
import { IsBoolean, IsEmail, IsNotEmpty, IsOptional, IsString, IsUUID } from 'class-validator'; import { IsBoolean, IsEmail, IsNotEmpty, IsOptional, IsString, IsUUID } from 'class-validator';
import { toEmail, toSanitized } from '@app/immich/utils/transform.util';
export class UpdateUserDto { export class UpdateUserDto {
@IsOptional() @IsOptional()

View File

@ -1,6 +1,5 @@
import { UserEntity } from '@app/infra/entities'; import { UserEntity } from '@app/infra/entities';
import { BadRequestException, ForbiddenException, NotFoundException } from '@nestjs/common'; import { BadRequestException, ForbiddenException, NotFoundException } from '@nestjs/common';
import { when } from 'jest-when';
import { import {
newAlbumRepositoryMock, newAlbumRepositoryMock,
newAssetRepositoryMock, newAssetRepositoryMock,
@ -9,6 +8,7 @@ import {
newStorageRepositoryMock, newStorageRepositoryMock,
newUserRepositoryMock, newUserRepositoryMock,
} from '@test'; } from '@test';
import { when } from 'jest-when';
import { IAlbumRepository } from '../album'; import { IAlbumRepository } from '../album';
import { IAssetRepository } from '../asset'; import { IAssetRepository } from '../asset';
import { AuthUserDto } from '../auth'; import { AuthUserDto } from '../auth';

View File

@ -9,7 +9,6 @@ import { ICryptoRepository } from '../crypto/crypto.repository';
import { IEntityJob, IJobRepository, JobName } from '../job'; import { IEntityJob, IJobRepository, JobName } from '../job';
import { StorageCore, StorageFolder } from '../storage'; import { StorageCore, StorageFolder } from '../storage';
import { IStorageRepository } from '../storage/storage.repository'; import { IStorageRepository } from '../storage/storage.repository';
import { IUserRepository } from './user.repository';
import { CreateUserDto, UpdateUserDto, UserCountDto } from './dto'; import { CreateUserDto, UpdateUserDto, UserCountDto } from './dto';
import { import {
CreateProfileImageResponseDto, CreateProfileImageResponseDto,
@ -20,6 +19,7 @@ import {
UserResponseDto, UserResponseDto,
} from './response-dto'; } from './response-dto';
import { UserCore } from './user.core'; import { UserCore } from './user.core';
import { IUserRepository } from './user.repository';
@Injectable() @Injectable()
export class UserService { export class UserService {

View File

@ -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 { 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 { DownloadModule } from '../../modules/download/download.module';
import { AlbumRepository, IAlbumRepository } from './album-repository';
import { AlbumController } from './album.controller';
import { AlbumService } from './album.service';
@Module({ @Module({
imports: [TypeOrmModule.forFeature([AlbumEntity, AssetEntity]), DownloadModule], imports: [TypeOrmModule.forFeature([AlbumEntity, AssetEntity]), DownloadModule],

View File

@ -1,21 +1,22 @@
import { BadRequestException, Inject, Injectable, NotFoundException, ForbiddenException, Logger } from '@nestjs/common'; import {
import { AuthUserDto } from '../../decorators/auth-user.decorator'; AlbumResponseDto,
ICryptoRepository,
ISharedLinkRepository,
mapAlbum,
mapSharedLink,
SharedLinkCore,
SharedLinkResponseDto,
} from '@app/domain';
import { AlbumEntity, SharedLinkType } from '@app/infra/entities'; import { AlbumEntity, SharedLinkType } from '@app/infra/entities';
import { RemoveAssetsDto } from './dto/remove-assets.dto'; import { BadRequestException, ForbiddenException, Inject, Injectable, Logger, NotFoundException } from '@nestjs/common';
import { AlbumResponseDto, mapAlbum } from '@app/domain'; import { AuthUserDto } from '../../decorators/auth-user.decorator';
import { IAlbumRepository } from './album-repository';
import { AddAssetsResponseDto } from './response-dto/add-assets-response.dto';
import { AddAssetsDto } from './dto/add-assets.dto';
import { DownloadService } from '../../modules/download/download.service'; import { DownloadService } from '../../modules/download/download.service';
import { DownloadDto } from '../asset/dto/download-library.dto'; import { DownloadDto } from '../asset/dto/download-library.dto';
import { import { IAlbumRepository } from './album-repository';
SharedLinkCore, import { AddAssetsDto } from './dto/add-assets.dto';
ISharedLinkRepository,
mapSharedLink,
SharedLinkResponseDto,
ICryptoRepository,
} from '@app/domain';
import { CreateAlbumShareLinkDto } from './dto/create-album-shared-link.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() @Injectable()
export class AlbumService { export class AlbumService {

View File

@ -1,5 +1,5 @@
import { ApiProperty } from '@nestjs/swagger';
import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator'; import { ValidateUUID } from '@app/immich/decorators/validate-uuid.decorator';
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer'; import { Type } from 'class-transformer';
import { IsBoolean, IsDate, IsOptional, IsString } from 'class-validator'; import { IsBoolean, IsDate, IsOptional, IsString } from 'class-validator';

View File

@ -1,5 +1,5 @@
import { ApiProperty } from '@nestjs/swagger';
import { AlbumResponseDto } from '@app/domain'; import { AlbumResponseDto } from '@app/domain';
import { ApiProperty } from '@nestjs/swagger';
export class AddAssetsResponseDto { export class AddAssetsResponseDto {
@ApiProperty({ type: 'integer' }) @ApiProperty({ type: 'integer' })

View File

@ -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 { AssetEntity, AssetType, ExifEntity } from '@app/infra/entities';
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; 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 { 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 { 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 { export interface AssetCheck {
id: string; id: string;

View File

@ -1,62 +1,61 @@
import { AddAssetsDto } from '../album/dto/add-assets.dto'; import { AssetResponseDto, ImmichReadStream, SharedLinkResponseDto } from '@app/domain';
import { import {
Controller,
Post,
UseInterceptors,
Body, Body,
Controller,
Delete,
Get, Get,
Header,
Headers,
HttpCode,
Param, Param,
ValidationPipe, ParseFilePipe,
Patch,
Post,
Put,
Query, Query,
Response, Response,
Headers,
Delete,
HttpCode,
Header,
Put,
UploadedFiles,
Patch,
StreamableFile, StreamableFile,
ParseFilePipe, UploadedFiles,
UseInterceptors,
ValidationPipe,
} from '@nestjs/common'; } from '@nestjs/common';
import { Authenticated, SharedLinkRoute } from '../../decorators/authenticated.decorator';
import { AssetService } from './asset.service';
import { FileFieldsInterceptor } from '@nestjs/platform-express'; 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 { ApiBody, ApiConsumes, ApiHeader, ApiOkResponse, ApiTags } from '@nestjs/swagger';
import { CuratedObjectsResponseDto } from './response-dto/curated-objects-response.dto'; import { Response as Res } from 'express';
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 { handleDownload } from '../../app.utils'; 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) { function asStreamableFile({ stream, type, length }: ImmichReadStream) {
return new StreamableFile(stream, { type, length }); return new StreamableFile(stream, { type, length });

View File

@ -1,8 +1,8 @@
import { AuthUserDto, IJobRepository, JobName } from '@app/domain'; import { AuthUserDto, IJobRepository, JobName } from '@app/domain';
import { AssetEntity, AssetType, UserEntity } from '@app/infra/entities'; import { AssetEntity, AssetType, UserEntity } from '@app/infra/entities';
import { parse } from 'node:path';
import { IAssetRepository } from './asset-repository'; import { IAssetRepository } from './asset-repository';
import { CreateAssetDto, UploadFile } from './dto/create-asset.dto'; import { CreateAssetDto, UploadFile } from './dto/create-asset.dto';
import { parse } from 'node:path';
export class AssetCore { export class AssetCore {
constructor(private repository: IAssetRepository, private jobRepository: IJobRepository) {} constructor(private repository: IAssetRepository, private jobRepository: IJobRepository) {}

View File

@ -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 { 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 { DownloadModule } from '../../modules/download/download.module';
import { AssetRepository, IAssetRepository } from './asset-repository';
import { AssetController } from './asset.controller';
import { AssetService } from './asset.service';
@Module({ @Module({
imports: [ imports: [

View File

@ -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 { import {
IAccessRepository, IAccessRepository,
ICryptoRepository, ICryptoRepository,
@ -15,6 +6,8 @@ import {
IStorageRepository, IStorageRepository,
JobName, JobName,
} from '@app/domain'; } from '@app/domain';
import { AssetEntity, AssetType, ExifEntity } from '@app/infra/entities';
import { BadRequestException, ForbiddenException } from '@nestjs/common';
import { import {
assetEntityStub, assetEntityStub,
authStub, authStub,
@ -27,10 +20,17 @@ import {
sharedLinkResponseStub, sharedLinkResponseStub,
sharedLinkStub, sharedLinkStub,
} from '@test'; } from '@test';
import { CreateAssetsShareLinkDto } from './dto/create-asset-shared-link.dto';
import { BadRequestException, ForbiddenException } from '@nestjs/common';
import { when } from 'jest-when'; 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 { 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 _getCreateAssetDto = (): CreateAssetDto => {
const createAssetDto = new CreateAssetDto(); const createAssetDto = new CreateAssetDto();

View File

@ -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 { import {
BadRequestException, BadRequestException,
ForbiddenException, ForbiddenException,
@ -10,63 +26,49 @@ import {
StreamableFile, StreamableFile,
} from '@nestjs/common'; } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; 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 { Response as Res } from 'express';
import { promisify } from 'util'; import { constants, createReadStream, stat } from 'fs';
import { DeleteAssetDto } from './dto/delete-asset.dto';
import { SearchAssetDto } from './dto/search-asset.dto';
import fs from 'fs/promises'; import fs from 'fs/promises';
import { CheckDuplicateAssetDto } from './dto/check-duplicate-asset.dto'; import { QueryFailedError, Repository } from 'typeorm';
import { CuratedObjectsResponseDto } from './response-dto/curated-objects-response.dto'; import { promisify } from 'util';
import { import { AuthUserDto } from '../../decorators/auth-user.decorator';
AssetResponseDto, import { DownloadService } from '../../modules/download/download.service';
getLivePhotoMotionFilename, import { AddAssetsDto } from '../album/dto/add-assets.dto';
IAccessRepository, import { RemoveAssetsDto } from '../album/dto/remove-assets.dto';
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 { IAssetRepository } from './asset-repository'; 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 { 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 { import {
AssetCountByTimeBucketResponseDto, AssetCountByTimeBucketResponseDto,
mapAssetCountByTimeBucket, mapAssetCountByTimeBucket,
} from './response-dto/asset-count-by-time-group-response.dto'; } 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 { 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 { AssetFileUploadResponseDto } from './response-dto/asset-file-upload-response.dto';
import { ICryptoRepository, IJobRepository } from '@app/domain'; import { CheckDuplicateAssetResponseDto } from './response-dto/check-duplicate-asset-response.dto';
import { DownloadService } from '../../modules/download/download.service'; import { CheckExistingAssetsResponseDto } from './response-dto/check-existing-assets-response.dto';
import { DownloadDto } from './dto/download-library.dto'; import { CuratedLocationsResponseDto } from './response-dto/curated-locations-response.dto';
import { SharedLinkCore } from '@app/domain'; import { CuratedObjectsResponseDto } from './response-dto/curated-objects-response.dto';
import { ISharedLinkRepository } from '@app/domain'; import { DeleteAssetResponseDto, DeleteAssetStatusEnum } from './response-dto/delete-asset-response.dto';
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';
const fileInfo = promisify(stat); const fileInfo = promisify(stat);

View File

@ -1,4 +1,4 @@
import { ParseUUIDPipe, Injectable, ArgumentMetadata } from '@nestjs/common'; import { ArgumentMetadata, Injectable, ParseUUIDPipe } from '@nestjs/common';
@Injectable() @Injectable()
export class ParseMeUUIDPipe extends ParseUUIDPipe { export class ParseMeUUIDPipe extends ParseUUIDPipe {

View File

@ -1,6 +1,6 @@
import { SystemConfigService } from '@app/domain';
import { Controller, HttpCode, HttpStatus, Post } from '@nestjs/common'; import { Controller, HttpCode, HttpStatus, Post } from '@nestjs/common';
import { ApiExcludeEndpoint } from '@nestjs/swagger'; import { ApiExcludeEndpoint } from '@nestjs/swagger';
import { SystemConfigService } from '@app/domain';
@Controller() @Controller()
export class AppController { export class AppController {

View File

@ -1,11 +1,11 @@
import { AssetService, AuthUserDto, MapMarkerResponseDto, MemoryLaneDto } from '@app/domain'; import { AssetService, AuthUserDto, MapMarkerResponseDto, MemoryLaneDto } from '@app/domain';
import { MapMarkerDto } from '@app/domain/asset/dto/map-marker.dto'; 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 { Controller, Get, Query } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger'; import { ApiTags } from '@nestjs/swagger';
import { AuthUser } from '../decorators/auth-user.decorator'; import { AuthUser } from '../decorators/auth-user.decorator';
import { Authenticated } from '../decorators/authenticated.decorator'; import { Authenticated } from '../decorators/authenticated.decorator';
import { UseValidation } from '../decorators/use-validation.decorator'; import { UseValidation } from '../decorators/use-validation.decorator';
import { MemoryLaneResponseDto } from '@app/domain/asset/response-dto/memory-lane-response.dto';
@ApiTags('Asset') @ApiTags('Asset')
@Controller('asset') @Controller('asset')

View File

@ -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 { Body, Controller, Get, Param, Put } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger'; import { ApiTags } from '@nestjs/swagger';
import { Authenticated } from '../decorators/authenticated.decorator'; import { Authenticated } from '../decorators/authenticated.decorator';

View File

@ -1,7 +1,7 @@
import { PartnerDirection, PartnerService, UserResponseDto } from '@app/domain'; import { PartnerDirection, PartnerService, UserResponseDto } from '@app/domain';
import { Controller, Delete, Get, Param, Post, Query } from '@nestjs/common'; import { Controller, Delete, Get, Param, Post, Query } from '@nestjs/common';
import { ApiQuery, ApiTags } from '@nestjs/swagger'; 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 { Authenticated } from '../decorators/authenticated.decorator';
import { UseValidation } from '../decorators/use-validation.decorator'; import { UseValidation } from '../decorators/use-validation.decorator';
import { UUIDParamDto } from './dto/uuid-param.dto'; import { UUIDParamDto } from './dto/uuid-param.dto';

View File

@ -9,7 +9,7 @@ import {
} from '@app/domain'; } from '@app/domain';
import { Body, Controller, Delete, Get, Param, Patch, Post, Put } from '@nestjs/common'; import { Body, Controller, Delete, Get, Param, Patch, Post, Put } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger'; 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 { Authenticated } from '../decorators/authenticated.decorator';
import { UseValidation } from '../decorators/use-validation.decorator'; import { UseValidation } from '../decorators/use-validation.decorator';
import { UUIDParamDto } from './dto/uuid-param.dto'; import { UUIDParamDto } from './dto/uuid-param.dto';

View File

@ -1,34 +1,36 @@
import { import {
Controller, CreateProfileImageDto,
Get, CreateProfileImageResponseDto,
Post, CreateUserDto,
Delete, UpdateUserDto,
UserCountDto,
UserCountResponseDto,
UserResponseDto,
UserService,
} from '@app/domain';
import { UserIdDto } from '@app/domain/user/dto/user-id.dto';
import {
Body, Body,
Controller,
Delete,
Get,
Header,
Param, Param,
Post,
Put, Put,
Query, Query,
UseInterceptors,
UploadedFile,
Response, Response,
StreamableFile, StreamableFile,
Header, UploadedFile,
UseInterceptors,
} from '@nestjs/common'; } 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 { 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 { ApiBody, ApiConsumes, ApiTags } from '@nestjs/swagger';
import { UserResponseDto } from '@app/domain'; import { Response as Res } from 'express';
import { UserCountResponseDto } from '@app/domain'; import { profileImageUploadOption } from '../config/profile-image-upload.config';
import { CreateProfileImageDto } from '@app/domain'; import { AuthUser, AuthUserDto } from '../decorators/auth-user.decorator';
import { CreateProfileImageResponseDto } from '@app/domain'; import { AdminRoute, Authenticated, PublicRoute } from '../decorators/authenticated.decorator';
import { UserCountDto } from '@app/domain';
import { UseValidation } from '../decorators/use-validation.decorator'; import { UseValidation } from '../decorators/use-validation.decorator';
import { UserIdDto } from '@app/domain/user/dto/user-id.dto';
@ApiTags('User') @ApiTags('User')
@Controller('user') @Controller('user')

View File

@ -1,8 +1,8 @@
import { asHumanReadable, HumanReadableSize } from '@app/domain';
import { AssetEntity } from '@app/infra/entities'; import { AssetEntity } from '@app/infra/entities';
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';
import { asHumanReadable, HumanReadableSize } from '@app/domain';
export interface DownloadArchive { export interface DownloadArchive {
stream: StreamableFile; stream: StreamableFile;

View File

@ -1,7 +1,7 @@
import { AuthService } from '@app/domain';
import { Logger } from '@nestjs/common'; import { Logger } from '@nestjs/common';
import { OnGatewayConnection, OnGatewayDisconnect, WebSocketGateway, WebSocketServer } from '@nestjs/websockets'; import { OnGatewayConnection, OnGatewayDisconnect, WebSocketGateway, WebSocketServer } from '@nestjs/websockets';
import { Server, Socket } from 'socket.io'; import { Server, Socket } from 'socket.io';
import { AuthService } from '@app/domain';
@WebSocketGateway({ cors: true }) @WebSocketGateway({ cors: true })
export class CommunicationGateway implements OnGatewayConnection, OnGatewayDisconnect { export class CommunicationGateway implements OnGatewayConnection, OnGatewayDisconnect {

View File

@ -9,8 +9,8 @@ import {
PrimaryGeneratedColumn, PrimaryGeneratedColumn,
UpdateDateColumn, UpdateDateColumn,
} from 'typeorm'; } from 'typeorm';
import { SharedLinkEntity } from './shared-link.entity';
import { AssetEntity } from './asset.entity'; import { AssetEntity } from './asset.entity';
import { SharedLinkEntity } from './shared-link.entity';
import { UserEntity } from './user.entity'; import { UserEntity } from './user.entity';
@Entity('albums') @Entity('albums')

View File

@ -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'; import { UserEntity } from './user.entity';

View File

@ -1,5 +1,5 @@
import { Column, Entity, PrimaryColumn } from 'typeorm';
import { QueueName } from '@app/domain/job/job.constants'; import { QueueName } from '@app/domain/job/job.constants';
import { Column, Entity, PrimaryColumn } from 'typeorm';
@Entity('system_config') @Entity('system_config')
export class SystemConfigEntity<T = SystemConfigValue> { export class SystemConfigEntity<T = SystemConfigValue> {

View File

@ -1,7 +1,7 @@
import { Logger } from '@nestjs/common';
import { IoAdapter } from '@nestjs/platform-socket.io'; import { IoAdapter } from '@nestjs/platform-socket.io';
import { createAdapter } from '@socket.io/redis-adapter'; import { createAdapter } from '@socket.io/redis-adapter';
import Redis from 'ioredis'; import Redis from 'ioredis';
import { Logger } from '@nestjs/common';
import { ServerOptions } from 'socket.io'; import { ServerOptions } from 'socket.io';
import { redisConfig } from './infra.config'; import { redisConfig } from './infra.config';

View File

@ -1,7 +1,7 @@
import { ICryptoRepository } from '@app/domain'; import { ICryptoRepository } from '@app/domain';
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { compareSync, hash } from 'bcrypt'; import { compareSync, hash } from 'bcrypt';
import { randomBytes, createHash } from 'crypto'; import { createHash, randomBytes } from 'crypto';
@Injectable() @Injectable()
export class CryptoRepository implements ICryptoRepository { export class CryptoRepository implements ICryptoRepository {

View File

@ -1,8 +1,8 @@
import { CropOptions, IMediaRepository, ResizeOptions, TranscodeOptions, VideoInfo } from '@app/domain'; import { CropOptions, IMediaRepository, ResizeOptions, TranscodeOptions, VideoInfo } from '@app/domain';
import ffmpeg, { FfprobeData } from 'fluent-ffmpeg'; import ffmpeg, { FfprobeData } from 'fluent-ffmpeg';
import fs from 'fs/promises';
import sharp from 'sharp'; import sharp from 'sharp';
import { promisify } from 'util'; import { promisify } from 'util';
import fs from 'fs/promises';
const probe = promisify<string, FfprobeData>(ffmpeg.ffprobe); const probe = promisify<string, FfprobeData>(ffmpeg.ffprobe);

View File

@ -1,8 +1,8 @@
import { IUserTokenRepository } from '@app/domain/user-token';
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';
import { UserTokenEntity } from '../entities'; import { UserTokenEntity } from '../entities';
import { IUserTokenRepository } from '@app/domain/user-token';
@Injectable() @Injectable()
export class UserTokenRepository implements IUserTokenRepository { export class UserTokenRepository implements IUserTokenRepository {

View File

@ -1,6 +1,6 @@
import { bootstrap as cli } from './cli/immich';
import { bootstrap as immich } from './immich/main'; import { bootstrap as immich } from './immich/main';
import { bootstrap as microservices } from './microservices/main'; import { bootstrap as microservices } from './microservices/main';
import { bootstrap as cli } from './cli/immich';
const immichApp = process.argv[2] || process.env.IMMICH_APP; const immichApp = process.argv[2] || process.env.IMMICH_APP;

View File

@ -1,4 +1,4 @@
import { describe, it, expect } from '@jest/globals'; import { describe, expect, it } from '@jest/globals';
import { parseLatitude, parseLongitude } from './coordinates'; import { parseLatitude, parseLongitude } from './coordinates';
describe('parsing latitude from string input', () => { describe('parsing latitude from string input', () => {

View File

@ -1,4 +1,4 @@
import { describe, it, expect } from '@jest/globals'; import { describe, expect, it } from '@jest/globals';
import { parseISO } from './iso'; import { parseISO } from './iso';
describe('parsing ISO values', () => { describe('parsing ISO values', () => {

View File

@ -1,4 +1,4 @@
import { describe, it, expect } from '@jest/globals'; import { describe, expect, it } from '@jest/globals';
import { isDecimalNumber, isNumberInRange, toNumberOrNull } from './numbers'; import { isDecimalNumber, isNumberInRange, toNumberOrNull } from './numbers';
describe('checks if a number is a decimal number', () => { describe('checks if a number is a decimal number', () => {

View File

@ -1,3 +1,18 @@
import {
AlbumResponseDto,
AssetResponseDto,
AudioStreamInfo,
AuthUserDto,
ExifResponseDto,
mapUser,
QueueName,
SearchResult,
SharedLinkResponseDto,
TagResponseDto,
VideoFormat,
VideoInfo,
VideoStreamInfo,
} from '@app/domain';
import { import {
AlbumEntity, AlbumEntity,
APIKeyEntity, APIKeyEntity,
@ -16,21 +31,6 @@ import {
UserEntity, UserEntity,
UserTokenEntity, UserTokenEntity,
} from '@app/infra/entities'; } 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 today = new Date();
const tomorrow = new Date(); const tomorrow = new Date();

View File

@ -1,5 +1,5 @@
export * from './repositories';
export * from './fixtures'; export * from './fixtures';
export * from './repositories';
export async function asyncTick(steps: number) { export async function asyncTick(steps: number) {
for (let i = 0; i < steps; i++) { for (let i = 0; i < steps; i++) {

View File

@ -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 { CanActivate, ExecutionContext } from '@nestjs/common';
import { TestingModuleBuilder } from '@nestjs/testing'; import { TestingModuleBuilder } from '@nestjs/testing';
import { DataSource } from 'typeorm'; import { DataSource } from 'typeorm';
import { AuthUserDto } from '@app/immich/decorators/auth-user.decorator';
import { AuthGuard } from '@app/immich/middlewares/auth.guard';
type CustomAuthCallback = () => AuthUserDto; type CustomAuthCallback = () => AuthUserDto;