fileserver/dto/src/responses/fs.ts

50 lines
837 B
TypeScript
Raw Normal View History

import { BaseResponse, 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 11:39:58 +00:00
export class GetRootResponse extends BaseResponse {
statusCode: 200;
2022-08-25 11:39:58 +00:00
@IsInt()
@Min(1)
rootId: number;
}
2022-08-25 11:39:58 +00:00
export class GetNodeResponse extends BaseResponse {
statusCode: 200;
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
children?: number[];
2022-08-25 11:39:58 +00:00
size?: number;
}
2022-08-25 11:39:58 +00:00
export class GetPathResponse extends BaseResponse {
statusCode: 200;
2022-08-25 11:39:58 +00:00
@IsNotEmpty()
path: string;
}
2022-08-25 11:39:58 +00:00
export class CreateFolderResponse extends BaseResponse {
statusCode: 200;
2022-08-25 11:39:58 +00:00
@IsInt()
@Min(1)
id: number;
}