diff --git a/BeReadyBackend/Migrations/20260317081620_AddedRestrictionsOnDB.Designer.cs b/BeReadyBackend/Migrations/20260317081620_AddedRestrictionsOnDB.Designer.cs new file mode 100644 index 0000000..2eed67a --- /dev/null +++ b/BeReadyBackend/Migrations/20260317081620_AddedRestrictionsOnDB.Designer.cs @@ -0,0 +1,442 @@ +// +using System; +using BeReadyBackend; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace BeReadyBackend.Migrations +{ + [DbContext(typeof(BeReadyDbContext))] + [Migration("20260317081620_AddedRestrictionsOnDB")] + partial class AddedRestrictionsOnDB + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("BeReadyBackend.Models.Achievement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Achievements"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.Designation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Designations"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.Group", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Duration") + .HasColumnType("int"); + + b.Property("IsFinished") + .HasColumnType("bit"); + + b.Property("Label") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.Message", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("GroupId") + .HasColumnType("int"); + + b.Property("Libelle") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("SendDate") + .HasColumnType("datetime2"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("GroupId"); + + b.HasIndex("UserId"); + + b.ToTable("Messages"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.RandomChallenge", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Duration") + .HasColumnType("int"); + + b.Property("GeneratedAt") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("IsAlreadyPast") + .HasColumnType("bit"); + + b.Property("Libelle") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("RandomChallenges"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DesignationId") + .HasColumnType("int"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.Property("Salt") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Score") + .HasColumnType("int"); + + b.Property("Series") + .HasColumnType("int"); + + b.Property("TotalBonusChallenge") + .HasColumnType("int"); + + b.Property("TotalChallenge") + .HasColumnType("int"); + + b.Property("TotalPodium") + .HasColumnType("int"); + + b.Property("TotalWin") + .HasColumnType("int"); + + b.Property("Username") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("DesignationId"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.UserAchievement", b => + { + b.Property("UserId") + .HasColumnType("int"); + + b.Property("AchievementId") + .HasColumnType("int"); + + b.HasKey("UserId", "AchievementId"); + + b.HasIndex("AchievementId"); + + b.ToTable("UserAchievements"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.UserFriend", b => + { + b.Property("UserId") + .HasColumnType("int"); + + b.Property("FriendId") + .HasColumnType("int"); + + b.Property("IsAccepted") + .HasColumnType("bit"); + + b.HasKey("UserId", "FriendId"); + + b.HasIndex("FriendId"); + + b.ToTable("UserFriends"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.UserGroup", b => + { + b.Property("UserId") + .HasColumnType("int"); + + b.Property("GroupId") + .HasColumnType("int"); + + b.Property("Grade") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Proof") + .HasColumnType("nvarchar(max)"); + + b.Property("Score") + .HasColumnType("int"); + + b.Property("VotedProofId") + .HasColumnType("int"); + + b.HasKey("UserId", "GroupId"); + + b.HasIndex("GroupId"); + + b.ToTable("UserGroups"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.UserRandomChallenge", b => + { + b.Property("UserId") + .HasColumnType("int"); + + b.Property("RandomChallengeId") + .HasColumnType("int"); + + b.Property("Proof") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "RandomChallengeId"); + + b.HasIndex("RandomChallengeId"); + + b.ToTable("UserRandomChallenges"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.Message", b => + { + b.HasOne("BeReadyBackend.Models.Group", "Group") + .WithMany("Messages") + .HasForeignKey("GroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BeReadyBackend.Models.User", "User") + .WithMany("Messages") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Group"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.User", b => + { + b.HasOne("BeReadyBackend.Models.Designation", "Designation") + .WithMany("Users") + .HasForeignKey("DesignationId"); + + b.Navigation("Designation"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.UserAchievement", b => + { + b.HasOne("BeReadyBackend.Models.Achievement", "Achievement") + .WithMany("UserAchievements") + .HasForeignKey("AchievementId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BeReadyBackend.Models.User", "User") + .WithMany("UserAchievements") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Achievement"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.UserFriend", b => + { + b.HasOne("BeReadyBackend.Models.User", "Friend") + .WithMany() + .HasForeignKey("FriendId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("BeReadyBackend.Models.User", "User") + .WithMany("UserFriends") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Friend"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.UserGroup", b => + { + b.HasOne("BeReadyBackend.Models.Group", "Group") + .WithMany("UserGroups") + .HasForeignKey("GroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BeReadyBackend.Models.User", "User") + .WithMany("UserGroups") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Group"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.UserRandomChallenge", b => + { + b.HasOne("BeReadyBackend.Models.RandomChallenge", "RandomChallenge") + .WithMany("UserRandomChallenges") + .HasForeignKey("RandomChallengeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BeReadyBackend.Models.User", "User") + .WithMany("UserRandomChallenges") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RandomChallenge"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.Achievement", b => + { + b.Navigation("UserAchievements"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.Designation", b => + { + b.Navigation("Users"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.Group", b => + { + b.Navigation("Messages"); + + b.Navigation("UserGroups"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.RandomChallenge", b => + { + b.Navigation("UserRandomChallenges"); + }); + + modelBuilder.Entity("BeReadyBackend.Models.User", b => + { + b.Navigation("Messages"); + + b.Navigation("UserAchievements"); + + b.Navigation("UserFriends"); + + b.Navigation("UserGroups"); + + b.Navigation("UserRandomChallenges"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/BeReadyBackend/Migrations/20260317081620_AddedRestrictionsOnDB.cs b/BeReadyBackend/Migrations/20260317081620_AddedRestrictionsOnDB.cs new file mode 100644 index 0000000..a81cbe6 --- /dev/null +++ b/BeReadyBackend/Migrations/20260317081620_AddedRestrictionsOnDB.cs @@ -0,0 +1,102 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace BeReadyBackend.Migrations +{ + /// + public partial class AddedRestrictionsOnDB : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Username", + table: "Users", + type: "nvarchar(max)", + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(50)", + oldMaxLength: 50); + + migrationBuilder.AlterColumn( + name: "Name", + table: "Users", + type: "nvarchar(max)", + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(50)", + oldMaxLength: 50); + + migrationBuilder.AlterColumn( + name: "FirstName", + table: "Users", + type: "nvarchar(max)", + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(50)", + oldMaxLength: 50); + + migrationBuilder.AddColumn( + name: "GeneratedAt", + table: "RandomChallenges", + type: "datetime2", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AlterColumn( + name: "Label", + table: "Groups", + type: "nvarchar(max)", + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(100)", + oldMaxLength: 100); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "GeneratedAt", + table: "RandomChallenges"); + + migrationBuilder.AlterColumn( + name: "Username", + table: "Users", + type: "nvarchar(50)", + maxLength: 50, + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn( + name: "Name", + table: "Users", + type: "nvarchar(50)", + maxLength: 50, + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn( + name: "FirstName", + table: "Users", + type: "nvarchar(50)", + maxLength: 50, + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn( + name: "Label", + table: "Groups", + type: "nvarchar(100)", + maxLength: 100, + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + } + } +} diff --git a/BeReadyBackend/Migrations/BeReadyDbContextModelSnapshot.cs b/BeReadyBackend/Migrations/BeReadyDbContextModelSnapshot.cs index 41ad7c2..ee291d5 100644 --- a/BeReadyBackend/Migrations/BeReadyDbContextModelSnapshot.cs +++ b/BeReadyBackend/Migrations/BeReadyDbContextModelSnapshot.cs @@ -83,8 +83,7 @@ namespace BeReadyBackend.Migrations b.Property("Label") .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasColumnType("nvarchar(max)"); b.Property("Title") .IsRequired() @@ -136,6 +135,10 @@ namespace BeReadyBackend.Migrations b.Property("Duration") .HasColumnType("int"); + b.Property("GeneratedAt") + .IsRequired() + .HasColumnType("datetime2"); + b.Property("IsAlreadyPast") .HasColumnType("bit"); @@ -169,13 +172,11 @@ namespace BeReadyBackend.Migrations b.Property("FirstName") .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("nvarchar(max)"); b.Property("Name") .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("nvarchar(max)"); b.Property("Password") .IsRequired() @@ -206,8 +207,7 @@ namespace BeReadyBackend.Migrations b.Property("Username") .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("nvarchar(max)"); b.HasKey("Id"); diff --git a/BeReadyBackend/Models/Achievement.cs b/BeReadyBackend/Models/Achievement.cs index 62907fe..0e77464 100644 --- a/BeReadyBackend/Models/Achievement.cs +++ b/BeReadyBackend/Models/Achievement.cs @@ -5,8 +5,8 @@ namespace BeReadyBackend.Models; public class Achievement { [Key] public int Id { get; set; } - [Required] public string? Label { get; set; } - [Required] public string? Description { get; set; } + [Required, Length(2, 200)] public string? Label { get; set; } + [Required, Length(2, 200)] public string? Description { get; set; } public List? UserAchievements { get; set; } } \ No newline at end of file diff --git a/BeReadyBackend/Models/Designation.cs b/BeReadyBackend/Models/Designation.cs index 793d0ec..b7c499e 100644 --- a/BeReadyBackend/Models/Designation.cs +++ b/BeReadyBackend/Models/Designation.cs @@ -5,7 +5,7 @@ namespace BeReadyBackend.Models; public class Designation { [Key] public int Id { get; set; } - [Required] public string? Label { get; set; } + [Required, Length(2, 100)] public string? Label { get; set; } public List? Users { get; set; } } \ No newline at end of file diff --git a/BeReadyBackend/Models/Group.cs b/BeReadyBackend/Models/Group.cs index f29d59a..b99d30d 100644 --- a/BeReadyBackend/Models/Group.cs +++ b/BeReadyBackend/Models/Group.cs @@ -5,11 +5,11 @@ namespace BeReadyBackend.Models; public class Group { [Key] public int Id { get; set; } - [Required, MaxLength(100)] public string? Label { get; set; } + [Required, Length(2, 100)] public string? Label { get; set; } [Required] public bool IsFinished { get; set; } - [Required] public string? Title { get; set; } - [Required] public string? Description { get; set; } + [Required, Length(2, 200)] public string? Title { get; set; } + [Required, Length(2, 200)] public string? Description { get; set; } [Required] public int Duration { get; set; } [Required] public DateTime CreationDate { get; set; } diff --git a/BeReadyBackend/Models/Message.cs b/BeReadyBackend/Models/Message.cs index 9ebe5d1..edee65a 100644 --- a/BeReadyBackend/Models/Message.cs +++ b/BeReadyBackend/Models/Message.cs @@ -5,7 +5,7 @@ namespace BeReadyBackend.Models; public class Message { [Key] public int Id { get; set; } - [Required] public string? Libelle { get; set; } + [Required, Length(2, 200)] public string? Libelle { get; set; } [Required] public DateTime SendDate { get; set; } public User? User { get; set; } diff --git a/BeReadyBackend/Models/RandomChallenge.cs b/BeReadyBackend/Models/RandomChallenge.cs index 6cef868..357fd06 100644 --- a/BeReadyBackend/Models/RandomChallenge.cs +++ b/BeReadyBackend/Models/RandomChallenge.cs @@ -5,9 +5,11 @@ namespace BeReadyBackend.Models; public class RandomChallenge { [Key] public int Id { get; set; } - [Required] public string? Libelle { get; set; } + [Required, Length(2, 200)] public string? Libelle { get; set; } [Required] public int Duration { get; set; } [Required] public bool IsAlreadyPast { get; set; } + + [Required] public DateTime? GeneratedAt { get; set; } public List? UserRandomChallenges { get; set; } } \ No newline at end of file diff --git a/BeReadyBackend/Models/User.cs b/BeReadyBackend/Models/User.cs index 79d4657..23dbf2f 100644 --- a/BeReadyBackend/Models/User.cs +++ b/BeReadyBackend/Models/User.cs @@ -5,9 +5,9 @@ namespace BeReadyBackend.Models; public class User { [Key] public int Id { get; set; } - [Required, MaxLength(50)] public string? FirstName { get; set; } - [Required, MaxLength(50)] public string? Name { get; set; } - [Required, MaxLength(50)] public string? Username { get; set; } + [Required, Length(2, 50)] public string? FirstName { get; set; } + [Required, Length(2, 50)] public string? Name { get; set; } + [Required, Length(2, 50)] public string? Username { get; set; } [Required, MaxLength(100)] public string? Email { get; set; } [Required] public DateTime CreationDate { get; set; } [Required, MaxLength(60)] public string? Password { get; set; } diff --git a/BeReadyBackend/Validators/Achievements/GetAchievementDtoValidator.cs b/BeReadyBackend/Validators/Achievements/GetAchievementDtoValidator.cs index da6df0d..ec9a653 100644 --- a/BeReadyBackend/Validators/Achievements/GetAchievementDtoValidator.cs +++ b/BeReadyBackend/Validators/Achievements/GetAchievementDtoValidator.cs @@ -17,7 +17,7 @@ public class GetAchievementDtoValidator : Validator .WithMessage("Description must be specified") .MinimumLength(2) .WithMessage("Description must contain more than 2 characters") - .MaximumLength(200) // Add BDD + .MaximumLength(200) .WithMessage("Description cannot contain more than 200 characters"); RuleFor(x => x.Label) @@ -25,7 +25,7 @@ public class GetAchievementDtoValidator : Validator .WithMessage("Label must be specified") .MinimumLength(2) .WithMessage("Description must contain more than 2 characters") - .MaximumLength(200) // Add BDD + .MaximumLength(200) .WithMessage("Description cannot contain more than 200 characters"); } } \ No newline at end of file diff --git a/BeReadyBackend/Validators/Designations/GetDesignationDtoValidator.cs b/BeReadyBackend/Validators/Designations/GetDesignationDtoValidator.cs index 7b48147..d8721ba 100644 --- a/BeReadyBackend/Validators/Designations/GetDesignationDtoValidator.cs +++ b/BeReadyBackend/Validators/Designations/GetDesignationDtoValidator.cs @@ -17,7 +17,7 @@ public class GetDesignationDtoValidator : Validator RuleFor(x => x.Label) .NotEmpty() .WithMessage("Label cannot be empty") - .MaximumLength(100) // Add BDD + .MaximumLength(100) .WithMessage("Label cannot contain more than 100 characters") .MinimumLength(2) .WithMessage("Label must contain more than 2 characters"); diff --git a/BeReadyBackend/Validators/Groups/CreateGroupDtoValidator.cs b/BeReadyBackend/Validators/Groups/CreateGroupDtoValidator.cs index ece2ebd..6be0d0d 100644 --- a/BeReadyBackend/Validators/Groups/CreateGroupDtoValidator.cs +++ b/BeReadyBackend/Validators/Groups/CreateGroupDtoValidator.cs @@ -11,15 +11,15 @@ public class CreateGroupDtoValidator : Validator RuleFor(x => x.Label) .NotEmpty() .WithMessage("Label cannot be empty") - .MaximumLength(50) // Add BDD - .WithMessage("Label cannot exceed 50 characters") + .MaximumLength(100) + .WithMessage("Label cannot exceed 100 characters") .MinimumLength(2) .WithMessage("Label must exceed 2 characters"); RuleFor(x => x.Title) .NotEmpty() .WithMessage("Title cannot be empty") - .MaximumLength(50) // Add BDD + .MaximumLength(50) .WithMessage("Title cannot exceed 50 characters") .MinimumLength(2) .WithMessage("Title must exceed 2 characters"); @@ -27,8 +27,8 @@ public class CreateGroupDtoValidator : Validator RuleFor(x => x.Description) .NotEmpty() .WithMessage("Description cannot be empty") - .MaximumLength(200) // Add BDD - .WithMessage("Description cannot exceed 50 characters") + .MaximumLength(200) + .WithMessage("Description cannot exceed 200 characters") .MinimumLength(2) .WithMessage("Description must exceed 2 characters"); diff --git a/BeReadyBackend/Validators/Groups/GetGroupDetailsDtoValidator.cs b/BeReadyBackend/Validators/Groups/GetGroupDetailsDtoValidator.cs index 1486436..7dbc813 100644 --- a/BeReadyBackend/Validators/Groups/GetGroupDetailsDtoValidator.cs +++ b/BeReadyBackend/Validators/Groups/GetGroupDetailsDtoValidator.cs @@ -17,8 +17,8 @@ public class GetGroupDetailsDtoValidator : Validator RuleFor(x => x.Label) .NotEmpty() .WithMessage("Label cannot be empty") - .MaximumLength(50) // Add BDD - .WithMessage("Label cannot exceed 50 characters") + .MaximumLength(100) + .WithMessage("Label cannot exceed 100 characters") .MinimumLength(2) .WithMessage("Label must exceed 2 characters"); @@ -29,7 +29,7 @@ public class GetGroupDetailsDtoValidator : Validator RuleFor(x => x.Title) .NotEmpty() .WithMessage("Title cannot be empty") - .MaximumLength(100) // Add BDD + .MaximumLength(50) .WithMessage("Title cannot exceed 50 characters") .MinimumLength(2) .WithMessage("Title must exceed 2 characters"); @@ -37,7 +37,7 @@ public class GetGroupDetailsDtoValidator : Validator RuleFor(x => x.Description) .NotEmpty() .WithMessage("Description cannot be empty") - .MaximumLength(200) // Add BDD + .MaximumLength(200) .WithMessage("Description cannot exceed 50 characters") .MinimumLength(2) .WithMessage("Description must exceed 2 characters"); diff --git a/BeReadyBackend/Validators/Groups/GetGroupDtoValidator.cs b/BeReadyBackend/Validators/Groups/GetGroupDtoValidator.cs index 8b3c761..a3427e6 100644 --- a/BeReadyBackend/Validators/Groups/GetGroupDtoValidator.cs +++ b/BeReadyBackend/Validators/Groups/GetGroupDtoValidator.cs @@ -17,8 +17,8 @@ public class GetGroupDtoValidator : Validator RuleFor(x => x.Label) .NotEmpty() .WithMessage("Label cannot be empty") - .MaximumLength(50) // Add BDD - .WithMessage("Label cannot exceed 50 characters") + .MaximumLength(100) + .WithMessage("Label cannot exceed 100 characters") .MinimumLength(2) .WithMessage("Label must exceed 2 characters"); diff --git a/BeReadyBackend/Validators/Messages/CreateMessageDtoValidator.cs b/BeReadyBackend/Validators/Messages/CreateMessageDtoValidator.cs index 2d29f8f..3eb560c 100644 --- a/BeReadyBackend/Validators/Messages/CreateMessageDtoValidator.cs +++ b/BeReadyBackend/Validators/Messages/CreateMessageDtoValidator.cs @@ -11,12 +11,12 @@ public class CreateMessageDtoValidator : Validator RuleFor(x => x.Libelle) .NotEmpty() .WithMessage("Libelle is required") - .MaximumLength(200) //Add BDD + .MaximumLength(200) .WithMessage("Libelle cannot exceed 200 characters") .MinimumLength(2) .WithMessage("Libelle must exceed 2 characters"); - RuleFor(x => x.SendDate) //Edit BDD + RuleFor(x => x.SendDate) .NotEmpty() .WithMessage("SendDate is required"); diff --git a/BeReadyBackend/Validators/RandomChallenges/GetRandomChallengeDtoValidator.cs b/BeReadyBackend/Validators/RandomChallenges/GetRandomChallengeDtoValidator.cs index b6b145d..472c4a4 100644 --- a/BeReadyBackend/Validators/RandomChallenges/GetRandomChallengeDtoValidator.cs +++ b/BeReadyBackend/Validators/RandomChallenges/GetRandomChallengeDtoValidator.cs @@ -11,7 +11,7 @@ public class GetRandomChallengeDtoValidator : Validator RuleFor(x => x.Libelle) .NotEmpty() .WithMessage("Libelle is required") - .MaximumLength(200) //Add BDD + .MaximumLength(200) .WithMessage("Libelle cannot exceed 200 characters") .MinimumLength(2) .WithMessage("Libelle must exceed 2 characters"); diff --git a/BeReadyBackend/Validators/Users/GetUserChallengeDtoValidator.cs b/BeReadyBackend/Validators/Users/GetUserChallengeDtoValidator.cs index c31a0d8..91e5bb4 100644 --- a/BeReadyBackend/Validators/Users/GetUserChallengeDtoValidator.cs +++ b/BeReadyBackend/Validators/Users/GetUserChallengeDtoValidator.cs @@ -11,8 +11,8 @@ public class GetUserChallengeDtoValidator : Validator RuleFor(x => x.ChallengeTitle) .NotEmpty() .WithMessage("Challenge Title is required") - .MaximumLength(100) - .WithMessage("Challenge Title cannot exceed 100 characters"); + .MaximumLength(200) + .WithMessage("Challenge Title cannot exceed 200 characters"); RuleFor(x => x.ChallengeDescription) .NotEmpty() diff --git a/BeReadyBackend/Validators/Users/PatchUserPasswordDtoValidator.cs b/BeReadyBackend/Validators/Users/PatchUserPasswordDtoValidator.cs index d124d65..e944904 100644 --- a/BeReadyBackend/Validators/Users/PatchUserPasswordDtoValidator.cs +++ b/BeReadyBackend/Validators/Users/PatchUserPasswordDtoValidator.cs @@ -11,8 +11,6 @@ public class PatchUserPasswordDtoValidator : Validator RuleFor(x => x.Password) .NotEmpty() .WithMessage("Password is required") - .MaximumLength(60) - .WithMessage("Password cannot exceed 60 characters") .MinimumLength(12) .WithMessage("Password must exceed 12 characters"); }