PlotDirector/PlotLine/Services/SubscriptionServices.cs
2026-06-07 10:13:16 +01:00

24 lines
910 B
C#

using PlotLine.Data;
using PlotLine.Models;
namespace PlotLine.Services;
public interface ISubscriptionService
{
Task<UserSubscriptionDetail?> GetCurrentSubscriptionAsync(int userId);
Task<SubscriptionLevel?> GetSubscriptionLevelAsync(int subscriptionLevelId);
Task<IReadOnlyList<SubscriptionLevel>> GetActiveSubscriptionLevelsAsync();
}
public sealed class SubscriptionService(ISubscriptionRepository subscriptions) : ISubscriptionService
{
public Task<UserSubscriptionDetail?> GetCurrentSubscriptionAsync(int userId) =>
subscriptions.GetCurrentSubscriptionAsync(userId);
public Task<SubscriptionLevel?> GetSubscriptionLevelAsync(int subscriptionLevelId) =>
subscriptions.GetSubscriptionLevelAsync(subscriptionLevelId);
public Task<IReadOnlyList<SubscriptionLevel>> GetActiveSubscriptionLevelsAsync() =>
subscriptions.GetActiveSubscriptionLevelsAsync();
}