using EnablementBLL.ShowChannel; using EnablementDAL.DTO; using EnablementSL.Parameters.ShowChannelSubscription; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; namespace EnablementSL.Endpoints.ShowChannelSubscription; // Admin force-subscribe/lock — writes SubscriptionSource=AdminForced, distinct from the // user's own SetChannelSubscription (SubscriptionSource=Self). public class ForceChannelSubscription : BaseEndpoint> { private readonly IShowChannelSubscriptionBLL _bll; public ForceChannelSubscription(IShowChannelSubscriptionBLL bll) => _bll = bll; public override void Configure() { Post("/Enablement/ForceChannelSubscription"); AllowAnonymous(); } protected override string? GetCacheKey(ForceChannelSubscriptionParameters req, LoginDTO login) => null; protected override async Task> ExecuteAsync( ForceChannelSubscriptionParameters req, LoginDTO login, CancellationToken ct) { var dto = new ForceChannelSubscriptionDTO { ChannelId = req.ChannelId, UserId = req.UserId, IsSubscribed = req.IsSubscribed, IsLocked = req.IsLocked }; return await _bll.ForceSubscriptionAsync(dto, login, ct).ConfigureAwait(false); } }