Files
immich/server/src/domain/shared-link/shared-link.dto.ts
shenlong 8dcc01b2be feat(mobile): shared-links (#4490)
* add shared links page

* feat(mobile): shared link items

* feat(mobile): create / edit shared links page

* server: add changeExpiryTime to SharedLinkEditDto

* fix(mobile): edit expiry to never

* mobile: add icon when shares list is empty

* mobile: create new share from album / timeline

* mobile: add translation texts

* mobile: minor ui fixes

* fix: handle serverURL with /api path

* mobile: show share link on successful creation

* mobile: shared links list - 2 column layout

* mobile: use sharedlink pod class instead of dto

* mobile: show error on link creation

* mobile: show share icon only when remote assets are in selection

* mobile: use server endpoint instead of server url

* styling

* styling

---------

Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
2023-10-22 15:05:10 +00:00

65 lines
1.4 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()
showMetadata?: boolean = true;
}
export class SharedLinkEditDto {
@Optional()
description?: string;
@Optional({ nullable: true })
expiresAt?: Date | null;
@Optional()
allowUpload?: boolean;
@Optional()
allowDownload?: boolean;
@Optional()
showMetadata?: boolean;
/**
* 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;
}