* add name property to share * refactor: run formatter * tests: adapt system tests * tests: adapt second system test
42 lines
796 B
TypeScript
42 lines
796 B
TypeScript
import { Expose, plainToClass, Type } from "class-transformer";
|
|
import { FileDTO } from "src/file/dto/file.dto";
|
|
import { PublicUserDTO } from "src/user/dto/publicUser.dto";
|
|
|
|
export class ShareDTO {
|
|
@Expose()
|
|
id: string;
|
|
|
|
@Expose()
|
|
name?: string;
|
|
|
|
@Expose()
|
|
expiration: Date;
|
|
|
|
@Expose()
|
|
@Type(() => FileDTO)
|
|
files: FileDTO[];
|
|
|
|
@Expose()
|
|
@Type(() => PublicUserDTO)
|
|
creator: PublicUserDTO;
|
|
|
|
@Expose()
|
|
description: string;
|
|
|
|
@Expose()
|
|
hasPassword: boolean;
|
|
|
|
@Expose()
|
|
size: number;
|
|
|
|
from(partial: Partial<ShareDTO>) {
|
|
return plainToClass(ShareDTO, partial, { excludeExtraneousValues: true });
|
|
}
|
|
|
|
fromList(partial: Partial<ShareDTO>[]) {
|
|
return partial.map((part) =>
|
|
plainToClass(ShareDTO, part, { excludeExtraneousValues: true }),
|
|
);
|
|
}
|
|
}
|