mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-12-08 04:09:07 +00:00
refactor(server): system config (#1353)
* refactor(server): system config * fix: jest circular import * chore: ignore migrations in coverage report * chore: tests * chore: tests * chore: todo note * chore: remove vite config backup * chore: fix redis hostname
This commit is contained in:
3
server/libs/domain/src/job/index.ts
Normal file
3
server/libs/domain/src/job/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './interfaces';
|
||||
export * from './job.constants';
|
||||
export * from './job.repository';
|
||||
@@ -0,0 +1,13 @@
|
||||
import { AssetEntity } from '@app/infra/db/entities';
|
||||
|
||||
export interface IAssetUploadedJob {
|
||||
/**
|
||||
* The Asset entity that was saved in the database
|
||||
*/
|
||||
asset: AssetEntity;
|
||||
|
||||
/**
|
||||
* Original file name
|
||||
*/
|
||||
fileName: string;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { AssetEntity } from '@app/infra/db/entities';
|
||||
|
||||
export interface IDeleteFileOnDiskJob {
|
||||
assets: AssetEntity[];
|
||||
}
|
||||
7
server/libs/domain/src/job/interfaces/index.ts
Normal file
7
server/libs/domain/src/job/interfaces/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export * from './asset-uploaded.interface';
|
||||
export * from './background-task.interface';
|
||||
export * from './machine-learning.interface';
|
||||
export * from './metadata-extraction.interface';
|
||||
export * from './thumbnail-generation.interface';
|
||||
export * from './user-deletion.interface';
|
||||
export * from './video-transcode.interface';
|
||||
@@ -0,0 +1,8 @@
|
||||
import { AssetEntity } from '@app/infra/db/entities';
|
||||
|
||||
export interface IMachineLearningJob {
|
||||
/**
|
||||
* The Asset entity that was saved in the database
|
||||
*/
|
||||
asset: AssetEntity;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { AssetEntity } from '@app/infra/db/entities';
|
||||
|
||||
export interface IExifExtractionProcessor {
|
||||
/**
|
||||
* The Asset entity that was saved in the database
|
||||
*/
|
||||
asset: AssetEntity;
|
||||
|
||||
/**
|
||||
* Original file name
|
||||
*/
|
||||
fileName: string;
|
||||
}
|
||||
|
||||
export interface IVideoLengthExtractionProcessor {
|
||||
/**
|
||||
* The Asset entity that was saved in the database
|
||||
*/
|
||||
asset: AssetEntity;
|
||||
|
||||
/**
|
||||
* Original file name
|
||||
*/
|
||||
fileName: string;
|
||||
}
|
||||
|
||||
export interface IReverseGeocodingProcessor {
|
||||
exifId: string;
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
}
|
||||
|
||||
export type IMetadataExtractionJob =
|
||||
| IExifExtractionProcessor
|
||||
| IVideoLengthExtractionProcessor
|
||||
| IReverseGeocodingProcessor;
|
||||
@@ -0,0 +1,17 @@
|
||||
import { AssetEntity } from '@app/infra/db/entities';
|
||||
|
||||
export interface JpegGeneratorProcessor {
|
||||
/**
|
||||
* The Asset entity that was saved in the database
|
||||
*/
|
||||
asset: AssetEntity;
|
||||
}
|
||||
|
||||
export interface WebpGeneratorProcessor {
|
||||
/**
|
||||
* The Asset entity that was saved in the database
|
||||
*/
|
||||
asset: AssetEntity;
|
||||
}
|
||||
|
||||
export type IThumbnailGenerationJob = JpegGeneratorProcessor | WebpGeneratorProcessor;
|
||||
@@ -0,0 +1,8 @@
|
||||
import { UserEntity } from '@app/infra/db/entities';
|
||||
|
||||
export interface IUserDeletionJob {
|
||||
/**
|
||||
* The user entity that was saved in the database
|
||||
*/
|
||||
user: UserEntity;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { AssetEntity } from '@app/infra/db/entities';
|
||||
|
||||
export interface IMp4ConversionProcessor {
|
||||
/**
|
||||
* The Asset entity that was saved in the database
|
||||
*/
|
||||
asset: AssetEntity;
|
||||
}
|
||||
|
||||
export type IVideoTranscodeJob = IMp4ConversionProcessor;
|
||||
27
server/libs/domain/src/job/job.constants.ts
Normal file
27
server/libs/domain/src/job/job.constants.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
export enum QueueName {
|
||||
THUMBNAIL_GENERATION = 'thumbnail-generation-queue',
|
||||
METADATA_EXTRACTION = 'metadata-extraction-queue',
|
||||
VIDEO_CONVERSION = 'video-conversion-queue',
|
||||
CHECKSUM_GENERATION = 'generate-checksum-queue',
|
||||
ASSET_UPLOADED = 'asset-uploaded-queue',
|
||||
MACHINE_LEARNING = 'machine-learning-queue',
|
||||
USER_DELETION = 'user-deletion-queue',
|
||||
CONFIG = 'config-queue',
|
||||
BACKGROUND_TASK = 'background-task',
|
||||
}
|
||||
|
||||
export enum JobName {
|
||||
ASSET_UPLOADED = 'asset-uploaded',
|
||||
MP4_CONVERSION = 'mp4-conversion',
|
||||
GENERATE_JPEG_THUMBNAIL = 'generate-jpeg-thumbnail',
|
||||
GENERATE_WEBP_THUMBNAIL = 'generate-webp-thumbnail',
|
||||
EXIF_EXTRACTION = 'exif-extraction',
|
||||
EXTRACT_VIDEO_METADATA = 'extract-video-metadata',
|
||||
REVERSE_GEOCODING = 'reverse-geocoding',
|
||||
USER_DELETION = 'user-deletion',
|
||||
TEMPLATE_MIGRATION = 'template-migration',
|
||||
CONFIG_CHANGE = 'config-change',
|
||||
OBJECT_DETECTION = 'detect-object',
|
||||
IMAGE_TAGGING = 'tag-image',
|
||||
DELETE_FILE_ON_DISK = 'delete-file-on-disk',
|
||||
}
|
||||
32
server/libs/domain/src/job/job.repository.ts
Normal file
32
server/libs/domain/src/job/job.repository.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import {
|
||||
IAssetUploadedJob,
|
||||
IDeleteFileOnDiskJob,
|
||||
IExifExtractionProcessor,
|
||||
IMachineLearningJob,
|
||||
IMp4ConversionProcessor,
|
||||
IReverseGeocodingProcessor,
|
||||
IUserDeletionJob,
|
||||
JpegGeneratorProcessor,
|
||||
WebpGeneratorProcessor,
|
||||
} from './interfaces';
|
||||
import { JobName } from './job.constants';
|
||||
|
||||
export type JobItem =
|
||||
| { name: JobName.ASSET_UPLOADED; data: IAssetUploadedJob }
|
||||
| { name: JobName.MP4_CONVERSION; data: IMp4ConversionProcessor }
|
||||
| { name: JobName.GENERATE_JPEG_THUMBNAIL; data: JpegGeneratorProcessor }
|
||||
| { name: JobName.GENERATE_WEBP_THUMBNAIL; data: WebpGeneratorProcessor }
|
||||
| { name: JobName.EXIF_EXTRACTION; data: IExifExtractionProcessor }
|
||||
| { name: JobName.REVERSE_GEOCODING; data: IReverseGeocodingProcessor }
|
||||
| { name: JobName.USER_DELETION; data: IUserDeletionJob }
|
||||
| { name: JobName.TEMPLATE_MIGRATION }
|
||||
| { name: JobName.CONFIG_CHANGE }
|
||||
| { name: JobName.OBJECT_DETECTION; data: IMachineLearningJob }
|
||||
| { name: JobName.IMAGE_TAGGING; data: IMachineLearningJob }
|
||||
| { name: JobName.DELETE_FILE_ON_DISK; data: IDeleteFileOnDiskJob };
|
||||
|
||||
export const IJobRepository = 'IJobRepository';
|
||||
|
||||
export interface IJobRepository {
|
||||
add(item: JobItem): Promise<void>;
|
||||
}
|
||||
Reference in New Issue
Block a user