d5cf8e4bfe
* Refactor controller methods, non-breaking change * Remove getAllAssets * used imports * sync:sql * missing mock * Removing remaining references * chore: remove unused code --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
65 lines
1.4 KiB
TypeScript
65 lines
1.4 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
import { ArrayNotEmpty, IsArray, IsNotEmpty, IsString, ValidateNested } from 'class-validator';
|
|
import { Optional, ValidateDate } from 'src/validation';
|
|
|
|
export enum UploadFieldName {
|
|
ASSET_DATA = 'assetData',
|
|
LIVE_PHOTO_DATA = 'livePhotoData',
|
|
SIDECAR_DATA = 'sidecarData',
|
|
PROFILE_DATA = 'file',
|
|
}
|
|
|
|
export class AssetMediaReplaceDto {
|
|
@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 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;
|
|
}
|