2022-08-25 12:16:29 +00:00
|
|
|
import { SuccessResponse } from './base';
|
2022-08-25 13:13:44 +00:00
|
|
|
import {
|
|
|
|
IsBoolean,
|
|
|
|
IsInt,
|
|
|
|
IsNotEmpty,
|
|
|
|
IsOptional,
|
|
|
|
IsString,
|
|
|
|
Min
|
|
|
|
} from 'class-validator';
|
|
|
|
import { ValidateConstructor } from '../utils';
|
2022-08-24 14:15:33 +00:00
|
|
|
|
2022-08-25 13:13:44 +00:00
|
|
|
@ValidateConstructor
|
2022-08-25 12:16:29 +00:00
|
|
|
export class GetRootResponse extends SuccessResponse {
|
2022-08-25 13:13:44 +00:00
|
|
|
constructor(rootId: number) {
|
|
|
|
super();
|
|
|
|
this.rootId = rootId;
|
|
|
|
}
|
2022-08-25 11:39:58 +00:00
|
|
|
@IsInt()
|
|
|
|
@Min(1)
|
2022-08-24 14:15:33 +00:00
|
|
|
rootId: number;
|
|
|
|
}
|
|
|
|
|
2022-08-25 12:16:29 +00:00
|
|
|
export class GetNodeResponse extends SuccessResponse {
|
2022-08-25 13:13:44 +00:00
|
|
|
constructor(
|
|
|
|
id: number,
|
|
|
|
name: string,
|
|
|
|
isFile: boolean,
|
|
|
|
parent: number | null
|
|
|
|
) {
|
|
|
|
super();
|
|
|
|
this.id = id;
|
|
|
|
this.name = name;
|
|
|
|
this.isFile = isFile;
|
|
|
|
this.parent = parent;
|
|
|
|
}
|
|
|
|
|
2022-08-25 11:39:58 +00:00
|
|
|
@IsInt()
|
|
|
|
@Min(1)
|
2022-08-24 14:15:33 +00:00
|
|
|
id: number;
|
2022-08-25 11:39:58 +00:00
|
|
|
|
|
|
|
@IsNotEmpty()
|
2022-08-24 14:15:33 +00:00
|
|
|
name: string;
|
2022-08-25 11:39:58 +00:00
|
|
|
|
|
|
|
@IsBoolean()
|
2022-08-24 14:15:33 +00:00
|
|
|
isFile: boolean;
|
2022-08-25 11:39:58 +00:00
|
|
|
|
2022-08-25 13:13:44 +00:00
|
|
|
@IsOptional()
|
|
|
|
@IsInt()
|
|
|
|
@Min(1)
|
2022-08-24 14:15:33 +00:00
|
|
|
parent: number | null;
|
2022-08-25 11:39:58 +00:00
|
|
|
|
2022-08-25 13:13:44 +00:00
|
|
|
@IsOptional()
|
2022-08-25 12:16:29 +00:00
|
|
|
@IsInt({ each: true })
|
|
|
|
@Min(1, { each: true })
|
2022-08-24 14:15:33 +00:00
|
|
|
children?: number[];
|
2022-08-25 11:39:58 +00:00
|
|
|
|
2022-08-25 13:13:44 +00:00
|
|
|
@IsOptional()
|
|
|
|
@IsInt()
|
|
|
|
@Min(0)
|
2022-08-24 14:15:33 +00:00
|
|
|
size?: number;
|
|
|
|
}
|
|
|
|
|
2022-08-25 13:13:44 +00:00
|
|
|
@ValidateConstructor
|
2022-08-25 12:16:29 +00:00
|
|
|
export class GetPathResponse extends SuccessResponse {
|
2022-08-25 13:13:44 +00:00
|
|
|
constructor(path: string) {
|
|
|
|
super();
|
|
|
|
this.path = path;
|
|
|
|
}
|
|
|
|
|
2022-08-25 11:39:58 +00:00
|
|
|
@IsNotEmpty()
|
2022-08-25 13:13:44 +00:00
|
|
|
@IsString()
|
2022-08-24 14:15:33 +00:00
|
|
|
path: string;
|
|
|
|
}
|
|
|
|
|
2022-08-25 13:13:44 +00:00
|
|
|
@ValidateConstructor
|
2022-08-25 12:16:29 +00:00
|
|
|
export class CreateFolderResponse extends SuccessResponse {
|
2022-08-25 13:13:44 +00:00
|
|
|
constructor(id: number) {
|
|
|
|
super();
|
|
|
|
this.id = id;
|
|
|
|
}
|
|
|
|
|
2022-08-25 11:39:58 +00:00
|
|
|
@IsInt()
|
|
|
|
@Min(1)
|
2022-08-24 14:15:33 +00:00
|
|
|
id: number;
|
|
|
|
}
|
2022-08-25 13:13:44 +00:00
|
|
|
|
|
|
|
export class UploadFileResponse extends SuccessResponse {}
|
|
|
|
export class DeleteResponse extends SuccessResponse {}
|
|
|
|
export class CreateFileResponse extends CreateFolderResponse {}
|