feat: allow multiple shares with one reverse share link
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { IsBoolean, IsString } from "class-validator";
|
||||
import { IsBoolean, IsString, Max, Min } from "class-validator";
|
||||
|
||||
export class CreateReverseShareDTO {
|
||||
@IsBoolean()
|
||||
@@ -9,4 +9,8 @@ export class CreateReverseShareDTO {
|
||||
|
||||
@IsString()
|
||||
shareExpiration: string;
|
||||
|
||||
@Min(1)
|
||||
@Max(1000)
|
||||
maxUseCount: number;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Expose, plainToClass, Type } from "class-transformer";
|
||||
import { MyShareDTO } from "src/share/dto/myShare.dto";
|
||||
import { ReverseShareDTO } from "./reverseShare.dto";
|
||||
|
||||
export class ReverseShareTokenWithShare extends OmitType(ReverseShareDTO, [
|
||||
export class ReverseShareTokenWithShares extends OmitType(ReverseShareDTO, [
|
||||
"shareExpiration",
|
||||
] as const) {
|
||||
@Expose()
|
||||
@@ -11,14 +11,17 @@ export class ReverseShareTokenWithShare extends OmitType(ReverseShareDTO, [
|
||||
|
||||
@Expose()
|
||||
@Type(() => OmitType(MyShareDTO, ["recipients", "hasPassword"] as const))
|
||||
share: Omit<
|
||||
shares: Omit<
|
||||
MyShareDTO,
|
||||
"recipients" | "files" | "from" | "fromList" | "hasPassword"
|
||||
>;
|
||||
>[];
|
||||
|
||||
fromList(partial: Partial<ReverseShareTokenWithShare>[]) {
|
||||
@Expose()
|
||||
remainingUses: number;
|
||||
|
||||
fromList(partial: Partial<ReverseShareTokenWithShares>[]) {
|
||||
return partial.map((part) =>
|
||||
plainToClass(ReverseShareTokenWithShare, part, {
|
||||
plainToClass(ReverseShareTokenWithShares, part, {
|
||||
excludeExtraneousValues: true,
|
||||
})
|
||||
);
|
||||
Reference in New Issue
Block a user