1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-04 02:46:47 +01:00

refactor: domain repositories (#4403)

This commit is contained in:
Jason Rasmussen 2023-10-09 10:25:03 -04:00 committed by GitHub
parent b56f22aac3
commit 2ea080cacd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
93 changed files with 313 additions and 227 deletions

View file

@ -1,6 +1,6 @@
import { BadRequestException, UnauthorizedException } from '@nestjs/common'; import { BadRequestException, UnauthorizedException } from '@nestjs/common';
import { AuthUserDto } from '../auth'; import { AuthUserDto } from '../auth';
import { IAccessRepository } from './access.repository'; import { IAccessRepository } from '../repositories';
export enum Permission { export enum Permission {
// ASSET_CREATE = 'asset.create', // ASSET_CREATE = 'asset.create',

View file

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

View file

@ -12,10 +12,9 @@ import {
userStub, userStub,
} from '@test'; } from '@test';
import _ from 'lodash'; import _ from 'lodash';
import { BulkIdErrorReason, IAssetRepository } from '../asset'; import { BulkIdErrorReason } from '../asset';
import { IJobRepository, JobName } from '../job'; import { JobName } from '../job';
import { IUserRepository } from '../user'; import { IAlbumRepository, IAssetRepository, IJobRepository, IUserRepository } from '../repositories';
import { IAlbumRepository } from './album.repository';
import { AlbumService } from './album.service'; import { AlbumService } from './album.service';
describe(AlbumService.name, () => { describe(AlbumService.name, () => {

View file

@ -1,10 +1,17 @@
import { AlbumEntity, AssetEntity, UserEntity } from '@app/infra/entities'; import { AlbumEntity, AssetEntity, UserEntity } from '@app/infra/entities';
import { BadRequestException, Inject, Injectable } from '@nestjs/common'; import { BadRequestException, Inject, Injectable } from '@nestjs/common';
import { AccessCore, IAccessRepository, Permission } from '../access'; import { AccessCore, Permission } from '../access';
import { BulkIdErrorReason, BulkIdResponseDto, BulkIdsDto, IAssetRepository } from '../asset'; import { BulkIdErrorReason, BulkIdResponseDto, BulkIdsDto } from '../asset';
import { AuthUserDto } from '../auth'; import { AuthUserDto } from '../auth';
import { IJobRepository, JobName } from '../job'; import { JobName } from '../job';
import { IUserRepository } from '../user'; import {
AlbumInfoOptions,
IAccessRepository,
IAlbumRepository,
IAssetRepository,
IJobRepository,
IUserRepository,
} from '../repositories';
import { import {
AlbumCountResponseDto, AlbumCountResponseDto,
AlbumResponseDto, AlbumResponseDto,
@ -12,7 +19,6 @@ import {
mapAlbumWithAssets, mapAlbumWithAssets,
mapAlbumWithoutAssets, mapAlbumWithoutAssets,
} from './album-response.dto'; } from './album-response.dto';
import { AlbumInfoOptions, IAlbumRepository } from './album.repository';
import { AddUsersDto, AlbumInfoDto, CreateAlbumDto, GetAlbumsDto, UpdateAlbumDto } from './dto'; import { AddUsersDto, AlbumInfoDto, CreateAlbumDto, GetAlbumsDto, UpdateAlbumDto } from './dto';
@Injectable() @Injectable()

View file

@ -1,4 +1,3 @@
export * from './album-response.dto'; export * from './album-response.dto';
export * from './album.repository';
export * from './album.service'; export * from './album.service';
export * from './dto'; export * from './dto';

View file

@ -1,7 +1,6 @@
import { BadRequestException } from '@nestjs/common'; import { BadRequestException } from '@nestjs/common';
import { authStub, keyStub, newCryptoRepositoryMock, newKeyRepositoryMock } from '@test'; import { authStub, keyStub, newCryptoRepositoryMock, newKeyRepositoryMock } from '@test';
import { ICryptoRepository } from '../crypto'; import { ICryptoRepository, IKeyRepository } from '../repositories';
import { IKeyRepository } from './api-key.repository';
import { APIKeyService } from './api-key.service'; import { APIKeyService } from './api-key.service';
describe(APIKeyService.name, () => { describe(APIKeyService.name, () => {

View file

@ -1,9 +1,8 @@
import { APIKeyEntity } from '@app/infra/entities'; import { APIKeyEntity } from '@app/infra/entities';
import { BadRequestException, Inject, Injectable } from '@nestjs/common'; import { BadRequestException, Inject, Injectable } from '@nestjs/common';
import { AuthUserDto } from '../auth'; import { AuthUserDto } from '../auth';
import { ICryptoRepository } from '../crypto'; import { ICryptoRepository, IKeyRepository } from '../repositories';
import { APIKeyCreateDto, APIKeyCreateResponseDto, APIKeyResponseDto } from './api-key.dto'; import { APIKeyCreateDto, APIKeyCreateResponseDto, APIKeyResponseDto } from './api-key.dto';
import { IKeyRepository } from './api-key.repository';
@Injectable() @Injectable()
export class APIKeyService { export class APIKeyService {

View file

@ -1,3 +1,2 @@
export * from './api-key.dto'; export * from './api-key.dto';
export * from './api-key.repository';
export * from './api-key.service'; export * from './api-key.service';

View file

@ -15,12 +15,18 @@ import {
} from '@test'; } from '@test';
import { when } from 'jest-when'; import { when } from 'jest-when';
import { Readable } from 'stream'; import { Readable } from 'stream';
import { ICommunicationRepository } from '../communication'; import { JobName } from '../job';
import { ICryptoRepository } from '../crypto'; import {
import { IJobRepository, JobItem, JobName } from '../job'; AssetStats,
import { IStorageRepository } from '../storage'; IAssetRepository,
import { ISystemConfigRepository } from '../system-config'; ICommunicationRepository,
import { AssetStats, IAssetRepository, TimeBucketSize } from './asset.repository'; ICryptoRepository,
IJobRepository,
IStorageRepository,
ISystemConfigRepository,
JobItem,
TimeBucketSize,
} from '../repositories';
import { AssetService, UploadFieldName } from './asset.service'; import { AssetService, UploadFieldName } from './asset.service';
import { AssetJobName, AssetStatsResponseDto, DownloadResponseDto } from './dto'; import { AssetJobName, AssetStatsResponseDto, DownloadResponseDto } from './dto';
import { mapAsset } from './response-dto'; import { mapAsset } from './response-dto';

View file

@ -4,16 +4,24 @@ import _ from 'lodash';
import { DateTime, Duration } from 'luxon'; import { DateTime, Duration } from 'luxon';
import { extname } from 'path'; import { extname } from 'path';
import sanitize from 'sanitize-filename'; import sanitize from 'sanitize-filename';
import { AccessCore, IAccessRepository, Permission } from '../access'; import { AccessCore, Permission } from '../access';
import { AuthUserDto } from '../auth'; import { AuthUserDto } from '../auth';
import { CommunicationEvent, ICommunicationRepository } from '../communication';
import { ICryptoRepository } from '../crypto';
import { mimeTypes } from '../domain.constant'; import { mimeTypes } from '../domain.constant';
import { HumanReadableSize, usePagination } from '../domain.util'; import { HumanReadableSize, usePagination } from '../domain.util';
import { IAssetDeletionJob, IJobRepository, JOBS_ASSET_PAGINATION_SIZE, JobName } from '../job'; import { IAssetDeletionJob, JOBS_ASSET_PAGINATION_SIZE, JobName } from '../job';
import { IStorageRepository, ImmichReadStream, StorageCore, StorageFolder } from '../storage'; import {
import { ISystemConfigRepository, SystemConfigCore } from '../system-config'; CommunicationEvent,
import { IAssetRepository } from './asset.repository'; IAccessRepository,
IAssetRepository,
ICommunicationRepository,
ICryptoRepository,
IJobRepository,
IStorageRepository,
ISystemConfigRepository,
ImmichReadStream,
} from '../repositories';
import { StorageCore, StorageFolder } from '../storage';
import { SystemConfigCore } from '../system-config';
import { import {
AssetBulkDeleteDto, AssetBulkDeleteDto,
AssetBulkUpdateDto, AssetBulkUpdateDto,

View file

@ -3,7 +3,7 @@ import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer'; import { Transform } from 'class-transformer';
import { IsBoolean } from 'class-validator'; import { IsBoolean } from 'class-validator';
import { Optional, toBoolean } from '../../domain.util'; import { Optional, toBoolean } from '../../domain.util';
import { AssetStats } from '../asset.repository'; import { AssetStats } from '../../repositories';
export class AssetStatsDto { export class AssetStatsDto {
@IsBoolean() @IsBoolean()

View file

@ -2,7 +2,7 @@ import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer'; import { Transform } from 'class-transformer';
import { IsBoolean, IsEnum, IsNotEmpty, IsString } from 'class-validator'; import { IsBoolean, IsEnum, IsNotEmpty, IsString } from 'class-validator';
import { Optional, ValidateUUID, toBoolean } from '../../domain.util'; import { Optional, ValidateUUID, toBoolean } from '../../domain.util';
import { TimeBucketSize } from '../asset.repository'; import { TimeBucketSize } from '../../repositories';
export class TimeBucketDto { export class TimeBucketDto {
@IsNotEmpty() @IsNotEmpty()

View file

@ -1,4 +1,3 @@
export * from './asset.repository';
export * from './asset.service'; export * from './asset.service';
export * from './dto'; export * from './dto';
export * from './response-dto'; export * from './response-dto';

View file

@ -1,6 +1,6 @@
import { DatabaseAction, EntityType } from '@app/infra/entities'; import { DatabaseAction, EntityType } from '@app/infra/entities';
import { IAccessRepositoryMock, auditStub, authStub, newAccessRepositoryMock, newAuditRepositoryMock } from '@test'; import { IAccessRepositoryMock, auditStub, authStub, newAccessRepositoryMock, newAuditRepositoryMock } from '@test';
import { IAuditRepository } from './audit.repository'; import { IAuditRepository } from '../repositories';
import { AuditService } from './audit.service'; import { AuditService } from './audit.service';
describe(AuditService.name, () => { describe(AuditService.name, () => {

View file

@ -1,11 +1,11 @@
import { DatabaseAction } from '@app/infra/entities'; import { DatabaseAction } from '@app/infra/entities';
import { Inject, Injectable } from '@nestjs/common'; import { Inject, Injectable } from '@nestjs/common';
import { DateTime } from 'luxon'; import { DateTime } from 'luxon';
import { AccessCore, IAccessRepository, Permission } from '../access'; import { AccessCore, Permission } from '../access';
import { AuthUserDto } from '../auth'; import { AuthUserDto } from '../auth';
import { AUDIT_LOG_MAX_DURATION } from '../domain.constant'; import { AUDIT_LOG_MAX_DURATION } from '../domain.constant';
import { IAccessRepository, IAuditRepository } from '../repositories';
import { AuditDeletesDto, AuditDeletesResponseDto } from './audit.dto'; import { AuditDeletesDto, AuditDeletesResponseDto } from './audit.dto';
import { IAuditRepository } from './audit.repository';
@Injectable() @Injectable()
export class AuditService { export class AuditService {

View file

@ -1,3 +1,2 @@
export * from './audit.dto'; export * from './audit.dto';
export * from './audit.repository';
export * from './audit.service'; export * from './audit.service';

View file

@ -19,16 +19,18 @@ import {
import { IncomingHttpHeaders } from 'http'; import { IncomingHttpHeaders } from 'http';
import { Issuer, generators } from 'openid-client'; import { Issuer, generators } from 'openid-client';
import { Socket } from 'socket.io'; import { Socket } from 'socket.io';
import { IKeyRepository } from '../api-key'; import {
import { ICryptoRepository } from '../crypto/crypto.repository'; ICryptoRepository,
import { ILibraryRepository } from '../library'; IKeyRepository,
import { ISharedLinkRepository } from '../shared-link'; ILibraryRepository,
import { ISystemConfigRepository } from '../system-config'; ISharedLinkRepository,
import { IUserRepository } from '../user'; ISystemConfigRepository,
IUserRepository,
IUserTokenRepository,
} from '../repositories';
import { AuthType } from './auth.constant'; import { AuthType } from './auth.constant';
import { AuthService } from './auth.service'; import { AuthService } from './auth.service';
import { AuthUserDto, SignUpDto } from './dto'; import { AuthUserDto, SignUpDto } from './dto';
import { IUserTokenRepository } from './user-token.repository';
// const token = Buffer.from('my-api-key', 'utf8').toString('base64'); // const token = Buffer.from('my-api-key', 'utf8').toString('base64');

View file

@ -11,13 +11,17 @@ import cookieParser from 'cookie';
import { IncomingHttpHeaders } from 'http'; import { IncomingHttpHeaders } from 'http';
import { DateTime } from 'luxon'; import { DateTime } from 'luxon';
import { ClientMetadata, Issuer, UserinfoResponse, custom, generators } from 'openid-client'; import { ClientMetadata, Issuer, UserinfoResponse, custom, generators } from 'openid-client';
import { IKeyRepository } from '../api-key'; import {
import { ICryptoRepository } from '../crypto/crypto.repository'; ICryptoRepository,
import { ILibraryRepository } from '../library'; IKeyRepository,
import { ISharedLinkRepository } from '../shared-link'; ILibraryRepository,
import { ISystemConfigRepository } from '../system-config'; ISharedLinkRepository,
ISystemConfigRepository,
IUserRepository,
IUserTokenRepository,
} from '../repositories';
import { SystemConfigCore } from '../system-config/system-config.core'; import { SystemConfigCore } from '../system-config/system-config.core';
import { IUserRepository, UserCore, UserResponseDto } from '../user'; import { UserCore, UserResponseDto } from '../user';
import { import {
AuthType, AuthType,
IMMICH_ACCESS_COOKIE, IMMICH_ACCESS_COOKIE,
@ -38,7 +42,6 @@ import {
mapLoginResponse, mapLoginResponse,
mapUserToken, mapUserToken,
} from './response-dto'; } from './response-dto';
import { IUserTokenRepository } from './user-token.repository';
export interface LoginDetails { export interface LoginDetails {
isSecure: boolean; isSecure: boolean;

View file

@ -2,4 +2,3 @@ export * from './auth.constant';
export * from './auth.service'; export * from './auth.service';
export * from './dto'; export * from './dto';
export * from './response-dto'; export * from './response-dto';
export * from './user-token.repository';

View file

@ -1 +0,0 @@
export * from './communication.repository';

View file

@ -1 +0,0 @@
export * from './crypto.repository';

View file

@ -4,8 +4,6 @@ export * from './api-key';
export * from './asset'; export * from './asset';
export * from './audit'; export * from './audit';
export * from './auth'; export * from './auth';
export * from './communication';
export * from './crypto';
export * from './domain.config'; export * from './domain.config';
export * from './domain.constant'; export * from './domain.constant';
export * from './domain.module'; export * from './domain.module';
@ -16,6 +14,7 @@ export * from './media';
export * from './metadata'; export * from './metadata';
export * from './partner'; export * from './partner';
export * from './person'; export * from './person';
export * from './repositories';
export * from './search'; export * from './search';
export * from './server-info'; export * from './server-info';
export * from './shared-link'; export * from './shared-link';

View file

@ -1,5 +1,4 @@
export * from './job.constants'; export * from './job.constants';
export * from './job.dto'; export * from './job.dto';
export * from './job.interface'; export * from './job.interface';
export * from './job.repository';
export * from './job.service'; export * from './job.service';

View file

@ -9,13 +9,17 @@ import {
newPersonRepositoryMock, newPersonRepositoryMock,
newSystemConfigRepositoryMock, newSystemConfigRepositoryMock,
} from '@test'; } from '@test';
import { IAssetRepository } from '../asset'; import {
import { ICommunicationRepository } from '../communication'; IAssetRepository,
import { IPersonRepository } from '../person'; ICommunicationRepository,
import { ISystemConfigRepository } from '../system-config'; IJobRepository,
IPersonRepository,
ISystemConfigRepository,
JobHandler,
JobItem,
} from '../repositories';
import { SystemConfigCore } from '../system-config/system-config.core'; import { SystemConfigCore } from '../system-config/system-config.core';
import { JobCommand, JobName, QueueName } from './job.constants'; import { JobCommand, JobName, QueueName } from './job.constants';
import { IJobRepository, JobHandler, JobItem } from './job.repository';
import { JobService } from './job.service'; import { JobService } from './job.service';
const makeMockHandlers = (success: boolean) => { const makeMockHandlers = (success: boolean) => {

View file

@ -1,13 +1,19 @@
import { AssetType } from '@app/infra/entities'; import { AssetType } from '@app/infra/entities';
import { BadRequestException, Inject, Injectable, Logger } from '@nestjs/common'; import { BadRequestException, Inject, Injectable, Logger } from '@nestjs/common';
import { IAssetRepository, mapAsset } from '../asset'; import { mapAsset } from '../asset';
import { CommunicationEvent, ICommunicationRepository } from '../communication'; import {
import { IPersonRepository } from '../person'; CommunicationEvent,
import { FeatureFlag, ISystemConfigRepository } from '../system-config'; IAssetRepository,
import { SystemConfigCore } from '../system-config/system-config.core'; ICommunicationRepository,
IJobRepository,
IPersonRepository,
ISystemConfigRepository,
JobHandler,
JobItem,
} from '../repositories';
import { FeatureFlag, SystemConfigCore } from '../system-config/system-config.core';
import { JobCommand, JobName, QueueName } from './job.constants'; import { JobCommand, JobName, QueueName } from './job.constants';
import { AllJobStatusResponseDto, JobCommandDto, JobStatusDto } from './job.dto'; import { AllJobStatusResponseDto, JobCommandDto, JobStatusDto } from './job.dto';
import { IJobRepository, JobHandler, JobItem } from './job.repository';
@Injectable() @Injectable()
export class JobService { export class JobService {

View file

@ -1,3 +1,2 @@
export * from './library.dto'; export * from './library.dto';
export * from './library.repository';
export * from './library.service'; export * from './library.service';

View file

@ -16,10 +16,15 @@ import {
userStub, userStub,
} from '@test'; } from '@test';
import { Stats } from 'fs'; import { Stats } from 'fs';
import { IJobRepository, ILibraryFileJob, ILibraryRefreshJob, IOfflineLibraryFileJob, JobName } from '../job'; import { ILibraryFileJob, ILibraryRefreshJob, IOfflineLibraryFileJob, JobName } from '../job';
import {
import { IAssetRepository, ICryptoRepository, IStorageRepository, IUserRepository } from '..'; IAssetRepository,
import { ILibraryRepository } from './library.repository'; ICryptoRepository,
IJobRepository,
ILibraryRepository,
IStorageRepository,
IUserRepository,
} from '../repositories';
import { LibraryService } from './library.service'; import { LibraryService } from './library.service';
describe(LibraryService.name, () => { describe(LibraryService.name, () => {

View file

@ -4,24 +4,29 @@ import { R_OK } from 'node:constants';
import { Stats } from 'node:fs'; import { Stats } from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import { basename, parse } from 'path'; import { basename, parse } from 'path';
import { AccessCore, IAccessRepository, Permission } from '../access'; import { AccessCore, Permission } from '../access';
import { IAssetRepository, WithProperty } from '../asset';
import { AuthUserDto } from '../auth'; import { AuthUserDto } from '../auth';
import { ICryptoRepository } from '../crypto';
import { mimeTypes } from '../domain.constant'; import { mimeTypes } from '../domain.constant';
import { usePagination } from '../domain.util'; import { usePagination } from '../domain.util';
import { import {
IBaseJob, IBaseJob,
IEntityJob, IEntityJob,
IJobRepository,
ILibraryFileJob, ILibraryFileJob,
ILibraryRefreshJob, ILibraryRefreshJob,
IOfflineLibraryFileJob, IOfflineLibraryFileJob,
JOBS_ASSET_PAGINATION_SIZE, JOBS_ASSET_PAGINATION_SIZE,
JobName, JobName,
} from '../job'; } from '../job';
import { IStorageRepository } from '../storage'; import {
import { IUserRepository } from '../user'; IAccessRepository,
IAssetRepository,
ICryptoRepository,
IJobRepository,
ILibraryRepository,
IStorageRepository,
IUserRepository,
WithProperty,
} from '../repositories';
import { import {
CreateLibraryDto, CreateLibraryDto,
LibraryResponseDto, LibraryResponseDto,
@ -30,7 +35,6 @@ import {
UpdateLibraryDto, UpdateLibraryDto,
mapLibrary, mapLibrary,
} from './library.dto'; } from './library.dto';
import { ILibraryRepository } from './library.repository';
@Injectable() @Injectable()
export class LibraryService { export class LibraryService {

View file

@ -1,3 +1,2 @@
export * from './media.constant'; export * from './media.constant';
export * from './media.repository';
export * from './media.service'; export * from './media.service';

View file

@ -20,12 +20,16 @@ import {
personStub, personStub,
probeStub, probeStub,
} from '@test'; } from '@test';
import { IAssetRepository, WithoutProperty } from '../asset'; import { JobName } from '../job';
import { IJobRepository, JobName } from '../job'; import {
import { IPersonRepository } from '../person'; IAssetRepository,
import { IStorageRepository } from '../storage'; IJobRepository,
import { ISystemConfigRepository } from '../system-config'; IMediaRepository,
import { IMediaRepository } from './media.repository'; IPersonRepository,
IStorageRepository,
ISystemConfigRepository,
WithoutProperty,
} from '../repositories';
import { MediaService } from './media.service'; import { MediaService } from './media.service';
describe(MediaService.name, () => { describe(MediaService.name, () => {

View file

@ -1,13 +1,22 @@
import { AssetEntity, AssetType, Colorspace, TranscodeHWAccel, TranscodePolicy, VideoCodec } from '@app/infra/entities'; import { AssetEntity, AssetType, Colorspace, TranscodeHWAccel, TranscodePolicy, VideoCodec } from '@app/infra/entities';
import { Inject, Injectable, Logger, UnsupportedMediaTypeException } from '@nestjs/common'; import { Inject, Injectable, Logger, UnsupportedMediaTypeException } from '@nestjs/common';
import { IAssetRepository, WithoutProperty } from '../asset';
import { usePagination } from '../domain.util'; import { usePagination } from '../domain.util';
import { IBaseJob, IEntityJob, IJobRepository, JOBS_ASSET_PAGINATION_SIZE, JobName, QueueName } from '../job'; import { IBaseJob, IEntityJob, JOBS_ASSET_PAGINATION_SIZE, JobName, QueueName } from '../job';
import { IPersonRepository } from '../person'; import {
import { IStorageRepository, StorageCore, StorageFolder } from '../storage'; AudioStreamInfo,
import { ISystemConfigRepository, SystemConfigFFmpegDto } from '../system-config'; IAssetRepository,
IJobRepository,
IMediaRepository,
IPersonRepository,
IStorageRepository,
ISystemConfigRepository,
VideoCodecHWConfig,
VideoStreamInfo,
WithoutProperty,
} from '../repositories';
import { StorageCore, StorageFolder } from '../storage';
import { SystemConfigFFmpegDto } from '../system-config';
import { SystemConfigCore } from '../system-config/system-config.core'; import { SystemConfigCore } from '../system-config/system-config.core';
import { AudioStreamInfo, IMediaRepository, VideoCodecHWConfig, VideoStreamInfo } from './media.repository';
import { H264Config, HEVCConfig, NVENCConfig, QSVConfig, ThumbnailConfig, VAAPIConfig, VP9Config } from './media.util'; import { H264Config, HEVCConfig, NVENCConfig, QSVConfig, ThumbnailConfig, VAAPIConfig, VP9Config } from './media.util';
@Injectable() @Injectable()

View file

@ -1,5 +1,4 @@
import { CQMode, ToneMapping, TranscodeHWAccel, VideoCodec } from '@app/infra/entities'; import { CQMode, ToneMapping, TranscodeHWAccel, VideoCodec } from '@app/infra/entities';
import { SystemConfigFFmpegDto } from '../system-config/dto';
import { import {
AudioStreamInfo, AudioStreamInfo,
BitrateDistribution, BitrateDistribution,
@ -7,7 +6,8 @@ import {
VideoCodecHWConfig, VideoCodecHWConfig,
VideoCodecSWConfig, VideoCodecSWConfig,
VideoStreamInfo, VideoStreamInfo,
} from './media.repository'; } from '../repositories';
import { SystemConfigFFmpegDto } from '../system-config/dto';
class BaseConfig implements VideoCodecSWConfig { class BaseConfig implements VideoCodecSWConfig {
presets = ['veryslow', 'slower', 'slow', 'medium', 'fast', 'faster', 'veryfast', 'superfast', 'ultrafast']; presets = ['veryslow', 'slower', 'slow', 'medium', 'fast', 'faster', 'veryfast', 'superfast', 'ultrafast'];
constructor(protected config: SystemConfigFFmpegDto) {} constructor(protected config: SystemConfigFFmpegDto) {}

View file

@ -1,2 +1 @@
export * from './metadata.repository';
export * from './metadata.service'; export * from './metadata.service';

View file

@ -12,13 +12,19 @@ import {
import { randomBytes } from 'crypto'; import { randomBytes } from 'crypto';
import { Stats } from 'fs'; import { Stats } from 'fs';
import { constants } from 'fs/promises'; import { constants } from 'fs/promises';
import { IAlbumRepository } from '../album'; import { JobName, QueueName } from '../job';
import { IAssetRepository, WithProperty, WithoutProperty } from '../asset'; import {
import { ICryptoRepository } from '../crypto'; IAlbumRepository,
import { IJobRepository, JobName, QueueName } from '../job'; IAssetRepository,
import { IStorageRepository } from '../storage'; ICryptoRepository,
import { ISystemConfigRepository } from '../system-config'; IJobRepository,
import { IMetadataRepository, ImmichTags } from './metadata.repository'; IMetadataRepository,
IStorageRepository,
ISystemConfigRepository,
ImmichTags,
WithProperty,
WithoutProperty,
} from '../repositories';
import { MetadataService } from './metadata.service'; import { MetadataService } from './metadata.service';
describe(MetadataService.name, () => { describe(MetadataService.name, () => {

View file

@ -4,14 +4,22 @@ import { ExifDateTime, Tags } from 'exiftool-vendored';
import { firstDateTime } from 'exiftool-vendored/dist/FirstDateTime'; import { firstDateTime } from 'exiftool-vendored/dist/FirstDateTime';
import { constants } from 'fs/promises'; import { constants } from 'fs/promises';
import { Duration } from 'luxon'; import { Duration } from 'luxon';
import { IAlbumRepository } from '../album';
import { IAssetRepository, WithProperty, WithoutProperty } from '../asset';
import { ICryptoRepository } from '../crypto';
import { usePagination } from '../domain.util'; import { usePagination } from '../domain.util';
import { IBaseJob, IEntityJob, IJobRepository, JOBS_ASSET_PAGINATION_SIZE, JobName, QueueName } from '../job'; import { IBaseJob, IEntityJob, JOBS_ASSET_PAGINATION_SIZE, JobName, QueueName } from '../job';
import { IStorageRepository, StorageCore, StorageFolder } from '../storage'; import {
import { FeatureFlag, ISystemConfigRepository, SystemConfigCore } from '../system-config'; IAlbumRepository,
import { IMetadataRepository, ImmichTags } from './metadata.repository'; IAssetRepository,
ICryptoRepository,
IJobRepository,
IMetadataRepository,
IStorageRepository,
ISystemConfigRepository,
ImmichTags,
WithProperty,
WithoutProperty,
} from '../repositories';
import { StorageCore, StorageFolder } from '../storage';
import { FeatureFlag, SystemConfigCore } from '../system-config';
interface DirectoryItem { interface DirectoryItem {
Length?: number; Length?: number;

View file

@ -1,2 +1 @@
export * from './partner.repository';
export * from './partner.service'; export * from './partner.service';

View file

@ -1,7 +1,7 @@
import { BadRequestException } from '@nestjs/common'; import { BadRequestException } from '@nestjs/common';
import { authStub, newPartnerRepositoryMock, partnerStub } from '@test'; import { authStub, newPartnerRepositoryMock, partnerStub } from '@test';
import { UserResponseDto } from '../index'; import { UserResponseDto } from '../index';
import { IPartnerRepository, PartnerDirection } from './partner.repository'; import { IPartnerRepository, PartnerDirection } from '../repositories';
import { PartnerService } from './partner.service'; import { PartnerService } from './partner.service';
const responseDto = { const responseDto = {

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 { IPartnerRepository, PartnerDirection, PartnerIds } from '.';
import { AuthUserDto } from '../auth'; import { AuthUserDto } from '../auth';
import { IPartnerRepository, PartnerDirection, PartnerIds } from '../repositories';
import { UserResponseDto, mapUser } from '../user'; import { UserResponseDto, mapUser } from '../user';
@Injectable() @Injectable()

View file

@ -1,3 +1,2 @@
export * from './person.dto'; export * from './person.dto';
export * from './person.repository';
export * from './person.service'; export * from './person.service';

View file

@ -16,15 +16,20 @@ import {
newSystemConfigRepositoryMock, newSystemConfigRepositoryMock,
personStub, personStub,
} from '@test'; } from '@test';
import { BulkIdErrorReason, IAssetRepository, WithoutProperty } from '../asset'; import { BulkIdErrorReason } from '../asset';
import { IJobRepository, JobName } from '../job'; import { JobName } from '../job';
import { IMediaRepository } from '../media'; import {
import { ISearchRepository } from '../search'; IAssetRepository,
import { IMachineLearningRepository } from '../smart-info'; IJobRepository,
import { IStorageRepository } from '../storage'; IMachineLearningRepository,
import { ISystemConfigRepository } from '../system-config'; IMediaRepository,
IPersonRepository,
ISearchRepository,
IStorageRepository,
ISystemConfigRepository,
WithoutProperty,
} from '../repositories';
import { PersonResponseDto } from './person.dto'; import { PersonResponseDto } from './person.dto';
import { IPersonRepository } from './person.repository';
import { PersonService } from './person.service'; import { PersonService } from './person.service';
const responseDto: PersonResponseDto = { const responseDto: PersonResponseDto = {

View file

@ -1,23 +1,30 @@
import { PersonEntity } from '@app/infra/entities'; import { PersonEntity } from '@app/infra/entities';
import { BadRequestException, Inject, Injectable, Logger, NotFoundException } from '@nestjs/common'; import { BadRequestException, Inject, Injectable, Logger, NotFoundException } from '@nestjs/common';
import { AccessCore, IAccessRepository, Permission } from '../access'; import { AccessCore, Permission } from '../access';
import { import { AssetResponseDto, BulkIdErrorReason, BulkIdResponseDto, mapAsset } from '../asset';
AssetResponseDto,
BulkIdErrorReason,
BulkIdResponseDto,
IAssetRepository,
WithoutProperty,
mapAsset,
} from '../asset';
import { AuthUserDto } from '../auth'; import { AuthUserDto } from '../auth';
import { mimeTypes } from '../domain.constant'; import { mimeTypes } from '../domain.constant';
import { usePagination } from '../domain.util'; import { usePagination } from '../domain.util';
import { IBaseJob, IEntityJob, IJobRepository, JOBS_ASSET_PAGINATION_SIZE, JobName } from '../job'; import { IBaseJob, IEntityJob, JOBS_ASSET_PAGINATION_SIZE, JobName } from '../job';
import { CropOptions, FACE_THUMBNAIL_SIZE, IMediaRepository } from '../media'; import { FACE_THUMBNAIL_SIZE } from '../media';
import { ISearchRepository } from '../search'; import {
import { IMachineLearningRepository } from '../smart-info'; AssetFaceId,
import { IStorageRepository, ImmichReadStream, StorageCore, StorageFolder } from '../storage'; CropOptions,
import { ISystemConfigRepository, SystemConfigCore } from '../system-config'; IAccessRepository,
IAssetRepository,
IJobRepository,
IMachineLearningRepository,
IMediaRepository,
IPersonRepository,
ISearchRepository,
IStorageRepository,
ISystemConfigRepository,
ImmichReadStream,
UpdateFacesData,
WithoutProperty,
} from '../repositories';
import { StorageCore, StorageFolder } from '../storage';
import { SystemConfigCore } from '../system-config';
import { import {
MergePersonDto, MergePersonDto,
PeopleResponseDto, PeopleResponseDto,
@ -27,7 +34,6 @@ import {
PersonUpdateDto, PersonUpdateDto,
mapPerson, mapPerson,
} from './person.dto'; } from './person.dto';
import { AssetFaceId, IPersonRepository, UpdateFacesData } from './person.repository';
@Injectable() @Injectable()
export class PersonService { export class PersonService {

View file

@ -0,0 +1,22 @@
export * from './access.repository';
export * from './album.repository';
export * from './api-key.repository';
export * from './asset.repository';
export * from './audit.repository';
export * from './communication.repository';
export * from './crypto.repository';
export * from './job.repository';
export * from './library.repository';
export * from './machine-learning.repository';
export * from './media.repository';
export * from './metadata.repository';
export * from './partner.repository';
export * from './person.repository';
export * from './search.repository';
export * from './shared-link.repository';
export * from './smart-info.repository';
export * from './storage.repository';
export * from './system-config.repository';
export * from './tag.repository';
export * from './user-token.repository';
export * from './user.repository';

View file

@ -1,4 +1,4 @@
import { JobName, QueueName } from './job.constants'; import { JobName, QueueName } from '../job/job.constants';
import { import {
IAssetDeletionJob, IAssetDeletionJob,
@ -10,7 +10,7 @@ import {
ILibraryFileJob, ILibraryFileJob,
ILibraryRefreshJob, ILibraryRefreshJob,
IOfflineLibraryFileJob, IOfflineLibraryFileJob,
} from './job.interface'; } from '../job/job.interface';
export interface JobCounts { export interface JobCounts {
active: number; active: number;

View file

@ -1,5 +1,5 @@
import { LibraryEntity, LibraryType } from '@app/infra/entities'; import { LibraryEntity, LibraryType } from '@app/infra/entities';
import { LibraryStatsResponseDto } from './library.dto'; import { LibraryStatsResponseDto } from '../library/library.dto';
export const ILibraryRepository = 'ILibraryRepository'; export const ILibraryRepository = 'ILibraryRepository';

View file

@ -1,4 +1,4 @@
import { ClassificationConfig, CLIPConfig, RecognitionConfig } from './dto'; import { ClassificationConfig, CLIPConfig, RecognitionConfig } from '../smart-info/dto';
export const IMachineLearningRepository = 'IMachineLearningRepository'; export const IMachineLearningRepository = 'IMachineLearningRepository';

View file

@ -1,4 +1,3 @@
export * from './dto'; export * from './dto';
export * from './response-dto'; export * from './response-dto';
export * from './search.repository';
export * from './search.service'; export * from './search.service';

View file

@ -15,16 +15,18 @@ import {
searchStub, searchStub,
} from '@test'; } from '@test';
import { plainToInstance } from 'class-transformer'; import { plainToInstance } from 'class-transformer';
import { IAlbumRepository } from '../album/album.repository';
import { mapAsset } from '../asset'; import { mapAsset } from '../asset';
import { IAssetRepository } from '../asset/asset.repository';
import { JobName } from '../job'; import { JobName } from '../job';
import { IJobRepository } from '../job/job.repository'; import {
import { IPersonRepository } from '../person/person.repository'; IAlbumRepository,
import { IMachineLearningRepository } from '../smart-info'; IAssetRepository,
import { ISystemConfigRepository } from '../system-config'; IJobRepository,
IMachineLearningRepository,
IPersonRepository,
ISearchRepository,
ISystemConfigRepository,
} from '../repositories';
import { SearchDto } from './dto'; import { SearchDto } from './dto';
import { ISearchRepository } from './search.repository';
import { SearchService } from './search.service'; import { SearchService } from './search.service';
jest.useFakeTimers(); jest.useFakeTimers();

View file

@ -1,25 +1,28 @@
import { AlbumEntity, AssetEntity, AssetFaceEntity } from '@app/infra/entities'; import { AlbumEntity, AssetEntity, AssetFaceEntity } from '@app/infra/entities';
import { Inject, Injectable, Logger } from '@nestjs/common'; import { Inject, Injectable, Logger } from '@nestjs/common';
import { mapAlbumWithAssets } from '../album'; import { mapAlbumWithAssets } from '../album';
import { IAlbumRepository } from '../album/album.repository';
import { AssetResponseDto, mapAsset } from '../asset'; import { AssetResponseDto, mapAsset } from '../asset';
import { IAssetRepository } from '../asset/asset.repository';
import { AuthUserDto } from '../auth'; import { AuthUserDto } from '../auth';
import { usePagination } from '../domain.util'; import { usePagination } from '../domain.util';
import { IAssetFaceJob, IBulkEntityJob, IJobRepository, JOBS_ASSET_PAGINATION_SIZE, JobName } from '../job'; import { IAssetFaceJob, IBulkEntityJob, JOBS_ASSET_PAGINATION_SIZE, JobName } from '../job';
import { AssetFaceId, IPersonRepository } from '../person';
import { IMachineLearningRepository } from '../smart-info';
import { FeatureFlag, ISystemConfigRepository, SystemConfigCore } from '../system-config';
import { SearchDto } from './dto';
import { SearchResponseDto } from './response-dto';
import { import {
AssetFaceId,
IAlbumRepository,
IAssetRepository,
IJobRepository,
IMachineLearningRepository,
IPersonRepository,
ISearchRepository, ISearchRepository,
ISystemConfigRepository,
OwnedFaceEntity, OwnedFaceEntity,
SearchCollection, SearchCollection,
SearchExploreItem, SearchExploreItem,
SearchResult, SearchResult,
SearchStrategy, SearchStrategy,
} from './search.repository'; } from '../repositories';
import { FeatureFlag, SystemConfigCore } from '../system-config';
import { SearchDto } from './dto';
import { SearchResponseDto } from './response-dto';
interface SyncQueue { interface SyncQueue {
upsert: Set<string>; upsert: Set<string>;

View file

@ -1,8 +1,6 @@
import { newStorageRepositoryMock, newSystemConfigRepositoryMock, newUserRepositoryMock } from '@test'; import { newStorageRepositoryMock, newSystemConfigRepositoryMock, newUserRepositoryMock } from '@test';
import { serverVersion } from '../domain.constant'; import { serverVersion } from '../domain.constant';
import { ISystemConfigRepository } from '../index'; import { IStorageRepository, ISystemConfigRepository, IUserRepository } from '../repositories';
import { IStorageRepository } from '../storage';
import { IUserRepository } from '../user';
import { ServerInfoService } from './server-info.service'; import { ServerInfoService } from './server-info.service';
describe(ServerInfoService.name, () => { describe(ServerInfoService.name, () => {

View file

@ -1,9 +1,9 @@
import { Inject, Injectable } from '@nestjs/common'; import { Inject, Injectable } from '@nestjs/common';
import { mimeTypes, serverVersion } from '../domain.constant'; import { mimeTypes, serverVersion } from '../domain.constant';
import { asHumanReadable } from '../domain.util'; import { asHumanReadable } from '../domain.util';
import { IStorageRepository, StorageCore, StorageFolder } from '../storage'; import { IStorageRepository, ISystemConfigRepository, IUserRepository, UserStatsQueryResponse } from '../repositories';
import { ISystemConfigRepository, SystemConfigCore } from '../system-config'; import { StorageCore, StorageFolder } from '../storage';
import { IUserRepository, UserStatsQueryResponse } from '../user'; import { SystemConfigCore } from '../system-config';
import { import {
ServerConfigDto, ServerConfigDto,
ServerFeaturesDto, ServerFeaturesDto,

View file

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

View file

@ -1,3 +1,4 @@
import { SharedLinkType } from '@app/infra/entities';
import { BadRequestException, ForbiddenException } from '@nestjs/common'; import { BadRequestException, ForbiddenException } from '@nestjs/common';
import { import {
IAccessRepositoryMock, IAccessRepositoryMock,
@ -12,9 +13,8 @@ import {
} from '@test'; } from '@test';
import { when } from 'jest-when'; import { when } from 'jest-when';
import _ from 'lodash'; import _ from 'lodash';
import { SharedLinkType } from '../../infra/entities/shared-link.entity'; import { AssetIdErrorReason } from '../asset';
import { AssetIdErrorReason, ICryptoRepository } from '../index'; import { ICryptoRepository, ISharedLinkRepository } from '../repositories';
import { ISharedLinkRepository } from './shared-link.repository';
import { SharedLinkService } from './shared-link.service'; import { SharedLinkService } from './shared-link.service';
describe(SharedLinkService.name, () => { describe(SharedLinkService.name, () => {

View file

@ -1,12 +1,11 @@
import { AssetEntity, SharedLinkEntity, SharedLinkType } from '@app/infra/entities'; import { AssetEntity, SharedLinkEntity, SharedLinkType } from '@app/infra/entities';
import { BadRequestException, ForbiddenException, Inject, Injectable } from '@nestjs/common'; import { BadRequestException, ForbiddenException, Inject, Injectable } from '@nestjs/common';
import { AccessCore, IAccessRepository, Permission } from '../access'; import { AccessCore, Permission } from '../access';
import { AssetIdErrorReason, AssetIdsDto, AssetIdsResponseDto } from '../asset'; import { AssetIdErrorReason, AssetIdsDto, AssetIdsResponseDto } from '../asset';
import { AuthUserDto } from '../auth'; import { AuthUserDto } from '../auth';
import { ICryptoRepository } from '../crypto'; import { IAccessRepository, ICryptoRepository, ISharedLinkRepository } from '../repositories';
import { SharedLinkResponseDto, mapSharedLink, mapSharedLinkWithNoExif } from './shared-link-response.dto'; import { SharedLinkResponseDto, mapSharedLink, mapSharedLinkWithNoExif } from './shared-link-response.dto';
import { SharedLinkCreateDto, SharedLinkEditDto } from './shared-link.dto'; import { SharedLinkCreateDto, SharedLinkEditDto } from './shared-link.dto';
import { ISharedLinkRepository } from './shared-link.repository';
@Injectable() @Injectable()
export class SharedLinkService { export class SharedLinkService {

View file

@ -2,7 +2,7 @@ import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer'; import { Type } from 'class-transformer';
import { IsBoolean, IsEnum, IsNotEmpty, IsNumber, IsString, Max, Min } from 'class-validator'; import { IsBoolean, IsEnum, IsNotEmpty, IsNumber, IsString, Max, Min } from 'class-validator';
import { Optional } from '../../domain.util'; import { Optional } from '../../domain.util';
import { CLIPMode, ModelType } from '../machine-learning.interface'; import { CLIPMode, ModelType } from '../../repositories';
export class ModelConfig { export class ModelConfig {
@IsBoolean() @IsBoolean()

View file

@ -1,4 +1,2 @@
export * from './dto'; export * from './dto';
export * from './machine-learning.interface';
export * from './smart-info.repository';
export * from './smart-info.service'; export * from './smart-info.service';

View file

@ -7,11 +7,15 @@ import {
newSmartInfoRepositoryMock, newSmartInfoRepositoryMock,
newSystemConfigRepositoryMock, newSystemConfigRepositoryMock,
} from '@test'; } from '@test';
import { IAssetRepository, WithoutProperty } from '../asset'; import { JobName } from '../job';
import { IJobRepository, JobName } from '../job'; import {
import { ISystemConfigRepository } from '../system-config'; IAssetRepository,
import { IMachineLearningRepository } from './machine-learning.interface'; IJobRepository,
import { ISmartInfoRepository } from './smart-info.repository'; IMachineLearningRepository,
ISmartInfoRepository,
ISystemConfigRepository,
WithoutProperty,
} from '../repositories';
import { SmartInfoService } from './smart-info.service'; import { SmartInfoService } from './smart-info.service';
const asset = { const asset = {

View file

@ -1,10 +1,15 @@
import { Inject, Injectable } from '@nestjs/common'; import { Inject, Injectable } from '@nestjs/common';
import { IAssetRepository, WithoutProperty } from '../asset';
import { usePagination } from '../domain.util'; import { usePagination } from '../domain.util';
import { IBaseJob, IEntityJob, IJobRepository, JOBS_ASSET_PAGINATION_SIZE, JobName } from '../job'; import { IBaseJob, IEntityJob, JOBS_ASSET_PAGINATION_SIZE, JobName } from '../job';
import { ISystemConfigRepository, SystemConfigCore } from '../system-config'; import {
import { IMachineLearningRepository } from './machine-learning.interface'; IAssetRepository,
import { ISmartInfoRepository } from './smart-info.repository'; IJobRepository,
IMachineLearningRepository,
ISmartInfoRepository,
ISystemConfigRepository,
WithoutProperty,
} from '../repositories';
import { SystemConfigCore } from '../system-config';
@Injectable() @Injectable()
export class SmartInfoService { export class SmartInfoService {

View file

@ -7,12 +7,9 @@ import {
userStub, userStub,
} from '@test'; } from '@test';
import { when } from 'jest-when'; import { when } from 'jest-when';
import { StorageTemplateService } from '.'; import { IAssetRepository, IStorageRepository, ISystemConfigRepository, IUserRepository } from '../repositories';
import { IAssetRepository } from '../asset';
import { IStorageRepository } from '../storage/storage.repository';
import { ISystemConfigRepository } from '../system-config';
import { defaults } from '../system-config/system-config.core'; import { defaults } from '../system-config/system-config.core';
import { IUserRepository } from '../user'; import { StorageTemplateService } from './storage-template.service';
describe(StorageTemplateService.name, () => { describe(StorageTemplateService.name, () => {
let sut: StorageTemplateService; let sut: StorageTemplateService;

View file

@ -4,13 +4,12 @@ import handlebar from 'handlebars';
import * as luxon from 'luxon'; import * as luxon from 'luxon';
import path from 'node:path'; import path from 'node:path';
import sanitize from 'sanitize-filename'; import sanitize from 'sanitize-filename';
import { IAssetRepository } from '../asset/asset.repository';
import { getLivePhotoMotionFilename, usePagination } from '../domain.util'; import { getLivePhotoMotionFilename, usePagination } from '../domain.util';
import { IEntityJob, JOBS_ASSET_PAGINATION_SIZE } from '../job'; import { IEntityJob, JOBS_ASSET_PAGINATION_SIZE } from '../job';
import { IStorageRepository, StorageCore, StorageFolder } from '../storage'; import { IAssetRepository, IStorageRepository, ISystemConfigRepository, IUserRepository } from '../repositories';
import { StorageCore, StorageFolder } from '../storage';
import { import {
INITIAL_SYSTEM_CONFIG, INITIAL_SYSTEM_CONFIG,
ISystemConfigRepository,
supportedDayTokens, supportedDayTokens,
supportedHourTokens, supportedHourTokens,
supportedMinuteTokens, supportedMinuteTokens,
@ -20,7 +19,6 @@ import {
supportedYearTokens, supportedYearTokens,
} from '../system-config'; } from '../system-config';
import { SystemConfigCore } from '../system-config/system-config.core'; import { SystemConfigCore } from '../system-config/system-config.core';
import { IUserRepository } from '../user/user.repository';
export interface MoveAssetMetadata { export interface MoveAssetMetadata {
storageLabel: string | null; storageLabel: string | null;

View file

@ -1,3 +1,2 @@
export * from './storage.core'; export * from './storage.core';
export * from './storage.repository';
export * from './storage.service'; export * from './storage.service';

View file

@ -1,6 +1,6 @@
import { join } from 'node:path'; import { join } from 'node:path';
import { APP_MEDIA_LOCATION } from '../domain.constant'; import { APP_MEDIA_LOCATION } from '../domain.constant';
import { IStorageRepository } from './storage.repository'; import { IStorageRepository } from '../repositories';
export enum StorageFolder { export enum StorageFolder {
ENCODED_VIDEO = 'encoded-video', ENCODED_VIDEO = 'encoded-video',

View file

@ -1,5 +1,5 @@
import { newStorageRepositoryMock } from '@test'; import { newStorageRepositoryMock } from '@test';
import { IStorageRepository } from '.'; import { IStorageRepository } from '../repositories';
import { StorageService } from './storage.service'; import { StorageService } from './storage.service';
describe(StorageService.name, () => { describe(StorageService.name, () => {

View file

@ -1,7 +1,7 @@
import { Inject, Injectable, Logger } from '@nestjs/common'; import { Inject, Injectable, Logger } from '@nestjs/common';
import { IDeleteFilesJob } from '../job'; import { IDeleteFilesJob } from '../job';
import { IStorageRepository } from '../repositories';
import { StorageCore, StorageFolder } from './storage.core'; import { StorageCore, StorageFolder } from './storage.core';
import { IStorageRepository } from './storage.repository';
@Injectable() @Injectable()
export class StorageService { export class StorageService {

View file

@ -2,5 +2,4 @@ export * from './dto';
export * from './response-dto'; export * from './response-dto';
export * from './system-config.constants'; export * from './system-config.constants';
export * from './system-config.core'; export * from './system-config.core';
export * from './system-config.repository';
export * from './system-config.service'; export * from './system-config.service';

View file

@ -19,8 +19,8 @@ import * as _ from 'lodash';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { DeepPartial } from 'typeorm'; import { DeepPartial } from 'typeorm';
import { QueueName } from '../job/job.constants'; import { QueueName } from '../job/job.constants';
import { ISystemConfigRepository } from '../repositories';
import { SystemConfigDto } from './dto'; import { SystemConfigDto } from './dto';
import { ISystemConfigRepository } from './system-config.repository';
export type SystemConfigValidator = (config: SystemConfig) => void | Promise<void>; export type SystemConfigValidator = (config: SystemConfig) => void | Promise<void>;

View file

@ -13,10 +13,9 @@ import {
} from '@app/infra/entities'; } from '@app/infra/entities';
import { BadRequestException } from '@nestjs/common'; import { BadRequestException } from '@nestjs/common';
import { newCommunicationRepositoryMock, newJobRepositoryMock, newSystemConfigRepositoryMock } from '@test'; import { newCommunicationRepositoryMock, newJobRepositoryMock, newSystemConfigRepositoryMock } from '@test';
import { ICommunicationRepository } from '../communication'; import { JobName, QueueName } from '../job';
import { IJobRepository, JobName, QueueName } from '../job'; import { ICommunicationRepository, IJobRepository, ISystemConfigRepository } from '../repositories';
import { SystemConfigValidator, defaults } from './system-config.core'; import { SystemConfigValidator, defaults } from './system-config.core';
import { ISystemConfigRepository } from './system-config.repository';
import { SystemConfigService } from './system-config.service'; import { SystemConfigService } from './system-config.service';
const updates: SystemConfigEntity[] = [ const updates: SystemConfigEntity[] = [

View file

@ -1,7 +1,6 @@
import { Inject, Injectable } from '@nestjs/common'; import { Inject, Injectable } from '@nestjs/common';
import { ISystemConfigRepository } from '.'; import { JobName } from '../job';
import { CommunicationEvent, ICommunicationRepository } from '../communication'; import { CommunicationEvent, ICommunicationRepository, IJobRepository, ISystemConfigRepository } from '../repositories';
import { IJobRepository, JobName } from '../job';
import { SystemConfigDto, mapConfig } from './dto/system-config.dto'; import { SystemConfigDto, mapConfig } from './dto/system-config.dto';
import { SystemConfigTemplateStorageOptionDto } from './response-dto/system-config-template-storage-option.dto'; import { SystemConfigTemplateStorageOptionDto } from './response-dto/system-config-template-storage-option.dto';
import { import {

View file

@ -1,4 +1,3 @@
export * from './tag-response.dto'; export * from './tag-response.dto';
export * from './tag.dto'; export * from './tag.dto';
export * from './tag.repository';
export * from './tag.service'; export * from './tag.service';

View file

@ -3,7 +3,7 @@ import { BadRequestException } from '@nestjs/common';
import { assetStub, authStub, newTagRepositoryMock, tagResponseStub, tagStub } from '@test'; import { assetStub, authStub, newTagRepositoryMock, tagResponseStub, tagStub } from '@test';
import { when } from 'jest-when'; import { when } from 'jest-when';
import { AssetIdErrorReason } from '../asset'; import { AssetIdErrorReason } from '../asset';
import { ITagRepository } from './tag.repository'; import { ITagRepository } from '../repositories';
import { TagService } from './tag.service'; import { TagService } from './tag.service';
describe(TagService.name, () => { describe(TagService.name, () => {

View file

@ -1,9 +1,9 @@
import { BadRequestException, Inject, Injectable } from '@nestjs/common'; import { BadRequestException, Inject, Injectable } from '@nestjs/common';
import { AssetIdErrorReason, AssetIdsDto, AssetIdsResponseDto, AssetResponseDto, mapAsset } from '../asset'; import { AssetIdErrorReason, AssetIdsDto, AssetIdsResponseDto, AssetResponseDto, mapAsset } from '../asset';
import { AuthUserDto } from '../auth'; import { AuthUserDto } from '../auth';
import { ITagRepository } from '../repositories';
import { TagResponseDto, mapTag } from './tag-response.dto'; import { TagResponseDto, mapTag } from './tag-response.dto';
import { CreateTagDto, UpdateTagDto } from './tag.dto'; import { CreateTagDto, UpdateTagDto } from './tag.dto';
import { ITagRepository } from './tag.repository';
@Injectable() @Injectable()
export class TagService { export class TagService {

View file

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

View file

@ -11,9 +11,7 @@ import fs from 'fs/promises';
import path from 'path'; import path from 'path';
import sanitize from 'sanitize-filename'; import sanitize from 'sanitize-filename';
import { AuthUserDto } from '../auth'; import { AuthUserDto } from '../auth';
import { ICryptoRepository } from '../crypto'; import { ICryptoRepository, ILibraryRepository, IUserRepository, UserListFilter } from '../repositories';
import { ILibraryRepository } from '../library/library.repository';
import { IUserRepository, UserListFilter } from './user.repository';
const SALT_ROUNDS = 10; const SALT_ROUNDS = 10;

View file

@ -16,16 +16,19 @@ import {
userStub, userStub,
} from '@test'; } from '@test';
import { when } from 'jest-when'; import { when } from 'jest-when';
import { IAlbumRepository } from '../album';
import { IAssetRepository } from '../asset';
import { AuthUserDto } from '../auth'; import { AuthUserDto } from '../auth';
import { ICryptoRepository } from '../crypto'; import { JobName } from '../job';
import { IJobRepository, JobName } from '../job'; import {
import { ILibraryRepository } from '../library'; IAlbumRepository,
import { IStorageRepository } from '../storage'; IAssetRepository,
ICryptoRepository,
IJobRepository,
ILibraryRepository,
IStorageRepository,
IUserRepository,
} from '../repositories';
import { UpdateUserDto } from './dto/update-user.dto'; import { UpdateUserDto } from './dto/update-user.dto';
import { UserResponseDto, mapUser } from './response-dto'; import { UserResponseDto, mapUser } from './response-dto';
import { IUserRepository } from './user.repository';
import { UserService } from './user.service'; import { UserService } from './user.service';
const makeDeletedAt = (daysAgo: number) => { const makeDeletedAt = (daysAgo: number) => {

View file

@ -2,14 +2,18 @@ import { UserEntity } from '@app/infra/entities';
import { BadRequestException, Inject, Injectable, Logger, NotFoundException } from '@nestjs/common'; import { BadRequestException, Inject, Injectable, Logger, NotFoundException } from '@nestjs/common';
import { randomBytes } from 'crypto'; import { randomBytes } from 'crypto';
import { ReadStream } from 'fs'; import { ReadStream } from 'fs';
import { IAlbumRepository } from '../album/album.repository';
import { IAssetRepository } from '../asset/asset.repository';
import { AuthUserDto } from '../auth'; import { AuthUserDto } from '../auth';
import { ICryptoRepository } from '../crypto/crypto.repository'; import { IEntityJob, JobName } from '../job';
import { IEntityJob, IJobRepository, JobName } from '../job'; import {
import { ILibraryRepository } from '../library/library.repository'; IAlbumRepository,
IAssetRepository,
ICryptoRepository,
IJobRepository,
ILibraryRepository,
IStorageRepository,
IUserRepository,
} from '../repositories';
import { StorageCore, StorageFolder } from '../storage'; import { StorageCore, StorageFolder } from '../storage';
import { IStorageRepository } from '../storage/storage.repository';
import { CreateUserDto, UpdateUserDto, UserCountDto } from './dto'; import { CreateUserDto, UpdateUserDto, UserCountDto } from './dto';
import { import {
CreateProfileImageResponseDto, CreateProfileImageResponseDto,
@ -20,7 +24,6 @@ import {
mapUserCountResponse, mapUserCountResponse,
} 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 {