using EnablementBLL.ShowRule; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace EnablementSL.Endpoints.ShowRule { // GetShowRuleList (the Show-authoring screen's list endpoint) ignores its ShowId // param and returns every TSHOWRULE row regardless of owner (pre-existing bug, // out of scope here) — now that TSHOWRULE is 3-way polymorphic (Show, Channel, or // Space owned, see V005/V008 migrations), reusing it for Space rules would mix all // three owners together in the FE grid. This is a separate, correctly-filtered // endpoint for the ShowSpaceRule authoring screen instead. public class GetShowRuleListForSpace : BaseEndpoint> { private readonly IShowRuleBLL _showRuleBLL; public GetShowRuleListForSpace(IShowRuleBLL showRuleBLL) { _showRuleBLL = showRuleBLL; } public override void Configure() { Get("/Enablement/GetShowRuleListForSpace"); AllowAnonymous(); } public record GetShowRuleListForSpaceParameters( [property: FromHeader] string Login, [property: QueryParam] int SpaceId ); protected override async Task> ExecuteAsync( GetShowRuleListForSpaceParameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _showRuleBLL.GetShowRulesForSpaceAsync(req.SpaceId, loginDTO, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.NOT_REQUIRED, loginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError( ex, CacheKeyLevel.NOT_REQUIRED, loginDTO, ex.Message, 500); } } } }