Skip to content

Commit

Permalink
Remove Redundant Required Attributes (#1783)
Browse files Browse the repository at this point in the history
* remove redundant Required attributes from non-nullable properties of models

* remove redundant Required attributes from non-nullable properties of entties
  • Loading branch information
Masterjun3 authored Feb 28, 2024
1 parent b11a2ba commit c0d9d21
Show file tree
Hide file tree
Showing 67 changed files with 0 additions and 121 deletions.
2 changes: 0 additions & 2 deletions TASVideos.Data/Entity/Awards/Award.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ public class Award
public int Id { get; set; }
public AwardType Type { get; set; }

[Required]
[StringLength(25)]
public string ShortName { get; set; } = "";

[Required]
[StringLength(50)]
public string Description { get; set; } = "";
}
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/DeprecatedMovieFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ public class DeprecatedMovieFormat : BaseEntity
{
public int Id { get; set; }

[Required]
[StringLength(8)]
public string FileExtension { get; set; } = "";

Expand Down
2 changes: 0 additions & 2 deletions TASVideos.Data/Entity/Flag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ public class Flag
{
public int Id { get; set; }

[Required]
[StringLength(32)]
public string Name { get; set; } = "";

Expand All @@ -14,7 +13,6 @@ public class Flag
[StringLength(48)]
public string? LinkPath { get; set; }

[Required]
[StringLength(24)]
public string Token { get; set; } = "";

Expand Down
2 changes: 0 additions & 2 deletions TASVideos.Data/Entity/Forum/Forum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ public class Forum : BaseEntity
public virtual ICollection<ForumTopic> ForumTopics { get; set; } = new HashSet<ForumTopic>();
public virtual ICollection<ForumPost> ForumPosts { get; set; } = new HashSet<ForumPost>();

[Required]
[StringLength(50)]
public string Name { get; set; } = "";

[Required]
[StringLength(10)]
public string ShortName { get; set; } = "";

Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/Forum/ForumCategory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ public class ForumCategory : BaseEntity
public int Id { get; set; }
public virtual ICollection<Forum> Forums { get; set; } = new HashSet<Forum>();

[Required]
[StringLength(30)]
public string Title { get; set; } = "";

Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/Forum/ForumPoll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public class ForumPoll : BaseEntity
public int TopicId { get; set; }
public virtual ForumTopic? Topic { get; set; }

[Required]
[StringLength(500)]
public string Question { get; set; } = "";

Expand Down
2 changes: 0 additions & 2 deletions TASVideos.Data/Entity/Forum/ForumPollOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ public class ForumPollOption : BaseEntity
{
public int Id { get; set; }

[Required]
[StringLength(250)]
public string Text { get; set; } = "";

[Required]
public int Ordinal { get; set; }

public int PollId { get; set; }
Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/Forum/ForumPost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class ForumPost : BaseEntity
[StringLength(500)]
public string? Subject { get; set; }

[Required]
public string Text { get; set; } = "";

public DateTime? PostEditedTimestamp { get; set; }
Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/Forum/ForumTopic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class ForumTopic : BaseEntity
public virtual ICollection<ForumPost> ForumPosts { get; set; } = new HashSet<ForumPost>();
public virtual ICollection<ForumTopicWatch> ForumTopicWatches { get; set; } = new HashSet<ForumTopicWatch>();

[Required]
[StringLength(500)]
public string Title { get; set; } = "";

Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/Game/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public class Game : BaseEntity
public virtual ICollection<GameGameGroup> GameGroups { get; set; } = new HashSet<GameGameGroup>();
public virtual ICollection<GameGoal> GameGoals { get; set; } = new HashSet<GameGoal>();

[Required]
[StringLength(100)]
public string DisplayName { get; set; } = "";

Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/Game/GameGoal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ public class GameGoal
public int GameId { get; set; }
public virtual Game? Game { get; set; }

[Required]
[StringLength(50)]
public string DisplayName { get; set; } = "";

Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/Game/GameGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ public class GameGroup
{
public int Id { get; set; }

[Required]
[StringLength(255)]
public string Name { get; set; } = "";

Expand Down
2 changes: 0 additions & 2 deletions TASVideos.Data/Entity/Game/GameSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ public class GameSystem : BaseEntity
public virtual ICollection<Publication> Publications { get; set; } = new HashSet<Publication>();
public virtual ICollection<Submission> Submissions { get; set; } = new HashSet<Submission>();

[Required]
[StringLength(8)]
public string Code { get; set; } = "";

[Required]
[StringLength(100)]
public string DisplayName { get; set; } = "";
}
Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/Game/GameSystemFrameRate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public class GameSystemFrameRate : BaseEntity

public double FrameRate { get; set; }

[Required]
[StringLength(8)]
public string RegionCode { get; set; } = "";
public bool Preliminary { get; set; }
Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/Game/GameVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public class GameVersion : BaseEntity
[StringLength(40)]
public string? Sha1 { get; set; }

[Required]
[StringLength(255)]
public string Name { get; set; } = "";

Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/Game/Genre.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ public class Genre
{
public int Id { get; set; }

[Required]
[StringLength(20)]
public string DisplayName { get; set; } = "";

Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/IpBan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ public class IpBan : BaseEntity
{
public int Id { get; set; }

[Required]
[StringLength(40)]
public string Mask { get; set; } = "";
}
6 changes: 0 additions & 6 deletions TASVideos.Data/Entity/MediaPosts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,21 @@ public class MediaPost : BaseEntity
{
public int Id { get; set; }

[Required]
[StringLength(512)]
public string Title { get; set; } = "";

[Required]
[StringLength(255)]
public string Link { get; set; } = "";

[Required]
[StringLength(1024)]
public string Body { get; set; } = "";

[Required]
[StringLength(255)]
public string Group { get; set; } = "";

[Required]
[StringLength(100)]
public string Type { get; set; } = "";

[Required]
[StringLength(100)]
public string User { get; set; } = "";
}
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/PrivateMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class PrivateMessage : BaseEntity
[StringLength(500)]
public string? Subject { get; set; }

[Required]
public string Text { get; set; } = "";

public bool EnableHtml { get; set; }
Expand Down
3 changes: 0 additions & 3 deletions TASVideos.Data/Entity/Publication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ public class Publication : BaseEntity, ITimeable
public virtual Submission? Submission { get; set; }
public virtual ICollection<PublicationAuthor> Authors { get; set; } = new HashSet<PublicationAuthor>();

[Required]
public byte[] MovieFile { get; set; } = Array.Empty<byte>();

[Required]
[StringLength(200)]
public string MovieFileName { get; set; } = "";

Expand All @@ -80,7 +78,6 @@ public class Publication : BaseEntity, ITimeable
public string? AdditionalAuthors { get; set; }

// De-normalized name for easy recreation
[Required]
[StringLength(500)]
public string Title { get; set; } = "";

Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/PublicationAuthor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ public class PublicationAuthor
public int UserId { get; set; }
public virtual User? Author { get; set; }

[Required]
public int Ordinal { get; set; }

public int PublicationId { get; set; }
Expand Down
2 changes: 0 additions & 2 deletions TASVideos.Data/Entity/PublicationClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ public class PublicationClass
{
public int Id { get; set; }

[Required]
[StringLength(20)]
public string Name { get; set; } = "";
public double Weight { get; set; }

[StringLength(100)]
public string? IconPath { get; set; }

[Required]
[StringLength(100)]
public string Link { get; set; } = "";
}
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/PublicationFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class PublicationFile : BaseEntity
public int PublicationId { get; set; }
public virtual Publication? Publication { get; set; }

[Required]
[StringLength(250)]
public string Path { get; set; } = "";
public FileType Type { get; set; }
Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/Role.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public class Role : IdentityRole<int>, ITrackable
/// </summary>
public bool IsDefault { get; set; }

[Required]
[StringLength(300)]
public string Description { get; set; } = "";

Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/RoleLinks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ public class RoleLink
{
public int Id { get; set; }

[Required]
[StringLength(300)]
public string Link { get; set; } = "";

Expand Down
2 changes: 0 additions & 2 deletions TASVideos.Data/Entity/Submission.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class Submission : BaseEntity, ITimeable
public SubmissionStatus Status { get; set; } = SubmissionStatus.New;
public virtual ICollection<SubmissionStatusHistory> History { get; set; } = new HashSet<SubmissionStatusHistory>();

[Required]
public byte[] MovieFile { get; set; } = Array.Empty<byte>();

[StringLength(8)]
Expand Down Expand Up @@ -94,7 +93,6 @@ public class Submission : BaseEntity, ITimeable
/// Gets or sets a de-normalized column consisting of the submission title for display when linked or in the queue
/// ex: N64 The Legend of Zelda: Majora's Mask "low%" in 1:59:01.
/// </summary>
[Required]
[StringLength(500)]
public string Title { get; set; } = "";

Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/SubmissionAuthor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ public class SubmissionAuthor
public int UserId { get; set; }
public virtual User? Author { get; set; }

[Required]
public int Ordinal { get; set; }

public int SubmissionId { get; set; }
Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/SubmissionRejectionReason.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ public class SubmissionRejectionReason
{
public int Id { get; set; }

[Required]
[StringLength(100)]
public string DisplayName { get; set; } = "";

Expand Down
2 changes: 0 additions & 2 deletions TASVideos.Data/Entity/Tag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ public class Tag
{
public int Id { get; set; }

[Required]
[StringLength(25)]
public string Code { get; set; } = "";

[Required]
[StringLength(50)]
public string DisplayName { get; set; } = "";

Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public class User : IdentityUser<int>, ITrackable

public DateTime? LastLoggedInTimeStamp { get; set; }

[Required]
[StringLength(250)]
public string TimeZoneId { get; set; } = TimeZoneInfo.Utc.Id;

Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/UserDisallow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ public class UserDisallow : BaseEntity
{
public int Id { get; set; }

[Required]
[StringLength(100)]
public string RegexPattern { get; set; } = "";
}
4 changes: 0 additions & 4 deletions TASVideos.Data/Entity/UserFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,13 @@ public class UserFile
public int AuthorId { get; set; }
public virtual User? Author { get; set; }

[Required]
[StringLength(255)]
public string FileName { get; set; } = "";

[Required]
public byte[] Content { get; set; } = Array.Empty<byte>();

public UserFileClass Class { get; set; }

[Required]
[StringLength(16)]
public string Type { get; set; } = "";

Expand All @@ -44,7 +41,6 @@ public class UserFile

public int Rerecords { get; set; }

[Required]
[StringLength(255)]
public string Title { get; set; } = "";

Expand Down
1 change: 0 additions & 1 deletion TASVideos.Data/Entity/UserFileComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class UserFileComment
[StringLength(255)]
public string? Title { get; set; }

Check warning on line 20 in TASVideos.Data/Entity/UserFileComment.cs

View workflow job for this annotation

GitHub Actions / build

Check warning on line 20 in TASVideos.Data/Entity/UserFileComment.cs

View workflow job for this annotation

GitHub Actions / build

[Required]

public string Text { get; set; } = "";

Expand Down
2 changes: 0 additions & 2 deletions TASVideos.Data/Entity/WikiPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ public class WikiPage : BaseEntity, ISoftDeletable
{
public int Id { get; set; }

[Required]
[StringLength(250)]
public string PageName { get; set; } = "";

[Required]
public string Markup { get; set; } = "";

public int Revision { get; set; } = 1;
Expand Down
2 changes: 0 additions & 2 deletions TASVideos/Pages/Account/EmailConfirmationSent.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ public EmailConfirmationSentModel(
}

[BindProperty]
[Required]
[StringLength(256)]
[Display(Name = "User Name")]
public string UserName { get; set; } = "";

[BindProperty]
[Required]
[EmailAddress]
[Display(Name = "Email")]
public string Email { get; set; } = "";
Expand Down
1 change: 0 additions & 1 deletion TASVideos/Pages/Account/ForgotPassword.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public ForgotPasswordModel(UserManager userManager, IEmailService emailService)
}

[BindProperty]
[Required]
[EmailAddress]
public string Email { get; set; } = "";

Expand Down
Loading

0 comments on commit c0d9d21

Please sign in to comment.