fileserver/dto/src/responses/fs.ts

44 lines
808 B
TypeScript
Raw Normal View History

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