limited string lengths

This commit is contained in:
t.ruspekhofer 2022-02-27 00:45:14 +01:00
parent 7113e3abee
commit 210020ece5
7 changed files with 42 additions and 5 deletions

View file

@ -5,10 +5,13 @@ 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>();
}

View file

@ -1,4 +1,6 @@
namespace Lieb.Models.GuildWars2
using System.ComponentModel.DataAnnotations;
namespace Lieb.Models.GuildWars2
{
public enum Role
{
@ -67,6 +69,9 @@
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; }

View file

@ -1,10 +1,18 @@
namespace Lieb.Models.GuildWars2.Raid
using System.ComponentModel.DataAnnotations;
namespace Lieb.Models.GuildWars2.Raid
{
public class PlannedRaidRole
{
public int PlannedRaidRoleId { get; set; }
public string Name { get; set; } = String.Empty;
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;
}
}

View file

@ -15,9 +15,11 @@ namespace Lieb.Models.GuildWars2.Raid
public int RaidId { get; private set; }
[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]
@ -30,12 +32,15 @@ namespace Lieb.Models.GuildWars2.Raid
public DateTimeOffset EndTime { get; set; }
[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]

View file

@ -1,4 +1,6 @@
namespace Lieb.Models.GuildWars2.Raid
using System.ComponentModel.DataAnnotations;
namespace Lieb.Models.GuildWars2.Raid
{
public class RaidReminder
{
@ -20,6 +22,8 @@
public ReminderType Type { get; set; }
[Required]
[StringLength(1000, ErrorMessage = "Message too long (1000 character limit).")]
public string Message { get; set; }
public double HoursBeforeRaid { get; set; }

View file

@ -1,9 +1,13 @@
namespace Lieb.Models
using System.ComponentModel.DataAnnotations;
namespace Lieb.Models
{
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 ICollection<RoleAssignment> RoleAssignments { get; set; } = new List<RoleAssignment>();

View file

@ -1,4 +1,5 @@
using Lieb.Models.GuildWars2;
using System.ComponentModel.DataAnnotations;
namespace Lieb.Models
{
@ -6,8 +7,15 @@ namespace Lieb.Models
{
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;
[Required]
[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>();