package cn.reghao.autodop.dmaster.app.controller.config;

import cn.reghao.autodop.dmaster.app.service.config.BuildDirService;
import cn.reghao.autodop.dmaster.app.model.po.config.build.BuildDir;
import cn.reghao.jdkutil.result.Result;
import cn.reghao.jdkutil.result.WebBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author reghao
 * @date 2019-08-30 18:49:15
 */
@Slf4j
@Api(tags = "构建目录配置接口")
@RestController
@RequestMapping("/api/app/config/build/dir")
public class BuildDirController {
    private final BuildDirService buildDirService;

    public BuildDirController(BuildDirService buildDirService) {
        this.buildDirService = buildDirService;
    }

    @ApiOperation(value = "迁移构建目录")
    @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
    public String modifyBuildDir(@Validated BuildDir buildDir) {
        Result result = buildDirService.modify(buildDir);
        return WebBody.result(result);
    }
}
