2023-07-09 22:10:51 -07:00
|
|
|
using Newsbot.Collector.Domain.Entities;
|
|
|
|
using Newsbot.Collector.Domain.Interfaces;
|
|
|
|
|
|
|
|
namespace Newsbot.Collector.Database.Repositories;
|
|
|
|
|
|
|
|
public class UserSourceSubscriptionTable : IUserSourceSubscription
|
|
|
|
{
|
|
|
|
private DatabaseContext _context;
|
|
|
|
|
|
|
|
public UserSourceSubscriptionTable(string connectionString)
|
|
|
|
{
|
|
|
|
_context = new DatabaseContext(connectionString);
|
|
|
|
}
|
|
|
|
|
|
|
|
public UserSourceSubscriptionTable(DatabaseContext context)
|
|
|
|
{
|
|
|
|
_context = context;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<UserSourceSubscriptionEntity> ListUserSubscriptions(Guid userId)
|
|
|
|
{
|
2023-07-23 22:58:25 -07:00
|
|
|
var results =_context.UserSourceSubscription
|
|
|
|
.Where(i => i.UserId != null && i.UserId.Equals(userId)).ToList();
|
2023-07-09 22:10:51 -07:00
|
|
|
return results;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|