mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-04 00:34:26 -05:00 
			
		
		
		
	Removed sar repository
This commit is contained in:
		@@ -11,7 +11,6 @@ namespace NadekoBot.Core.Services.Database
 | 
			
		||||
        IQuoteRepository Quotes { get; }
 | 
			
		||||
        IGuildConfigRepository GuildConfigs { get; }
 | 
			
		||||
        IReminderRepository Reminders { get; }
 | 
			
		||||
        ISelfAssignedRolesRepository SelfAssignedRoles { 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 ISelfAssignedRolesRepository : IRepository<SelfAssignedRole>
 | 
			
		||||
    {
 | 
			
		||||
        bool DeleteByGuildAndRoleId(ulong guildId, ulong roleId);
 | 
			
		||||
        IEnumerable<SelfAssignedRole> GetFromGuild(ulong guildId);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,26 @@
 | 
			
		||||
using NadekoBot.Core.Services.Database.Models;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Modules.Administration.Common
 | 
			
		||||
{
 | 
			
		||||
    public static class SelfAssignableRolesExtensions
 | 
			
		||||
    {
 | 
			
		||||
        public static bool DeleteByGuildAndRoleId(this DbSet<SelfAssignedRole> roles, ulong guildId, ulong roleId)
 | 
			
		||||
        {
 | 
			
		||||
            var role = roles.FirstOrDefault(s => s.GuildId == guildId && s.RoleId == roleId);
 | 
			
		||||
 | 
			
		||||
            if (role == null)
 | 
			
		||||
                return false;
 | 
			
		||||
 | 
			
		||||
            roles.Remove(role);
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static IEnumerable<SelfAssignedRole> GetFromGuild(this DbSet<SelfAssignedRole> roles, ulong guildId) 
 | 
			
		||||
            =>  roles.AsQueryable()
 | 
			
		||||
                    .Where(s => s.GuildId == guildId)
 | 
			
		||||
                    .ToArray();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,30 +0,0 @@
 | 
			
		||||
using NadekoBot.Core.Services.Database.Models;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Core.Services.Database.Repositories.Impl
 | 
			
		||||
{
 | 
			
		||||
    public class SelfAssignedRolesRepository : Repository<SelfAssignedRole>, ISelfAssignedRolesRepository
 | 
			
		||||
    {
 | 
			
		||||
        public SelfAssignedRolesRepository(DbContext context) : base(context)
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool DeleteByGuildAndRoleId(ulong guildId, ulong roleId)
 | 
			
		||||
        {
 | 
			
		||||
            var role = _set.FirstOrDefault(s => s.GuildId == guildId && s.RoleId == roleId);
 | 
			
		||||
 | 
			
		||||
            if (role == null)
 | 
			
		||||
                return false;
 | 
			
		||||
 | 
			
		||||
            _set.Remove(role);
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public IEnumerable<SelfAssignedRole> GetFromGuild(ulong guildId) 
 | 
			
		||||
            =>  _set.AsQueryable()
 | 
			
		||||
                    .Where(s => s.GuildId == guildId)
 | 
			
		||||
                    .ToArray();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -18,9 +18,6 @@ namespace NadekoBot.Core.Services.Database
 | 
			
		||||
        private IReminderRepository _reminders;
 | 
			
		||||
        public IReminderRepository Reminders => _reminders ?? (_reminders = new ReminderRepository(_context));
 | 
			
		||||
 | 
			
		||||
        private ISelfAssignedRolesRepository _selfAssignedRoles;
 | 
			
		||||
        public ISelfAssignedRolesRepository SelfAssignedRoles => _selfAssignedRoles ?? (_selfAssignedRoles = new SelfAssignedRolesRepository(_context));
 | 
			
		||||
 | 
			
		||||
        private IMusicPlaylistRepository _musicPlaylists;
 | 
			
		||||
        public IMusicPlaylistRepository MusicPlaylists => _musicPlaylists ?? (_musicPlaylists = new MusicPlaylistRepository(_context));
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user