mirror of
https://github.com/strapi/strapi.git
synced 2025-06-27 00:41:25 +00:00

* chore: migrate to TS AudoPreview component * chore: migrate to TS PaginationContext component * chore: migrate to TS Pagination component * chore: migrate to TS PaginationFolder components * chore: migrate to TS PaginationFooter index component * chore: migrate to TS isSelectable util * chore: migrate to TS PageSize component * chore: migrate to TS DialogFooter component * chore: migrate to TS Draggable component * chore: migrate to TS ContextInfo component * chore: migrate to TS ContextInfo test and index component * chore: migrate to TS PreviewBox components file * chore: migrate to TS DialogHeader component * chore: migrate to TS RemoveFolderDialog * chore: migrate to TS EmptyAssetGrid * chore: migrate to TS EmptyAssets index file * chore: migrate to TS AssetCardBase * chore: migrate to TS AudioAssetCard component * chore: migrate to TS DocAssetCard component * chore: migrate to TS ImageAssetCard component * chore: migrate to TS AssetCard unit tests * chore: migrate to TS SearchAsset component * chore: migrate to TS UploadProgress component * chore: migrate to TS FromComputerForm component * chore: migrate to TS FromUrlForm component * chore: migrate to TS AddAssetStep component * chore: migrate to TS VideoPreview component * chore: migrate to TS VideoAssetCard component * chore: migrate to TS UploadingAssetCard component * chore: migrate to TS PreviewCell component * chore: migrate to TS CellContent component * chore: migrate to TS TableRows component * chore: migrate to TS TableList component * chore: migrate to TS SortPicker component * chore: migrate to TS Option component with utils * chore: migrate to TS EmptyStateAsset and CarouselAsset * chore: migrate to TS CopyLinkButton component * chore: migrate to TS CarouselAssetActions component * chore: migrate to TS FolderGridList component * chore: migrate to TS FolderCardContext * chore: migrate to TS FolderCard component * chore: migrate to TS FolderCardBody component * chore: migrate to TS FolderCardBodyAction component * chore: migrate to TS FolderCardCheckbox component * chore: migrate to TS FolderCard unit test * chore: migrate to TS getFilterList * chore: migrate to TS FilterValueInput component * chore: migrate to TS FilterTag * chore: migrate to TS FilterList * chore: migrate to TS EditFolderModalHeader component * chore: migrate to TS AssetPreview component * chore: migrate to TS CroppingActions component * chore: migrate to TS RemoveAssetDialog component * chore: migrate to TS ReplaceMediaButton component * chore: migrate to TS AssetCard component * chore: migrate to TS AssetGridList * chore: migrate to TS PendingAssetStep component * chore: migrate to TS SelectedStep component * chore: migrate to TS PreviewBox component * chore: migrate to TS SelectTree * chore: migrate to TS SelectTree unit test * chore: migrate to TS BulkMoveDialog * chore: migrate to TS EditFolderContent component * chore: migrate to TS FilterValueInput * chore: migrato to TS CrumbSimpleMenuAsync * chore: migrate to TS Breadcrumbs * chore: migrate to TS Filters component * chore: migrate to TS EditAssetDialog * chore: migrate to TS CarouselAssets * chore: migrate to TS UploadAssetDialog and BrowseStep * chore: migrate to TS BrowseStep test * chore: migrate to TS AssetDialog component * chore: migrate to TS MediaLibraryDialog component * chore: migrate to TS MediaLibraryDialog component * chore: remove a useless type guard * chore: fix small stuff * chore: fix BulkMoveDialog unit test * chore: fix some types * chore: fix prettier problems * chore: fix review's comments * chore: fix review comments
178 lines
3.3 KiB
TypeScript
178 lines
3.3 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 FolderDefinition extends Omit<Folder, 'children' | 'files' | 'parent'> {
|
|
children?: {
|
|
count: number;
|
|
};
|
|
createdAt?: string;
|
|
documentId?: string;
|
|
files?: {
|
|
count: number;
|
|
};
|
|
folderUrl?: string;
|
|
isSelectable?: boolean;
|
|
locale?: string | null;
|
|
publishedAt?: string;
|
|
type: string;
|
|
updatedAt?: string;
|
|
}
|
|
|
|
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[];
|
|
};
|
|
|
|
type FolderNodeWithValue = Omit<FolderNode, 'children'> & {
|
|
value: string | number | null;
|
|
children: FolderNodeWithValue[];
|
|
};
|
|
|
|
/**
|
|
* 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 GetFolderStructure {
|
|
export interface Request {
|
|
query?: {};
|
|
}
|
|
|
|
export interface Response {
|
|
data: {
|
|
data: number[] & FolderNodeWithValue[];
|
|
};
|
|
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: FolderDefinition[];
|
|
};
|
|
};
|
|
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;
|
|
}
|
|
}
|