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