This repository has been archived on 2024-12-22. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
elliebot/src/EllieBot/Db/Models/ShopEntry.cs
Toastie 29c0b4acfc
Updated Db models
I hate working on database stuff
2024-06-14 00:20:21 +12:00

46 lines
No EOL
998 B
C#

#nullable disable
namespace EllieBot.Db.Models;
public enum ShopEntryType
{
Role,
List,
Command
}
public class ShopEntry : DbEntity, IIndexed
{
public int Index { get; set; }
public int Price { get; set; }
public string Name { get; set; }
public ulong AuthorId { get; set; }
public ShopEntryType Type { get; set; }
//role
public string RoleName { get; set; }
public ulong RoleId { get; set; }
//list
public HashSet<ShopEntryItem> Items { get; set; } = new();
public ulong? RoleRequirement { get; set; }
// command
public string Command { get; set; }
}
public class ShopEntryItem : DbEntity
{
public string Text { get; set; }
public override bool Equals(object obj)
{
if (obj is null || GetType() != obj.GetType())
return false;
return ((ShopEntryItem)obj).Text == Text;
}
public override int GetHashCode()
=> Text.GetHashCode(StringComparison.InvariantCulture);
}