2023-06-20 21:08:43 -04:00
|
|
|
import { SharedLinkType } from '@app/infra/entities';
|
|
|
|
|
import { ApiProperty } from '@nestjs/swagger';
|
2023-06-24 10:24:55 -05:00
|
|
|
import { Type } from 'class-transformer';
|
2023-09-01 12:40:00 -04:00
|
|
|
import { IsBoolean, IsDate, IsEnum, IsString } from 'class-validator';
|
2023-09-04 15:45:59 -04:00
|
|
|
import { Optional, ValidateUUID } from '../domain.util';
|
2023-06-20 21:08:43 -04:00
|
|
|
|
|
|
|
|
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()
|
2023-09-01 12:40:00 -04:00
|
|
|
@Optional()
|
2023-06-20 21:08:43 -04:00
|
|
|
description?: string;
|
|
|
|
|
|
|
|
|
|
@IsDate()
|
2023-06-24 10:24:55 -05:00
|
|
|
@Type(() => Date)
|
2023-09-01 12:40:00 -04:00
|
|
|
@Optional({ nullable: true })
|
2023-06-20 21:08:43 -04:00
|
|
|
expiresAt?: Date | null = null;
|
|
|
|
|
|
2023-09-01 12:40:00 -04:00
|
|
|
@Optional()
|
2023-06-20 21:08:43 -04:00
|
|
|
@IsBoolean()
|
|
|
|
|
allowUpload?: boolean = false;
|
|
|
|
|
|
2023-09-01 12:40:00 -04:00
|
|
|
@Optional()
|
2023-06-20 21:08:43 -04:00
|
|
|
@IsBoolean()
|
|
|
|
|
allowDownload?: boolean = true;
|
|
|
|
|
|
2023-09-01 12:40:00 -04:00
|
|
|
@Optional()
|
2023-06-20 21:08:43 -04:00
|
|
|
@IsBoolean()
|
2023-10-14 03:46:30 +02:00
|
|
|
showMetadata?: boolean = true;
|
2023-06-20 21:08:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class SharedLinkEditDto {
|
2023-09-01 12:40:00 -04:00
|
|
|
@Optional()
|
2023-06-20 21:08:43 -04:00
|
|
|
description?: string;
|
|
|
|
|
|
2023-09-01 12:40:00 -04:00
|
|
|
@Optional({ nullable: true })
|
2023-06-20 21:08:43 -04:00
|
|
|
expiresAt?: Date | null;
|
|
|
|
|
|
2023-09-01 12:40:00 -04:00
|
|
|
@Optional()
|
2023-06-20 21:08:43 -04:00
|
|
|
allowUpload?: boolean;
|
|
|
|
|
|
2023-09-01 12:40:00 -04:00
|
|
|
@Optional()
|
2023-06-20 21:08:43 -04:00
|
|
|
allowDownload?: boolean;
|
|
|
|
|
|
2023-09-01 12:40:00 -04:00
|
|
|
@Optional()
|
2023-10-14 03:46:30 +02:00
|
|
|
showMetadata?: boolean;
|
2023-10-22 15:05:10 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Few clients cannot send null to set the expiryTime to never.
|
|
|
|
|
* Setting this flag and not sending expiryAt is considered as null instead.
|
|
|
|
|
* Clients that can send null values can ignore this.
|
|
|
|
|
*/
|
|
|
|
|
@Optional()
|
|
|
|
|
@IsBoolean()
|
|
|
|
|
changeExpiryTime?: boolean;
|
2023-06-20 21:08:43 -04:00
|
|
|
}
|