minor adjustments
This commit is contained in:
parent
463cb893e8
commit
c92d13797f
@ -1,5 +1,6 @@
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using Dapper;
|
using Dapper;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Newsbot.Collector.Domain.Interfaces;
|
using Newsbot.Collector.Domain.Interfaces;
|
||||||
using Newsbot.Collector.Domain.Entities;
|
using Newsbot.Collector.Domain.Entities;
|
||||||
@ -60,6 +61,16 @@ public class DiscordWebhooksTable : IDiscordWebHooksRepository
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DiscordWebhookEntity> ListByUserId(string userId, int page)
|
||||||
|
{
|
||||||
|
var query = _context.DiscordWebhooks
|
||||||
|
.Where(p => p.UserId != null && p.UserId.Equals(userId))
|
||||||
|
.Skip(page * 25)
|
||||||
|
.Take(25)
|
||||||
|
.ToList();
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
public List<DiscordWebhookEntity> ListByServer(string server, int limit = 25)
|
public List<DiscordWebhookEntity> ListByServer(string server, int limit = 25)
|
||||||
{
|
{
|
||||||
//using var context = new DatabaseContext(_connectionString);
|
//using var context = new DatabaseContext(_connectionString);
|
||||||
|
@ -19,7 +19,8 @@ public class UserSourceSubscriptionTable : IUserSourceSubscription
|
|||||||
|
|
||||||
public List<UserSourceSubscriptionEntity> ListUserSubscriptions(Guid userId)
|
public List<UserSourceSubscriptionEntity> ListUserSubscriptions(Guid userId)
|
||||||
{
|
{
|
||||||
var results =_context.UserSourceSubscription.Where(i => i.UserId.Equals(userId)).ToList();
|
var results =_context.UserSourceSubscription
|
||||||
|
.Where(i => i.UserId != null && i.UserId.Equals(userId)).ToList();
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ public interface IDiscordWebHooksRepository
|
|||||||
DiscordWebhookEntity GetByUrl(string url);
|
DiscordWebhookEntity GetByUrl(string url);
|
||||||
|
|
||||||
List<DiscordWebhookEntity> List(int page, int count = 25);
|
List<DiscordWebhookEntity> List(int page, int count = 25);
|
||||||
|
List<DiscordWebhookEntity> ListByUserId(string userId, int page);
|
||||||
List<DiscordWebhookEntity> ListByServer(string server, int limit);
|
List<DiscordWebhookEntity> ListByServer(string server, int limit);
|
||||||
List<DiscordWebhookEntity> ListByServerAndChannel(string server, string channel, int limit);
|
List<DiscordWebhookEntity> ListByServerAndChannel(string server, string channel, int limit);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user