Added restrictions on DB
This commit is contained in:
@@ -0,0 +1,442 @@
|
||||
// <auto-generated />
|
||||
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
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Label")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Achievements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BeReadyBackend.Models.Designation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Label")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Designations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BeReadyBackend.Models.Group", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Duration")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("IsFinished")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Label")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Groups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BeReadyBackend.Models.Message", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("GroupId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Libelle")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("SendDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Messages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BeReadyBackend.Models.RandomChallenge", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Duration")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("GeneratedAt")
|
||||
.IsRequired()
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<bool>("IsAlreadyPast")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Libelle")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RandomChallenges");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BeReadyBackend.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int?>("DesignationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasMaxLength(60)
|
||||
.HasColumnType("nvarchar(60)");
|
||||
|
||||
b.Property<string>("Salt")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Score")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Series")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TotalBonusChallenge")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TotalChallenge")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TotalPodium")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TotalWin")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DesignationId");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BeReadyBackend.Models.UserAchievement", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AchievementId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("UserId", "AchievementId");
|
||||
|
||||
b.HasIndex("AchievementId");
|
||||
|
||||
b.ToTable("UserAchievements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BeReadyBackend.Models.UserFriend", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FriendId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("IsAccepted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.HasKey("UserId", "FriendId");
|
||||
|
||||
b.HasIndex("FriendId");
|
||||
|
||||
b.ToTable("UserFriends");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BeReadyBackend.Models.UserGroup", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("GroupId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Grade")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Proof")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Score")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("VotedProofId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("UserId", "GroupId");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.ToTable("UserGroups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BeReadyBackend.Models.UserRandomChallenge", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RandomChallengeId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BeReadyBackend.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddedRestrictionsOnDB : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Username",
|
||||
table: "Users",
|
||||
type: "nvarchar(max)",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(50)",
|
||||
oldMaxLength: 50);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Name",
|
||||
table: "Users",
|
||||
type: "nvarchar(max)",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(50)",
|
||||
oldMaxLength: 50);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "FirstName",
|
||||
table: "Users",
|
||||
type: "nvarchar(max)",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(50)",
|
||||
oldMaxLength: 50);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "GeneratedAt",
|
||||
table: "RandomChallenges",
|
||||
type: "datetime2",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Label",
|
||||
table: "Groups",
|
||||
type: "nvarchar(max)",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(100)",
|
||||
oldMaxLength: 100);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "GeneratedAt",
|
||||
table: "RandomChallenges");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Username",
|
||||
table: "Users",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Name",
|
||||
table: "Users",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "FirstName",
|
||||
table: "Users",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Label",
|
||||
table: "Groups",
|
||||
type: "nvarchar(100)",
|
||||
maxLength: 100,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,8 +83,7 @@ namespace BeReadyBackend.Migrations
|
||||
|
||||
b.Property<string>("Label")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
@@ -136,6 +135,10 @@ namespace BeReadyBackend.Migrations
|
||||
b.Property<int>("Duration")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("GeneratedAt")
|
||||
.IsRequired()
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<bool>("IsAlreadyPast")
|
||||
.HasColumnType("bit");
|
||||
|
||||
@@ -169,13 +172,11 @@ namespace BeReadyBackend.Migrations
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
@@ -206,8 +207,7 @@ namespace BeReadyBackend.Migrations
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
|
||||
@@ -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<UserAchievement>? UserAchievements { get; set; }
|
||||
}
|
||||
@@ -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<User>? Users { get; set; }
|
||||
}
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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<UserRandomChallenge>? UserRandomChallenges { get; set; }
|
||||
}
|
||||
@@ -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; }
|
||||
|
||||
@@ -17,7 +17,7 @@ public class GetAchievementDtoValidator : Validator<GetAchievementDto>
|
||||
.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<GetAchievementDto>
|
||||
.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");
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ public class GetDesignationDtoValidator : Validator<GetDesignationDto>
|
||||
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");
|
||||
|
||||
@@ -11,15 +11,15 @@ public class CreateGroupDtoValidator : Validator<CreateGroupDto>
|
||||
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<CreateGroupDto>
|
||||
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");
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ public class GetGroupDetailsDtoValidator : Validator<GetGroupDetailsDto>
|
||||
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<GetGroupDetailsDto>
|
||||
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<GetGroupDetailsDto>
|
||||
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");
|
||||
|
||||
@@ -17,8 +17,8 @@ public class GetGroupDtoValidator : Validator<GetGroupDto>
|
||||
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");
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@ public class CreateMessageDtoValidator : Validator<CreateMessageDto>
|
||||
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");
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ public class GetRandomChallengeDtoValidator : Validator<GetRandomChallengeDto>
|
||||
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");
|
||||
|
||||
@@ -11,8 +11,8 @@ public class GetUserChallengeDtoValidator : Validator<GetUserChallengeDto>
|
||||
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()
|
||||
|
||||
@@ -11,8 +11,6 @@ public class PatchUserPasswordDtoValidator : Validator<PatchUserPasswordDto>
|
||||
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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user