Moved Models to Shared Project
This commit is contained in:
parent
bae69648d0
commit
7533d5a704
19 changed files with 27 additions and 1 deletions
|
@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Authentication.Cookies;
|
|||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Lieb.Data
|
||||
namespace Lieb.Controllers
|
||||
{
|
||||
[Route("[controller]/[action]")] // Microsoft.AspNetCore.Mvc.Route
|
||||
public class AccountController : ControllerBase
|
|
@ -17,4 +17,8 @@
|
|||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
namespace Lieb.Models.GuildWars2
|
||||
{
|
||||
public class Equipped
|
||||
{
|
||||
public int EquippedId { get; set; }
|
||||
|
||||
public bool CanTank { get; set; }
|
||||
|
||||
public int GuildWars2AccountId { get; set; }
|
||||
public int GuildWars2BuildId { get; set; }
|
||||
public GuildWars2Account GuildWars2Account { get; set; }
|
||||
public GuildWars2Build GuildWars2Build { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Lieb.Models.GuildWars2
|
||||
{
|
||||
public class GuildWars2Account
|
||||
{
|
||||
public int GuildWars2AccountId { get; set; }
|
||||
|
||||
public string ApiKey { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[RegularExpression("^[a-zA-z ]{3,27}\\.[0-9]{4}$", ErrorMessage = "Invalid Account Name")]
|
||||
public string AccountName { get; set; } = string.Empty;
|
||||
|
||||
public ICollection<Equipped> EquippedBuilds { get; set; } = new List<Equipped>();
|
||||
|
||||
}
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Lieb.Models.GuildWars2
|
||||
{
|
||||
public enum Role
|
||||
{
|
||||
Might = 0,
|
||||
Quickness = 1,
|
||||
Alacrity = 2,
|
||||
Heal = 3,
|
||||
Tank = 4,
|
||||
pDps = 5,
|
||||
cDps = 6,
|
||||
}
|
||||
|
||||
public enum GuildWars2Class
|
||||
{
|
||||
Elementalist = 1,
|
||||
Engineer = 2,
|
||||
Thief = 3,
|
||||
Ranger = 4,
|
||||
Necromancer = 5,
|
||||
Mesmer = 6,
|
||||
Revenant = 7,
|
||||
Guard = 8,
|
||||
Warrior = 9,
|
||||
}
|
||||
|
||||
public enum EliteSpecialization
|
||||
{
|
||||
Elemantalist = 1,
|
||||
Tempest = 2,
|
||||
Weaver = 3,
|
||||
Catalyst = 4,
|
||||
Engineer = 5,
|
||||
Scrapper = 6,
|
||||
Holosmith = 7,
|
||||
Mechanist = 8,
|
||||
Thief = 9,
|
||||
DareDevil = 10,
|
||||
Deadeye = 11,
|
||||
Spectre = 12,
|
||||
Ranger = 13,
|
||||
Druid = 14,
|
||||
Soulbeast = 15,
|
||||
Untamed = 16,
|
||||
Necromancer = 17,
|
||||
Reaper = 18,
|
||||
Scourge = 19,
|
||||
Harbinger = 20,
|
||||
Mesmer = 21,
|
||||
Chronomancer = 22,
|
||||
Mirage = 23,
|
||||
Virtuoso = 24,
|
||||
Revenant = 25,
|
||||
Herald = 26,
|
||||
Renegade = 27,
|
||||
Vindicator = 28,
|
||||
Guard = 29,
|
||||
Dragonhunter = 30,
|
||||
Firebrand = 31,
|
||||
Willbender = 32,
|
||||
Warrior = 33,
|
||||
Berserker = 34,
|
||||
Spellbreaker = 35,
|
||||
Bladesworn = 36,
|
||||
}
|
||||
|
||||
public class GuildWars2Build
|
||||
{
|
||||
public int GuildWars2BuildId { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(60, ErrorMessage = "BuildName too long (60 character limit).")]
|
||||
public string BuildName { get; set; } = String.Empty;
|
||||
|
||||
public short Might { get; set; }
|
||||
public short Quickness { get; set; }
|
||||
public short Alacrity { get; set; }
|
||||
public short Heal { get; set; }
|
||||
|
||||
[Required]
|
||||
[Range(1, 9, ErrorMessage = "Please select a class")]
|
||||
public GuildWars2Class Class { get; set; }
|
||||
|
||||
[Required]
|
||||
[Range(1, 90, ErrorMessage = "Please select an elite specialization")]
|
||||
public EliteSpecialization EliteSpecialization { get; set; }
|
||||
|
||||
public ICollection<Equipped> EquippedRoles { get; set; } = new List<Equipped>();
|
||||
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
namespace Lieb.Models.GuildWars2.Raid
|
||||
{
|
||||
public class DiscordRaidMessage
|
||||
{
|
||||
public int DiscordRaidMessageId { get; set; }
|
||||
|
||||
public int RaidId { get; set; }
|
||||
|
||||
public Raid Raid { get; set; }
|
||||
|
||||
public ulong DiscordMessageId { get; set; }
|
||||
|
||||
public ulong DiscordChannelId { get; set; }
|
||||
|
||||
public ulong DiscordGuildId { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Lieb.Models.GuildWars2.Raid
|
||||
{
|
||||
public enum RaidType
|
||||
{
|
||||
Planned = 0,
|
||||
RandomWithBoons = 1,
|
||||
RandomClasses = 2,
|
||||
RandomEliteSpecialization = 3,
|
||||
}
|
||||
|
||||
public class Raid : RaidBase
|
||||
{
|
||||
public int RaidId { get; private set; }
|
||||
|
||||
[Required]
|
||||
public DateTimeOffset StartTimeUTC { get; set; } = DateTime.Now;
|
||||
|
||||
[Required]
|
||||
public DateTimeOffset EndTimeUTC { get; set; }
|
||||
|
||||
public DateTimeOffset FreeForAllTimeUTC { get; set; }
|
||||
|
||||
public ICollection<RaidSignUp> SignUps { get; set; } = new HashSet<RaidSignUp>();
|
||||
|
||||
public ICollection<RaidSignUpHistory> SignUpHistory { get; set; } = new HashSet<RaidSignUpHistory>();
|
||||
|
||||
public Raid() { }
|
||||
|
||||
public Raid(RaidTemplate template) : base(template)
|
||||
{
|
||||
TimeZoneInfo timeZone = TimeZoneInfo.FindSystemTimeZoneById(template.TimeZone);
|
||||
StartTimeUTC = TimeZoneInfo.ConvertTimeToUtc(template.StartTime, timeZone);
|
||||
EndTimeUTC = TimeZoneInfo.ConvertTimeToUtc(template.EndTime, timeZone);
|
||||
FreeForAllTimeUTC = TimeZoneInfo.ConvertTimeToUtc(template.FreeForAllTime, timeZone);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Lieb.Models.GuildWars2.Raid
|
||||
{
|
||||
public abstract class RaidBase
|
||||
{
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "Title too long (100 character limit).")]
|
||||
public string Title { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(1000, ErrorMessage = "Description too long (1000 character limit).")]
|
||||
public string Description { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(50, ErrorMessage = "Organizer too long (50 character limit).")]
|
||||
public string Organizer { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(50, ErrorMessage = "Guild too long (50 character limit).")]
|
||||
public string Guild { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(50, ErrorMessage = "VoiceChat too long (50 character limit).")]
|
||||
public string VoiceChat { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
public RaidType RaidType { get; set; }
|
||||
|
||||
public string RequiredRole { get; set; } = String.Empty;
|
||||
|
||||
public bool MoveFlexUsers { get; set; } = true;
|
||||
|
||||
public int RaidOwnerId { get; set; }
|
||||
|
||||
//role name, number of spots
|
||||
public ICollection<RaidRole> Roles { get; set; } = new HashSet<RaidRole>();
|
||||
|
||||
public ICollection<RaidReminder> Reminders { get; set; } = new List<RaidReminder>();
|
||||
|
||||
public ICollection<DiscordRaidMessage> DiscordRaidMessages { get; set; } = new HashSet<DiscordRaidMessage>();
|
||||
|
||||
public RaidBase() { }
|
||||
|
||||
public RaidBase(RaidBase template)
|
||||
{
|
||||
this.Title = template.Title;
|
||||
this.Description = template.Description;
|
||||
this.Organizer = template.Organizer;
|
||||
this.Guild = template.Guild;
|
||||
this.VoiceChat = template.VoiceChat;
|
||||
this.RaidType = template.RaidType;
|
||||
this.RequiredRole = template.RequiredRole;
|
||||
this.MoveFlexUsers = template.MoveFlexUsers;
|
||||
this.RaidOwnerId = template.RaidOwnerId;
|
||||
|
||||
foreach (RaidRole role in template.Roles)
|
||||
{
|
||||
this.Roles.Add(new RaidRole()
|
||||
{
|
||||
Description = role.Description,
|
||||
Name = role.Name,
|
||||
Spots = role.Spots
|
||||
});
|
||||
}
|
||||
foreach (RaidReminder reminder in template.Reminders)
|
||||
{
|
||||
this.Reminders.Add(new RaidReminder()
|
||||
{
|
||||
ChannelId = reminder.ChannelId,
|
||||
HoursBeforeRaid = reminder.HoursBeforeRaid,
|
||||
Message = reminder.Message,
|
||||
Sent = reminder.Sent,
|
||||
Type = reminder.Type
|
||||
});
|
||||
}
|
||||
foreach (DiscordRaidMessage message in template.DiscordRaidMessages)
|
||||
{
|
||||
this.DiscordRaidMessages.Add(new DiscordRaidMessage()
|
||||
{
|
||||
RaidId = message.RaidId,
|
||||
DiscordMessageId = message.DiscordMessageId,
|
||||
DiscordChannelId = message.DiscordChannelId,
|
||||
DiscordGuildId = message.DiscordGuildId
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Lieb.Models.GuildWars2.Raid
|
||||
{
|
||||
public class RaidReminder
|
||||
{
|
||||
public enum ReminderType
|
||||
{
|
||||
User = 1,
|
||||
Channel = 2
|
||||
}
|
||||
|
||||
public int RaidReminderId { get; set; }
|
||||
|
||||
[Required]
|
||||
[Range(1, 2, ErrorMessage = "Please select a reminder type")]
|
||||
public ReminderType Type { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(1000, ErrorMessage = "Message too long (1000 character limit).")]
|
||||
public string Message { get; set; }
|
||||
|
||||
[Required]
|
||||
public double HoursBeforeRaid { get; set; }
|
||||
|
||||
public ulong ChannelId { get; set; }
|
||||
|
||||
public bool Sent { get; set; } = false;
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Lieb.Models.GuildWars2.Raid
|
||||
{
|
||||
public class RaidRole
|
||||
{
|
||||
public int RaidRoleId { get; set; }
|
||||
public int Spots { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(40, ErrorMessage = "Name too long (40 character limit).")]
|
||||
public string Name { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(200, ErrorMessage = "Description too long (200 character limit).")]
|
||||
public string Description { get; set; } = String.Empty;
|
||||
|
||||
public bool IsRandomSignUpRole { get; set; } = false;
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
namespace Lieb.Models.GuildWars2.Raid
|
||||
{
|
||||
public enum SignUpType
|
||||
{
|
||||
SignedUp = 0,
|
||||
Maybe = 1,
|
||||
Backup = 2,
|
||||
Flex = 3,
|
||||
SignedOff = 4
|
||||
}
|
||||
|
||||
public class RaidSignUp
|
||||
{
|
||||
public int RaidSignUpId { get; set; }
|
||||
|
||||
public int RaidId { get; set; }
|
||||
public int LiebUserId { get; set; }
|
||||
public int GuildWars2AccountId { get; set; }
|
||||
public int PlannedRaidRoleId { get; set; }
|
||||
|
||||
public SignUpType SignUpType { get; set; }
|
||||
|
||||
public Raid Raid { get; set; }
|
||||
public LiebUser LiebUser { get; set; }
|
||||
public GuildWars2Account GuildWars2Account { get; set; }
|
||||
public RaidRole PlannedRaidRole { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
namespace Lieb.Models.GuildWars2.Raid
|
||||
{
|
||||
public class RaidSignUpHistory
|
||||
{
|
||||
public int RaidSignUpHistoryId { get; set; }
|
||||
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
|
||||
public DateTimeOffset Time { get; set; } = DateTimeOffset.Now;
|
||||
|
||||
public SignUpType SignUpType { get; set; }
|
||||
|
||||
public Raid Raid { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Lieb.Models.GuildWars2.Raid
|
||||
{
|
||||
public class RaidTemplate : RaidBase
|
||||
{
|
||||
public int RaidTemplateId { get; private set; }
|
||||
|
||||
[Required]
|
||||
public DateTime StartTime { get; set; } = DateTime.Now;
|
||||
|
||||
[Required]
|
||||
public DateTime EndTime { get; set; }
|
||||
|
||||
public DateTime FreeForAllTime { get; set; }
|
||||
|
||||
public string TimeZone { get; set; } = String.Empty;
|
||||
|
||||
public int Interval { get; set; }
|
||||
|
||||
public int CreateDaysBefore { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Lieb.Models
|
||||
{
|
||||
public enum RoleType
|
||||
{
|
||||
GuildRole = 1,
|
||||
SystemRole = 2,
|
||||
UserDefinedRole = 3
|
||||
}
|
||||
|
||||
public class LiebRole
|
||||
{
|
||||
public int LiebRoleId { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(40, ErrorMessage = "RoleName too long (40 character limit).")]
|
||||
public string RoleName { get; set; } = string.Empty;
|
||||
|
||||
public RoleType Type { get; set; }
|
||||
|
||||
public int Level { get; set; } = 20;
|
||||
|
||||
public int LevelToAssign { get; set; } = 30;
|
||||
|
||||
public ICollection<RoleAssignment> RoleAssignments { get; set; } = new List<RoleAssignment>();
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
using Lieb.Models.GuildWars2;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Lieb.Models
|
||||
{
|
||||
public class LiebUser
|
||||
{
|
||||
public int LiebUserId { get; set; }
|
||||
public ulong DiscordUserId { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(40, ErrorMessage = "Name too long (40 character limit).")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[StringLength(60, ErrorMessage = "Pronouns too long (60 character limit).")]
|
||||
public string Pronouns { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? Birthday { get; set; }
|
||||
public DateTime? BannedUntil { get; set; }
|
||||
public ICollection<GuildWars2Account> GuildWars2Accounts { get; set; } = new List<GuildWars2Account>();
|
||||
public ICollection<RoleAssignment> RoleAssignments { get; set; } = new List<RoleAssignment>();
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
namespace Lieb.Models
|
||||
{
|
||||
public class RoleAssignment
|
||||
{
|
||||
public int RoleAssignmentId { get; set; }
|
||||
|
||||
|
||||
public int LiebRoleId { get; set; }
|
||||
public int LiebUserId { get; set; }
|
||||
public LiebRole LiebRole { get; set; }
|
||||
public LiebUser LiebUser { get; set; }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue