2026-01-02 12:25:44 +08:00
|
|
|
|
namespace Repository;
|
|
|
|
|
|
|
2026-01-04 16:59:34 +08:00
|
|
|
|
public interface IPushSubscriptionRepository : IBaseRepository<PushSubscription>
|
2026-01-02 12:25:44 +08:00
|
|
|
|
{
|
2026-01-04 16:59:34 +08:00
|
|
|
|
Task<PushSubscription?> GetByEndpointAsync(string endpoint);
|
2026-01-02 12:25:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-04 16:59:34 +08:00
|
|
|
|
public class PushSubscriptionRepository(IFreeSql freeSql) : BaseRepository<PushSubscription>(freeSql), IPushSubscriptionRepository
|
2026-01-02 12:25:44 +08:00
|
|
|
|
{
|
2026-01-04 16:59:34 +08:00
|
|
|
|
public async Task<PushSubscription?> GetByEndpointAsync(string endpoint)
|
2026-01-02 12:25:44 +08:00
|
|
|
|
{
|
2026-01-04 16:59:34 +08:00
|
|
|
|
return await FreeSql.Select<PushSubscription>()
|
2026-01-02 12:25:44 +08:00
|
|
|
|
.Where(x => x.Endpoint == endpoint)
|
|
|
|
|
|
.FirstAsync();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|