b2f2be3485
* refactor: library scanning fix tests remove offline files step cleanup library service improve tests cleanup tests add db migration fix e2e cleanup openapi fix tests fix tests update docs update docs update mobile code fix formatting don't remove assets from library with invalid import path use trash for offline files add migration simplify scan endpoint cleanup library panel fix library tests e2e lint fix e2e trash e2e fix lint add asset trash tests add more tests ensure thumbs are generated cleanup svelte cleanup queue names fix tests fix lint add warning due to trash fix trash tests fix lint fix tests Admin message for offline asset fix comments Update web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> add permission to library scan endpoint revert asset interface sort add trash reason to shared link stub improve path view in offline update docs improve trash performance fix comments remove stray comment * refactor: add back isOffline and remove trashReason from asset, change sync job flow * chore(server): drop coverage to 80% for functions * chore: rebase and generated files --------- Co-authored-by: Zack Pollard <zackpollard@ymail.com>
95 lines
2.1 KiB
TypeScript
95 lines
2.1 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
import { ArrayNotEmpty, IsArray, IsEnum, IsNotEmpty, IsString, ValidateNested } from 'class-validator';
|
|
import { Optional, ValidateBoolean, ValidateDate, ValidateUUID } from 'src/validation';
|
|
|
|
export enum AssetMediaSize {
|
|
PREVIEW = 'preview',
|
|
THUMBNAIL = 'thumbnail',
|
|
}
|
|
|
|
export class AssetMediaOptionsDto {
|
|
@Optional()
|
|
@IsEnum(AssetMediaSize)
|
|
@ApiProperty({ enumName: 'AssetMediaSize', enum: AssetMediaSize })
|
|
size?: AssetMediaSize;
|
|
}
|
|
|
|
export enum UploadFieldName {
|
|
ASSET_DATA = 'assetData',
|
|
SIDECAR_DATA = 'sidecarData',
|
|
PROFILE_DATA = 'file',
|
|
}
|
|
|
|
class AssetMediaBase {
|
|
@IsNotEmpty()
|
|
@IsString()
|
|
deviceAssetId!: string;
|
|
|
|
@IsNotEmpty()
|
|
@IsString()
|
|
deviceId!: string;
|
|
|
|
@ValidateDate()
|
|
fileCreatedAt!: Date;
|
|
|
|
@ValidateDate()
|
|
fileModifiedAt!: Date;
|
|
|
|
@Optional()
|
|
@IsString()
|
|
duration?: string;
|
|
|
|
// The properties below are added to correctly generate the API docs
|
|
// and client SDKs. Validation should be handled in the controller.
|
|
@ApiProperty({ type: 'string', format: 'binary' })
|
|
[UploadFieldName.ASSET_DATA]!: any;
|
|
}
|
|
|
|
export class AssetMediaCreateDto extends AssetMediaBase {
|
|
@ValidateBoolean({ optional: true })
|
|
isFavorite?: boolean;
|
|
|
|
@ValidateBoolean({ optional: true })
|
|
isArchived?: boolean;
|
|
|
|
@ValidateBoolean({ optional: true })
|
|
isVisible?: boolean;
|
|
|
|
@ValidateUUID({ optional: true })
|
|
livePhotoVideoId?: string;
|
|
|
|
@ApiProperty({ type: 'string', format: 'binary', required: false })
|
|
[UploadFieldName.SIDECAR_DATA]?: any;
|
|
}
|
|
|
|
export class AssetMediaReplaceDto extends AssetMediaBase {}
|
|
|
|
export class AssetBulkUploadCheckItem {
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
id!: string;
|
|
|
|
/** base64 or hex encoded sha1 hash */
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
checksum!: string;
|
|
}
|
|
|
|
export class AssetBulkUploadCheckDto {
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => AssetBulkUploadCheckItem)
|
|
assets!: AssetBulkUploadCheckItem[];
|
|
}
|
|
|
|
export class CheckExistingAssetsDto {
|
|
@ArrayNotEmpty()
|
|
@IsString({ each: true })
|
|
@IsNotEmpty({ each: true })
|
|
deviceAssetIds!: string[];
|
|
|
|
@IsNotEmpty()
|
|
deviceId!: string;
|
|
}
|