package com.xunwang.file.controller;

import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.xunwang.servicebase.utils.R;
import com.xunwang.file.util.MinioUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@ApiSupport(author = "Long")
@Api("文件相关")
@RestController
@RequestMapping("/file")
public class FileUpload {

    @Resource
    private MinioUtil minioUtil;

    @PostMapping("/uploading")
    public R uploading(@RequestParam("file") MultipartFile file) {
        String upload = minioUtil.upload(file);
        return R.ok().data("url", upload);
    }

}
