I broke the Db I guess?

This commit is contained in:
Toastie (DCS Team) 2024-04-14 23:36:32 +12:00
parent b8df0d8b06
commit 1ee97675b0
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
59 changed files with 149 additions and 93 deletions

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
using Microsoft.EntityFrameworkCore;
using EllieBot.Db.Models;

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
using LinqToDB.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using EllieBot.Services.Database.Models;
@ -12,9 +12,9 @@ public static class CurrencyTransactionExtensions
ulong userId,
int page)
=> set.ToLinqToDBTable()
.Where(x => x.UserId == userId)
.OrderByDescending(x => x.DateAdded)
.Skip(15 * page)
.Take(15)
.ToListAsyncLinqToDB();
.Where(x => x.UserId == userId)
.OrderByDescending(x => x.DateAdded)
.Skip(15 * page)
.Take(15)
.ToListAsyncLinqToDB();
}

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
using Microsoft.EntityFrameworkCore;
using EllieBot.Services.Database.Models;

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
using LinqToDB;
using LinqToDB.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
using LinqToDB;
using Microsoft.EntityFrameworkCore;
using EllieBot.Services.Database.Models;

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
using Microsoft.EntityFrameworkCore;
using EllieBot.Services.Database.Models;

View file

@ -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();

View file

@ -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();
}

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
using Microsoft.EntityFrameworkCore;
using EllieBot.Services.Database.Models;

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
using Microsoft.EntityFrameworkCore;
using EllieBot.Services.Database.Models;

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
using LinqToDB;
using Microsoft.EntityFrameworkCore;
using EllieBot.Services.Database;

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
using LinqToDB;
using LinqToDB.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
using Microsoft.EntityFrameworkCore;
using EllieBot.Services.Database.Models;

View file

@ -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

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class AutoCommand : DbEntity

View file

@ -1,4 +1,4 @@
using EllieBot.Services.Database.Models;
using EllieBot.Services.Database.Models;
namespace EllieBot.Db.Models;

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class AutoTranslateChannel : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class AutoTranslateUser : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class BanTemplate : DbEntity

View file

@ -1,3 +1,4 @@
#nullable disable
namespace EllieBot.Services.Database.Models;
public class BlacklistEntry : DbEntity

View file

@ -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; }

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class CommandAlias : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class CommandCooldown : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class DelMsgOnCmdChannel : DbEntity

View file

@ -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;

View 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
{
}

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class FeedSub : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class FilterChannelId : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class FilterLinksChannelId : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class FilteredWord : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
using EllieBot.Modules.Searches.Common;
using EllieBot.Services.Database.Models;

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class GCChannelId : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class GroupName : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
using EllieBot.Db.Models;
namespace EllieBot.Services.Database.Models;

View file

@ -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; }

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class MutedUserId : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Db.Models;
/// <summary>

View file

@ -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
{

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public enum ShopEntryType

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class SlowmodeIgnoredRole : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class SlowmodeIgnoredUser : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
using EllieBot.Services.Database.Models;
namespace EllieBot.Db.Models;

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class StreamRoleSettings : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class UnbanTimer : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class UnmuteTimer : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class UnroleTimer : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class VcRoleInfo : DbEntity

View file

@ -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; }

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public enum WarnExpireAction

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class WarningPunishment : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable
namespace EllieBot.Services.Database.Models;
public class XpSettings : DbEntity

View file

@ -1,4 +1,4 @@
#nullable disable
#nullable disable warnings
using EllieBot.Services.Database.Models;
namespace EllieBot.Db.Models;

View file

@ -1,4 +1,4 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using EllieBot.Db.Models;
namespace EllieBot.Services.Database;

View file

@ -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;

View file

@ -1,4 +1,4 @@
using Microsoft.Data.Sqlite;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
namespace EllieBot.Services.Database;