1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-01 08:31:59 +00: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 { AuthUserDto } from '../auth';
import { IAccessRepository } from './access.repository';
import { IAccessRepository } from '../repositories';
export enum Permission {
// ASSET_CREATE = 'asset.create',

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -19,16 +19,18 @@ import {
import { IncomingHttpHeaders } from 'http';
import { Issuer, generators } from 'openid-client';
import { Socket } from 'socket.io';
import { IKeyRepository } from '../api-key';
import { ICryptoRepository } from '../crypto/crypto.repository';
import { ILibraryRepository } from '../library';
import { ISharedLinkRepository } from '../shared-link';
import { ISystemConfigRepository } from '../system-config';
import { IUserRepository } from '../user';
import {
ICryptoRepository,
IKeyRepository,
ILibraryRepository,
ISharedLinkRepository,
ISystemConfigRepository,
IUserRepository,
IUserTokenRepository,
} from '../repositories';
import { AuthType } from './auth.constant';
import { AuthService } from './auth.service';
import { AuthUserDto, SignUpDto } from './dto';
import { IUserTokenRepository } from './user-token.repository';
// 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 { DateTime } from 'luxon';
import { ClientMetadata, Issuer, UserinfoResponse, custom, generators } from 'openid-client';
import { IKeyRepository } from '../api-key';
import { ICryptoRepository } from '../crypto/crypto.repository';
import { ILibraryRepository } from '../library';
import { ISharedLinkRepository } from '../shared-link';
import { ISystemConfigRepository } from '../system-config';
import {
ICryptoRepository,
IKeyRepository,
ILibraryRepository,
ISharedLinkRepository,
ISystemConfigRepository,
IUserRepository,
IUserTokenRepository,
} from '../repositories';
import { SystemConfigCore } from '../system-config/system-config.core';
import { IUserRepository, UserCore, UserResponseDto } from '../user';
import { UserCore, UserResponseDto } from '../user';
import {
AuthType,
IMMICH_ACCESS_COOKIE,
@ -38,7 +42,6 @@ import {
mapLoginResponse,
mapUserToken,
} from './response-dto';
import { IUserTokenRepository } from './user-token.repository';
export interface LoginDetails {
isSecure: boolean;

View file

@ -2,4 +2,3 @@ export * from './auth.constant';
export * from './auth.service';
export * from './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 './audit';
export * from './auth';
export * from './communication';
export * from './crypto';
export * from './domain.config';
export * from './domain.constant';
export * from './domain.module';
@ -16,6 +14,7 @@ export * from './media';
export * from './metadata';
export * from './partner';
export * from './person';
export * from './repositories';
export * from './search';
export * from './server-info';
export * from './shared-link';

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,5 @@
import { LibraryEntity, LibraryType } from '@app/infra/entities';
import { LibraryStatsResponseDto } from './library.dto';
import { LibraryStatsResponseDto } from '../library/library.dto';
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';

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,12 +1,11 @@
import { AssetEntity, SharedLinkEntity, SharedLinkType } from '@app/infra/entities';
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 { AuthUserDto } from '../auth';
import { ICryptoRepository } from '../crypto';
import { IAccessRepository, ICryptoRepository, ISharedLinkRepository } from '../repositories';
import { SharedLinkResponseDto, mapSharedLink, mapSharedLinkWithNoExif } from './shared-link-response.dto';
import { SharedLinkCreateDto, SharedLinkEditDto } from './shared-link.dto';
import { ISharedLinkRepository } from './shared-link.repository';
@Injectable()
export class SharedLinkService {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -16,16 +16,19 @@ import {
userStub,
} from '@test';
import { when } from 'jest-when';
import { IAlbumRepository } from '../album';
import { IAssetRepository } from '../asset';
import { AuthUserDto } from '../auth';
import { ICryptoRepository } from '../crypto';
import { IJobRepository, JobName } from '../job';
import { ILibraryRepository } from '../library';
import { IStorageRepository } from '../storage';
import { JobName } from '../job';
import {
IAlbumRepository,
IAssetRepository,
ICryptoRepository,
IJobRepository,
ILibraryRepository,
IStorageRepository,
IUserRepository,
} from '../repositories';
import { UpdateUserDto } from './dto/update-user.dto';
import { UserResponseDto, mapUser } from './response-dto';
import { IUserRepository } from './user.repository';
import { UserService } from './user.service';
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 { randomBytes } from 'crypto';
import { ReadStream } from 'fs';
import { IAlbumRepository } from '../album/album.repository';
import { IAssetRepository } from '../asset/asset.repository';
import { AuthUserDto } from '../auth';
import { ICryptoRepository } from '../crypto/crypto.repository';
import { IEntityJob, IJobRepository, JobName } from '../job';
import { ILibraryRepository } from '../library/library.repository';
import { IEntityJob, JobName } from '../job';
import {
IAlbumRepository,
IAssetRepository,
ICryptoRepository,
IJobRepository,
ILibraryRepository,
IStorageRepository,
IUserRepository,
} from '../repositories';
import { StorageCore, StorageFolder } from '../storage';
import { IStorageRepository } from '../storage/storage.repository';
import { CreateUserDto, UpdateUserDto, UserCountDto } from './dto';
import {
CreateProfileImageResponseDto,
@ -20,7 +24,6 @@ import {
mapUserCountResponse,
} from './response-dto';
import { UserCore } from './user.core';
import { IUserRepository } from './user.repository';
@Injectable()
export class UserService {