package com.quanxiaoha.cms.controller;

import com.quanxiaoha.cms.common.EditorMdUploadImageResponse;
import com.quanxiaoha.cms.model.vo.UploadImageFormVO;
import com.quanxiaoha.cms.service.FileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文章
 *
 * @Author: 犬小哈
 * @Date: 2020/10/26 12:54 下午
 * @Version: 1.0.0
 **/
@RestController
@Controller
@Slf4j
public class FileController {

    @Autowired
    private FileService fileService;

    /**
     * 文件上传
     *
     * @return
     */
    @PostMapping("/manage/file/upload")
    public EditorMdUploadImageResponse editorMdImageUpload(@RequestParam(value = "editormd-image-file") MultipartFile file, UploadImageFormVO uploadImageFormVO) {
        return fileService.uploadFile(file, uploadImageFormVO);
    }


}