StorageController.ts 1.24 KB
import { AxiosResponse, AxiosStatic } from "axios";
// region 前端扩展导入包
// endregion

/**
 * @author kepler
 */
export const StorageController = {
	/**
	 */
	removeVehicleAlbum(axios: AxiosStatic, filePath: string, vehicleId: number): Promise<AxiosResponse<void>> {
		return axios.delete("upload/removeVehicleAlbum", { params: { filePath, vehicleId } });
	},

	/**
	 * 更新车辆图片
	 * @param vehicle
	 * @return int
	 */
	updateVehicleAlbums(axios: AxiosStatic, vehicle: any): Promise<AxiosResponse<number>> {
		return axios.post("upload/updateVehicleAlbums", vehicle);
	},

	/**
	 * 富文本图片上传
	 * @param file
	 * @param request
	 * @return Map
	 * @throws FileStorageException
	 */
	uploadPasteImage(axios: AxiosStatic, file: any): Promise<AxiosResponse<any>> {
		return axios.post("upload/uploadRichTextImage", null, { params: { file } });
	},

	/**
	 */
	uploadVehicleAlbum(
		axios: AxiosStatic,
		file: any,
		vehicleId: number,
		fileSubtype: string,
		directory: string,
		cache: boolean | null | undefined,
	): Promise<AxiosResponse<FileInfo>> {
		return axios.post("upload/uploadVehicleAlbum", null, {
			params: { file, vehicleId, fileSubtype, directory, cache },
		});
	},

	// region 前端扩展代码区
	// endregion
};