mirror of
https://github.com/strapi/strapi.git
synced 2025-07-24 17:40:18 +00:00

* chore: migrate to TS typeFromMime * chore: migrate to TS toSingularTypes * chore: migrate to TS prefixPluginTranslations * chore: migrate to TS prefixFileUrlWithBackendUrl * chore: migrate to TS moveElement * chore: migrate to TS getTrad * chore: migrate to TS getFileExtension * chore: migrate to TS containsAssetFilter * chore: migrate to TS displayedFilters * chore: migrate to TS downloadFile * chore: remove findRecursiveFolderMetadatas because is unused * chore: migrate to TS appendSearchParamsToUrl * chore: migrate to TS formatBytes * chore: migrate to TS formatDuration * chore: migrate to TS urlYupSchema * chore: migrate to TS urlsToAssets * chore: migrate to TS rawFileToAsset * chore: migrate to TS getFolderURL * chore: migrate to TS getFolderParents * chore: migrate to TS createAssetUrl * chore: migrate to TS findRecursiveFolderByValue * chore: migrate to TS getAllowedFiles * chore: migrate to TS getBreadcrumbDataCM * chore: migrate to TS normalizeAPIError * chore: migrate to TS getAPIInnerErrors * chore: migrate to TS getBreadcrumbDataML and change the utils imports * chore: fix export from index * chore: reduce the errors type definition * chore: change Query type * chore: change the way utils are exported in the index * chore: reduce the code in the custom declaration type file
156 lines
2.8 KiB
TypeScript
156 lines
2.8 KiB
TypeScript
import { errors } from '@strapi/utils';
|
|
|
|
export type SortOrder = 'ASC' | 'DESC';
|
|
|
|
export type SortKey = 'createdAt' | 'name' | 'updatedAt';
|
|
|
|
import type { File } from './files';
|
|
|
|
export interface Folder {
|
|
id: number;
|
|
name: string;
|
|
pathId?: number;
|
|
/**
|
|
* parent id
|
|
*/
|
|
parent?: number | null | Folder;
|
|
/**
|
|
* children ids
|
|
*/
|
|
children?: number[];
|
|
path?: string;
|
|
files?: File[];
|
|
}
|
|
|
|
export type FolderNode = Partial<Omit<Folder, 'children'>> & {
|
|
children: FolderNode[];
|
|
};
|
|
|
|
/**
|
|
* GET /upload/folders/:id - Get specific folder
|
|
*/
|
|
export declare namespace GetFolder {
|
|
export interface Request {
|
|
params: { id: number };
|
|
query: {};
|
|
}
|
|
|
|
export interface Response {
|
|
data: Folder;
|
|
error?: errors.ApplicationError | errors.NotFoundError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* GET /upload/folders - Get folders
|
|
*/
|
|
export declare namespace GetFolders {
|
|
export interface Request {
|
|
body: {};
|
|
query: {
|
|
page?: string;
|
|
pageSize?: string;
|
|
sort?: `${SortKey}:${SortOrder}`;
|
|
};
|
|
}
|
|
|
|
export interface Response {
|
|
data: Folder[];
|
|
error?: errors.ApplicationError | errors.NotFoundError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* POST /upload/folders - Create folders
|
|
*/
|
|
export declare namespace CreateFolders {
|
|
export interface Request {
|
|
body: Pick<Folder, 'name' | 'parent'>;
|
|
}
|
|
|
|
export interface Response {
|
|
data: Folder;
|
|
error?: errors.ApplicationError | errors.ValidationError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* PUT /upload/folders/:id - Update a specific folder
|
|
*/
|
|
export declare namespace UpdateFolder {
|
|
export interface Request {
|
|
params: { id: number };
|
|
query: {};
|
|
body: {
|
|
name: string;
|
|
parent: number | null;
|
|
};
|
|
}
|
|
|
|
export interface Response {
|
|
data: Folder;
|
|
error?: errors.ApplicationError | errors.NotFoundError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* GET /upload/folder-structure
|
|
*
|
|
* Return the structure of a folder.
|
|
*/
|
|
export declare namespace FolderStructureNamespace {
|
|
export interface Request {
|
|
query?: {};
|
|
}
|
|
|
|
export interface Response {
|
|
data: {
|
|
data: number[] & FolderNode[];
|
|
};
|
|
error?: errors.ApplicationError | errors.NotFoundError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* POST /upload/actions/bulk-delete - Delete Folder
|
|
*/
|
|
export declare namespace BulkDeleteFolders {
|
|
export interface Request {
|
|
body: {
|
|
folderIds: number[];
|
|
};
|
|
}
|
|
|
|
export interface Response {
|
|
data: {
|
|
data: {
|
|
files: [];
|
|
folders: Folder[];
|
|
};
|
|
};
|
|
error?: errors.ApplicationError | errors.ValidationError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* POST /upload/actions/bulk-move - Move Folder
|
|
*/
|
|
export declare namespace BulkMoveFolders {
|
|
export interface Request {
|
|
body: {
|
|
folderIds: number[];
|
|
destinationFolderId: number;
|
|
};
|
|
}
|
|
|
|
export interface Response {
|
|
data: {
|
|
data: {
|
|
files: [];
|
|
folders: Folder[];
|
|
};
|
|
};
|
|
error?: errors.ApplicationError | errors.ValidationError;
|
|
}
|
|
}
|