I broke the Db I guess?
This commit is contained in:
parent
b8df0d8b06
commit
1ee97675b0
59 changed files with 149 additions and 93 deletions
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using EllieBot.Db.Models;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using LinqToDB.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using EllieBot.Services.Database.Models;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using EllieBot.Services.Database.Models;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using LinqToDB;
|
||||
using LinqToDB.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using LinqToDB;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using EllieBot.Services.Database.Models;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using EllieBot.Services.Database.Models;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using EllieBot.Services.Database.Models;
|
||||
|
||||
|
@ -8,7 +8,7 @@ public static class MusicPlaylistExtensions
|
|||
{
|
||||
public static List<MusicPlaylist> GetPlaylistsOnPage(this DbSet<MusicPlaylist> playlists, int num)
|
||||
{
|
||||
if (num < 0)
|
||||
if (num < 1)
|
||||
throw new ArgumentOutOfRangeException(nameof(num));
|
||||
|
||||
return playlists.AsQueryable().Skip((num - 1) * 20).Take(20).Include(pl => pl.Songs).ToList();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using EllieBot.Services.Database;
|
||||
using EllieBot.Services.Database.Models;
|
||||
|
@ -20,6 +20,12 @@ public static class PollExtensions
|
|||
if (p.Votes is not null)
|
||||
{
|
||||
ctx.RemoveRange(p.Votes);
|
||||
p.Votes.Clear();
|
||||
}
|
||||
|
||||
if (p.Answers is not null)
|
||||
{
|
||||
ctx.RemoveRange(p.Answers);
|
||||
p.Answers.Clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using EllieBot.Services.Database.Models;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using EllieBot.Services.Database.Models;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using LinqToDB;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using EllieBot.Services.Database;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using LinqToDB;
|
||||
using LinqToDB.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using EllieBot.Services.Database.Models;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class AntiRaidSetting : DbEntity
|
||||
|
@ -11,10 +11,10 @@ public class AntiRaidSetting : DbEntity
|
|||
public PunishmentAction Action { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Duration of the punishment, in minutes. This works only in supported Actions, like:
|
||||
/// Mute, ChatMute, VoiceMute, etc...
|
||||
/// Duration of the punishment, in minutes. This works only for supported Actions, like:
|
||||
/// Mute, Chatmute, Voicemute, etc...
|
||||
/// </summary>
|
||||
public int PunishmentDuration { get; set; }
|
||||
public int PunishDuration { get; set; }
|
||||
}
|
||||
|
||||
public class AntiSpamSetting : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class AutoCommand : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using EllieBot.Services.Database.Models;
|
||||
using EllieBot.Services.Database.Models;
|
||||
|
||||
namespace EllieBot.Db.Models;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class AutoTranslateChannel : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class AutoTranslateUser : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class BanTemplate : DbEntity
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class BlacklistEntry : DbEntity
|
||||
|
|
|
@ -9,7 +9,7 @@ public class ClubInfo : DbEntity
|
|||
[MaxLength(20)]
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ImageUrl { get; set; }
|
||||
public string ImageUrl { get; set; } = string.Empty;
|
||||
|
||||
public int Xp { get; set; } = 0;
|
||||
public int? OwnerId { get; set; }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class CommandAlias : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class CommandCooldown : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class DelMsgOnCmdChannel : DbEntity
|
||||
|
|
|
@ -11,9 +11,10 @@ public class EllieExpression : DbEntity
|
|||
public bool DmResponse { get; set; }
|
||||
public bool ContainsAnywhere { get; set; }
|
||||
public bool AllowTarget { get; set; }
|
||||
public string Reactions { get; set; }
|
||||
|
||||
public string[] GetReactions()
|
||||
=> string.IsNullOrWhiteSpace(Reaactions) ? Array.Empty<string>() : Reaactions.Split("@@@");
|
||||
=> string.IsNullOrWhiteSpace(Reactions) ? Array.Empty<string>() : Reactions.Split("@@@");
|
||||
|
||||
public bool IsGlobal()
|
||||
=> GuildId is null or 0;
|
||||
|
|
49
src/EllieBot/Db/Models/Event.cs
Normal file
49
src/EllieBot/Db/Models/Event.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class CurrencyEvent
|
||||
{
|
||||
public enum Type
|
||||
{
|
||||
Reaction,
|
||||
|
||||
GameStatus
|
||||
//NotRaid,
|
||||
}
|
||||
|
||||
public ulong ServerId { get; set; }
|
||||
public ulong ChannelId { get; set; }
|
||||
public ulong MessageId { get; set; }
|
||||
public Type EventType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Amount of currency that the user will be rewarded.
|
||||
/// </summary>
|
||||
public long Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Maximum amount of currency that can be handed out.
|
||||
/// </summary>
|
||||
public long PotSize { get; set; }
|
||||
|
||||
public List<AwardedUser> AwardedUsers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used as extra data storage for events which need it.
|
||||
/// </summary>
|
||||
public ulong ExtraId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// May be used for some future event.
|
||||
/// </summary>
|
||||
public ulong ExtraId2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// May be used for some future event.
|
||||
/// </summary>
|
||||
public string ExtraString { get; set; }
|
||||
}
|
||||
|
||||
public class AwardedUser
|
||||
{
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class FeedSub : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class FilterChannelId : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class FilterLinksChannelId : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class FilteredWord : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using EllieBot.Modules.Searches.Common;
|
||||
using EllieBot.Services.Database.Models;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class GCChannelId : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class GroupName : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using EllieBot.Db.Models;
|
||||
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
|
|
@ -26,10 +26,10 @@ public class LogSetting : DbEntity
|
|||
|
||||
public ulong? UserMutedId { get; set; }
|
||||
|
||||
// userpresence
|
||||
//userpresence
|
||||
public ulong? LogUserPresenceId { get; set; }
|
||||
|
||||
// voicepresence
|
||||
//voicepresence
|
||||
|
||||
public ulong? LogVoicePresenceId { get; set; }
|
||||
public ulong? LogVoicePresenceTTSId { get; set; }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class MutedUserId : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Db.Models;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
|
||||
[DebuggerDisplay("{PrimaryTarget}{SecondaryTarget} {SecondaryTargetName} {State} {PrimaryTargetId}")]
|
||||
public class Permissionv2 : DbEntity, IIndexed
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public enum ShopEntryType
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class SlowmodeIgnoredRole : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class SlowmodeIgnoredUser : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using EllieBot.Services.Database.Models;
|
||||
|
||||
namespace EllieBot.Db.Models;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class StreamRoleSettings : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class UnbanTimer : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class UnmuteTimer : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class UnroleTimer : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class VcRoleInfo : DbEntity
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class WaifuItem
|
||||
public class WaifuItem : DbEntity
|
||||
{
|
||||
public WaifuInfo WaifuInfo { get; set; }
|
||||
public int? WaifuInfoId { get; set; }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public enum WarnExpireAction
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class WarningPunishment : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services.Database.Models;
|
||||
|
||||
public class XpSettings : DbEntity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable warnings
|
||||
using EllieBot.Services.Database.Models;
|
||||
|
||||
namespace EllieBot.Db.Models;
|
|
@ -1,4 +1,4 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using EllieBot.Db.Models;
|
||||
|
||||
namespace EllieBot.Services.Database;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace EllieBot.Services.Database;
|
||||
|
||||
public class PostgreSqlContext : EllieContext
|
||||
public sealed class PostgreSqlContext : EllieContext
|
||||
{
|
||||
private readonly string _connStr;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace EllieBot.Services.Database;
|
||||
|
|
Loading…
Reference in a new issue