mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
Removed remind repository
This commit is contained in:
@@ -10,7 +10,6 @@ namespace NadekoBot.Core.Services.Database
|
||||
|
||||
IQuoteRepository Quotes { get; }
|
||||
IGuildConfigRepository GuildConfigs { get; }
|
||||
IReminderRepository Reminders { get; }
|
||||
ICustomReactionRepository CustomReactions { get; }
|
||||
IMusicPlaylistRepository MusicPlaylists { get; }
|
||||
IWaifuRepository Waifus { get; }
|
||||
|
@@ -1,11 +0,0 @@
|
||||
using NadekoBot.Core.Services.Database.Models;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NadekoBot.Core.Services.Database.Repositories
|
||||
{
|
||||
public interface IReminderRepository : IRepository<Reminder>
|
||||
{
|
||||
IEnumerable<Reminder> GetIncludedReminders(IEnumerable<ulong> guildIds);
|
||||
IEnumerable<Reminder> RemindersFor(ulong userId, int page);
|
||||
}
|
||||
}
|
@@ -3,26 +3,20 @@ using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace NadekoBot.Core.Services.Database.Repositories.Impl
|
||||
namespace NadekoBot.Modules.Utility.Common
|
||||
{
|
||||
public class ReminderRepository : Repository<Reminder>, IReminderRepository
|
||||
public static class ReminderExtensions
|
||||
{
|
||||
public ReminderRepository(DbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
public static IEnumerable<Reminder> GetIncludedReminders(this DbSet<Reminder> reminders, IEnumerable<ulong> guildIds)
|
||||
=> reminders.AsQueryable()
|
||||
.Where(x => guildIds.Contains(x.ServerId) || x.ServerId == 0)
|
||||
.ToList();
|
||||
|
||||
public IEnumerable<Reminder> GetIncludedReminders(IEnumerable<ulong> guildIds)
|
||||
{
|
||||
return _set.AsQueryable().Where(x => guildIds.Contains(x.ServerId) || x.ServerId == 0).ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<Reminder> RemindersFor(ulong userId, int page)
|
||||
{
|
||||
return _set.AsQueryable()
|
||||
public static IEnumerable<Reminder> RemindersFor(this DbSet<Reminder> reminders, ulong userId, int page)
|
||||
=> reminders.AsQueryable()
|
||||
.Where(x => x.UserId == userId)
|
||||
.OrderBy(x => x.DateAdded)
|
||||
.Skip(page * 10)
|
||||
.Take(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -15,9 +15,6 @@ namespace NadekoBot.Core.Services.Database
|
||||
private IGuildConfigRepository _guildConfigs;
|
||||
public IGuildConfigRepository GuildConfigs => _guildConfigs ?? (_guildConfigs = new GuildConfigRepository(_context));
|
||||
|
||||
private IReminderRepository _reminders;
|
||||
public IReminderRepository Reminders => _reminders ?? (_reminders = new ReminderRepository(_context));
|
||||
|
||||
private IMusicPlaylistRepository _musicPlaylists;
|
||||
public IMusicPlaylistRepository MusicPlaylists => _musicPlaylists ?? (_musicPlaylists = new MusicPlaylistRepository(_context));
|
||||
|
||||
|
Reference in New Issue
Block a user