mirror of
https://github.com/stonith404/pingvin-share.git
synced 2024-06-02 22:00:14 +02:00
b717663b5c
* add name property to share * refactor: run formatter * tests: adapt system tests * tests: adapt second system test
39 lines
711 B
TypeScript
39 lines
711 B
TypeScript
import { Type } from "class-transformer";
|
|
import {
|
|
IsEmail,
|
|
IsOptional,
|
|
IsString,
|
|
Length,
|
|
Matches,
|
|
MaxLength,
|
|
ValidateNested,
|
|
} from "class-validator";
|
|
import { ShareSecurityDTO } from "./shareSecurity.dto";
|
|
|
|
export class CreateShareDTO {
|
|
@IsString()
|
|
@Matches("^[a-zA-Z0-9_-]*$", undefined, {
|
|
message: "ID can only contain letters, numbers, underscores and hyphens",
|
|
})
|
|
@Length(3, 50)
|
|
id: string;
|
|
|
|
@Length(3, 30)
|
|
@IsOptional()
|
|
name: string;
|
|
|
|
@IsString()
|
|
expiration: string;
|
|
|
|
@MaxLength(512)
|
|
@IsOptional()
|
|
description: string;
|
|
|
|
@IsEmail({}, { each: true })
|
|
recipients: string[];
|
|
|
|
@ValidateNested()
|
|
@Type(() => ShareSecurityDTO)
|
|
security: ShareSecurityDTO;
|
|
}
|