using Admin.NET.Plugin.AiDOP.DataPlatform.FileImport; using Microsoft.AspNetCore.Http; namespace Admin.NET.Plugin.AiDOP.Controllers; [ApiController] [Route("api/DataPlatform/file-imports")] [Authorize] [NonUnify] public class MdpFileImportController : ControllerBase { private readonly MdpExcelImportService _service; public MdpFileImportController(MdpExcelImportService service) => _service = service; [HttpGet("entities")] public Task Entities(CancellationToken ct) => _service.ListEntitiesAsync(ct); [HttpGet("template/{entityCode}")] public Task Template(string entityCode, CancellationToken ct) => _service.TemplateAsync(entityCode, ct); [HttpPost("validate")] public Task Validate(IFormFile file, [FromQuery] string entityCode, [FromQuery] long factoryId = 0, CancellationToken ct = default) => _service.ValidateAsync(file, entityCode, factoryId, ct); [HttpGet("{batchNo}")] public Task Get(string batchNo, CancellationToken ct) => _service.GetAsync(batchNo, ct); [HttpGet("{batchNo}/errors")] public Task Errors(string batchNo, CancellationToken ct) => _service.ErrorsAsync(batchNo, ct); [HttpPost("{batchNo}/commit")] public Task Commit(string batchNo, CancellationToken ct) => _service.CommitAsync(batchNo, ct); [HttpPost("{batchNo}/void")] public Task Void(string batchNo, CancellationToken ct) => _service.VoidAsync(batchNo, ct); [HttpPost("{batchNo}/rollback")] public Task Rollback(string batchNo, CancellationToken ct) => _service.RollbackAsync(batchNo, ct); }