immich/server/src/domain/shared-link/shared-link.dto.ts
Jason Rasmussen 816d040d81
fix(server): lint import order (#3974)
* fix: use prettier extension

* chore: format fix
2023-09-04 21:45:59 +02:00

56 lines
1.1 KiB
TypeScript

import { SharedLinkType } from '@app/infra/entities';
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsBoolean, IsDate, IsEnum, IsString } from 'class-validator';
import { Optional, ValidateUUID } from '../domain.util';
export class SharedLinkCreateDto {
@IsEnum(SharedLinkType)
@ApiProperty({ enum: SharedLinkType, enumName: 'SharedLinkType' })
type!: SharedLinkType;
@ValidateUUID({ each: true, optional: true })
assetIds?: string[];
@ValidateUUID({ optional: true })
albumId?: string;
@IsString()
@Optional()
description?: string;
@IsDate()
@Type(() => Date)
@Optional({ nullable: true })
expiresAt?: Date | null = null;
@Optional()
@IsBoolean()
allowUpload?: boolean = false;
@Optional()
@IsBoolean()
allowDownload?: boolean = true;
@Optional()
@IsBoolean()
showExif?: boolean = true;
}
export class SharedLinkEditDto {
@Optional()
description?: string;
@Optional({ nullable: true })
expiresAt?: Date | null;
@Optional()
allowUpload?: boolean;
@Optional()
allowDownload?: boolean;
@Optional()
showExif?: boolean;
}