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:
parent
b56f22aac3
commit
2ea080cacd
93 changed files with 313 additions and 227 deletions
|
@ -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',
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
export * from './access.core';
|
export * from './access.core';
|
||||||
export * from './access.repository';
|
|
||||||
|
|
|
@ -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, () => {
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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, () => {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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, () => {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
export * from './audit.dto';
|
export * from './audit.dto';
|
||||||
export * from './audit.repository';
|
|
||||||
export * from './audit.service';
|
export * from './audit.service';
|
||||||
|
|
|
@ -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');
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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';
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './communication.repository';
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './crypto.repository';
|
|
|
@ -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';
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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) => {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
export * from './library.dto';
|
export * from './library.dto';
|
||||||
export * from './library.repository';
|
|
||||||
export * from './library.service';
|
export * from './library.service';
|
||||||
|
|
|
@ -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, () => {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
export * from './media.constant';
|
export * from './media.constant';
|
||||||
export * from './media.repository';
|
|
||||||
export * from './media.service';
|
export * from './media.service';
|
||||||
|
|
|
@ -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, () => {
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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) {}
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
export * from './metadata.repository';
|
|
||||||
export * from './metadata.service';
|
export * from './metadata.service';
|
||||||
|
|
|
@ -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, () => {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
export * from './partner.repository';
|
|
||||||
export * from './partner.service';
|
export * from './partner.service';
|
||||||
|
|
|
@ -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 = {
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
export * from './person.dto';
|
export * from './person.dto';
|
||||||
export * from './person.repository';
|
|
||||||
export * from './person.service';
|
export * from './person.service';
|
||||||
|
|
|
@ -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 = {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
22
server/src/domain/repositories/index.ts
Normal file
22
server/src/domain/repositories/index.ts
Normal 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';
|
|
@ -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;
|
|
@ -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';
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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>;
|
||||||
|
|
|
@ -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, () => {
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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, () => {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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 = {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
export * from './storage.core';
|
export * from './storage.core';
|
||||||
export * from './storage.repository';
|
|
||||||
export * from './storage.service';
|
export * from './storage.service';
|
||||||
|
|
|
@ -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',
|
||||||
|
|
|
@ -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, () => {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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>;
|
||||||
|
|
||||||
|
|
|
@ -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[] = [
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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, () => {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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) => {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue