mirror of
https://github.com/swissmakers/swiss-datashare.git
synced 2026-04-11 10:27:01 +02:00
30 lines
812 B
TypeScript
30 lines
812 B
TypeScript
import { OmitType } from "@nestjs/swagger";
|
|
import { Expose, plainToClass, Type } from "class-transformer";
|
|
import { MyShareDTO } from "src/share/dto/myShare.dto";
|
|
import { ReverseShareDTO } from "./reverseShare.dto";
|
|
|
|
export class ReverseShareTokenWithShares extends OmitType(ReverseShareDTO, [
|
|
"shareExpiration",
|
|
] as const) {
|
|
@Expose()
|
|
shareExpiration: Date;
|
|
|
|
@Expose()
|
|
@Type(() => OmitType(MyShareDTO, ["recipients", "hasPassword"] as const))
|
|
shares: Omit<
|
|
MyShareDTO,
|
|
"recipients" | "files" | "from" | "fromList" | "hasPassword"
|
|
>[];
|
|
|
|
@Expose()
|
|
remainingUses: number;
|
|
|
|
fromList(partial: Partial<ReverseShareTokenWithShares>[]) {
|
|
return partial.map((part) =>
|
|
plainToClass(ReverseShareTokenWithShares, part, {
|
|
excludeExtraneousValues: true,
|
|
})
|
|
);
|
|
}
|
|
}
|