.tesar now has groups!
This commit is contained in:
@ -4,5 +4,7 @@
|
||||
{
|
||||
public ulong GuildId { get; set; }
|
||||
public ulong RoleId { get; set; }
|
||||
|
||||
public int Group { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -177,6 +177,10 @@ namespace NadekoBot.Core.Services.Database
|
||||
.HasIndex(s => new { s.GuildId, s.RoleId })
|
||||
.IsUnique();
|
||||
|
||||
selfassignableRolesEntity
|
||||
.Property(x => x.Group)
|
||||
.HasDefaultValue(0);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Currency
|
||||
|
@ -1,11 +1,12 @@
|
||||
using NadekoBot.Core.Services.Database.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace NadekoBot.Core.Services.Database.Repositories
|
||||
{
|
||||
public interface ISelfAssignedRolesRepository : IRepository<SelfAssignedRole>
|
||||
{
|
||||
bool DeleteByGuildAndRoleId(ulong guildId, ulong roleId);
|
||||
IEnumerable<SelfAssignedRole> GetFromGuild(ulong guildId);
|
||||
IEnumerable<IGrouping<int, SelfAssignedRole>> GetFromGuild(ulong guildId);
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,9 @@ namespace NadekoBot.Core.Services.Database.Repositories.Impl
|
||||
return true;
|
||||
}
|
||||
|
||||
public IEnumerable<SelfAssignedRole> GetFromGuild(ulong guildId) =>
|
||||
_set.Where(s => s.GuildId == guildId).ToList();
|
||||
public IEnumerable<IGrouping<int, SelfAssignedRole>> GetFromGuild(ulong guildId)
|
||||
=> _set.Where(s => s.GuildId == guildId)
|
||||
.AsEnumerable()
|
||||
.GroupBy(x => x.Group);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user