namespace Repository;

public interface IPushSubscriptionRepository : IBaseRepository<PushSubscription>
{
    Task<PushSubscription?> GetByEndpointAsync(string endpoint);
}

public class PushSubscriptionRepository(IFreeSql freeSql) : BaseRepository<PushSubscription>(freeSql), IPushSubscriptionRepository
{
    public async Task<PushSubscription?> GetByEndpointAsync(string endpoint)
    {
        return await FreeSql.Select<PushSubscription>()
            .Where(x => x.Endpoint == endpoint)
            .FirstAsync();
    }
}
