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; /// /// S8-RULE-GOVERNANCE-BATCH4:主动提报模板(只读)。 /// /// 补回 Batch 3 误伤的能力:主动提报页依赖 mechanism = MANUAL_REPORT 的模板填表, /// 而那批把整个草稿 Controller 当成规则向导删掉了。这里只恢复只读的一半 —— /// 没有任何写动作,也没有"生成规则",建规则那条路仍然永久关闭。 /// /// 路由与类型都不再叫 draft / wizard:正是那个名字让两个不同用途的功能被当成了一个。 /// /// 权限用 s8:config:read 而非 s8:config:watch-rule: /// 它是提报表单的读取辅助,不是规则配置能力。 /// [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 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 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 }); } } }