| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using Admin.NET.Plugin.AiDOP.Dto.S8;
- using Admin.NET.Plugin.AiDOP.Service.S8;
- namespace Admin.NET.Plugin.AiDOP.Controllers.S8;
- [ApiController]
- [Route("api/aidop/s8/config/wizard-drafts")]
- [NonUnify]
- public class AdoS8ConfigDraftsController : ControllerBase
- {
- private readonly S8ConfigDraftService _svc;
- public AdoS8ConfigDraftsController(S8ConfigDraftService svc) => _svc = svc;
- [HttpGet]
- public async Task<IActionResult> ListAsync([FromQuery] AdoS8ConfigDraftListQueryDto query) =>
- Ok(await _svc.ListAsync(query));
- [HttpGet("{id:long}")]
- public async Task<IActionResult> GetAsync(long id)
- {
- try { return Ok(await _svc.GetAsync(id)); }
- catch (S8BizException ex) { return BadRequest(new { message = ex.Message }); }
- }
- [HttpPost]
- public async Task<IActionResult> CreateAsync([FromBody] AdoS8ConfigDraftCreateDto body)
- {
- try { return Ok(await _svc.CreateAsync(body)); }
- catch (S8BizException ex) { return BadRequest(new { message = ex.Message }); }
- }
- [HttpPut("{id:long}")]
- public async Task<IActionResult> UpdateAsync(long id, [FromBody] AdoS8ConfigDraftUpdateDto body)
- {
- try { return Ok(await _svc.UpdateAsync(id, body)); }
- catch (S8BizException ex) { return BadRequest(new { message = ex.Message }); }
- }
- [HttpDelete("{id:long}")]
- public async Task<IActionResult> DeleteAsync(long id)
- {
- try
- {
- await _svc.DeleteAsync(id);
- return Ok(new { id, deleted = true });
- }
- catch (S8BizException ex) { return BadRequest(new { message = ex.Message }); }
- }
- [HttpPost("{id:long}/generate-rule")]
- public async Task<IActionResult> GenerateRuleAsync(long id, [FromBody] AdoS8ConfigDraftGenerateRuleDto body)
- {
- try { return Ok(await _svc.GenerateRuleAsync(id, body)); }
- catch (S8BizException ex) { return BadRequest(new { message = ex.Message }); }
- }
- }
|