| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using Admin.NET.Plugin.AiDOP.Const.S8;
- using Admin.NET.Plugin.AiDOP.Infrastructure;
- using Admin.NET.Plugin.AiDOP.Infrastructure.S8;
- using Admin.NET.Plugin.AiDOP.Service.S8;
- namespace Admin.NET.Plugin.AiDOP.Controllers.S8;
- /// <summary>
- /// S8-RULE-GOVERNANCE-BATCH4:主动提报模板(只读)。
- ///
- /// <para>补回 Batch 3 误伤的能力:主动提报页依赖 <c>mechanism = MANUAL_REPORT</c> 的模板填表,
- /// 而那批把整个草稿 Controller 当成规则向导删掉了。这里只恢复只读的一半 ——
- /// <b>没有任何写动作,也没有"生成规则"</b>,建规则那条路仍然永久关闭。</para>
- ///
- /// <para>路由与类型都不再叫 draft / wizard:正是那个名字让两个不同用途的功能被当成了一个。</para>
- ///
- /// <para>权限用 <c>s8:config:read</c> 而非 <c>s8:config:watch-rule</c>:
- /// 它是提报表单的读取辅助,不是规则配置能力。</para>
- /// </summary>
- [ApiController]
- [Route("api/aidop/s8/config/report-templates")]
- [NonUnify]
- public class AdoS8ConfigReportTemplatesController : ControllerBase
- {
- private readonly S8ReportTemplateService _svc;
- private readonly S8TrustedScopeResolver _scope;
- public AdoS8ConfigReportTemplatesController(S8ReportTemplateService svc, S8TrustedScopeResolver scope)
- {
- _svc = svc;
- _scope = scope;
- }
- [HttpGet]
- [S8Permission(S8PermissionCatalog.ConfigRead)]
- public async Task<IActionResult> ListAsync()
- {
- try { return Ok(await _svc.ListAsync(await _scope.ResolveAsync())); }
- catch (S8BizException ex) { return BadRequest(new { message = ex.Message }); }
- }
- [HttpGet("{id:long}")]
- [S8Permission(S8PermissionCatalog.ConfigRead)]
- public async Task<IActionResult> GetAsync(long id)
- {
- try { return Ok(await _svc.GetAsync(id, await _scope.ResolveAsync())); }
- catch (S8NotFoundException) { return NotFound(); }
- catch (S8BizException ex) { return BadRequest(new { message = ex.Message }); }
- }
- }
|