package com.ghb.base.modules.test.seata.product.controller;

import com.ghb.base.common.api.vo.Result;
import com.ghb.base.modules.test.seata.product.service.SeataProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.servlet.http.HttpServletRequest;
import java.math.BigDecimal;

/**
 * @author zyf
 */
@RestController
@RequestMapping("/test/seata/product")
public class SeataProductController {

    @Autowired
    private SeataProductService seataProductService;

    @PostMapping("/reduceStock")
    public Result<BigDecimal> reduceStock(Long productId, Integer count, HttpServletRequest request) {
        return seataProductService.reduceStock(productId, count);
    }
}
