Deleted status

This commit is contained in:
2026-02-21 14:16:41 +01:00
parent 93cfa6d6ce
commit 9a6bd0151d
10 changed files with 538 additions and 61 deletions
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourcePerFileMappings">
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/d39cb28a-f071-4fe6-bb03-b2350028b821/console.sql" value="d39cb28a-f071-4fe6-bb03-b2350028b821" />
</component>
</project>
+6 -2
View File
@@ -25,8 +25,12 @@
</ItemGroup>
<ItemGroup>
<Folder Include="DTO\" />
<Folder Include="Endpoints\" />
<Folder Include="DTO\Auth\" />
<Folder Include="DTO\Friends\" />
<Folder Include="DTO\Groups\" />
<Folder Include="DTO\Messages\" />
<Folder Include="DTO\RandomChallenges\" />
<Folder Include="DTO\Users\" />
<Folder Include="Specifications\" />
</ItemGroup>
-1
View File
@@ -10,7 +10,6 @@ public class BeReadyDbContext : DbContext
public DbSet<Group> Groups { get; set; }
public DbSet<Message> Messages { get; set; }
public DbSet<RandomChallenge> RandomChallenges { get; set; }
public DbSet<Status> Status { get; set; }
public DbSet<User> Users { get; set; }
public DbSet<UserAchievement> UserAchievements { get; set; }
public DbSet<UserFriend> UserFriends { get; set; }
@@ -0,0 +1,445 @@
// <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("20260221131548_AddedIsFinishedInGroupAndDeletedStatus")]
partial class AddedIsFinishedInGroupAndDeletedStatus
{
/// <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()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
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<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()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
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()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
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.Property<bool>("IsActive")
.HasColumnType("bit");
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")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
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()
.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");
});
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,77 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BeReadyBackend.Migrations
{
/// <inheritdoc />
public partial class AddedIsFinishedInGroupAndDeletedStatus : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Groups_Status_StatusId",
table: "Groups");
migrationBuilder.DropTable(
name: "Status");
migrationBuilder.DropIndex(
name: "IX_Groups_StatusId",
table: "Groups");
migrationBuilder.DropColumn(
name: "StatusId",
table: "Groups");
migrationBuilder.AddColumn<bool>(
name: "IsFinished",
table: "Groups",
type: "bit",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsFinished",
table: "Groups");
migrationBuilder.AddColumn<int>(
name: "StatusId",
table: "Groups",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateTable(
name: "Status",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Label = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Status", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_Groups_StatusId",
table: "Groups",
column: "StatusId");
migrationBuilder.AddForeignKey(
name: "FK_Groups_Status_StatusId",
table: "Groups",
column: "StatusId",
principalTable: "Status",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}
@@ -78,22 +78,20 @@ namespace BeReadyBackend.Migrations
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<bool>("IsFinished")
.HasColumnType("bit");
b.Property<string>("Label")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<int>("StatusId")
.HasColumnType("int");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("StatusId");
b.ToTable("Groups");
});
@@ -150,23 +148,6 @@ namespace BeReadyBackend.Migrations
b.ToTable("RandomChallenges");
});
modelBuilder.Entity("BeReadyBackend.Models.Status", 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("Status");
});
modelBuilder.Entity("BeReadyBackend.Models.User", b =>
{
b.Property<int>("Id")
@@ -317,17 +298,6 @@ namespace BeReadyBackend.Migrations
b.ToTable("UserRandomChallenges");
});
modelBuilder.Entity("BeReadyBackend.Models.Group", b =>
{
b.HasOne("BeReadyBackend.Models.Status", "Status")
.WithMany("Groups")
.HasForeignKey("StatusId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Status");
});
modelBuilder.Entity("BeReadyBackend.Models.Message", b =>
{
b.HasOne("BeReadyBackend.Models.Group", "Group")
@@ -454,11 +424,6 @@ namespace BeReadyBackend.Migrations
b.Navigation("UserRandomChallenges");
});
modelBuilder.Entity("BeReadyBackend.Models.Status", b =>
{
b.Navigation("Groups");
});
modelBuilder.Entity("BeReadyBackend.Models.User", b =>
{
b.Navigation("Messages");
+1 -3
View File
@@ -6,9 +6,7 @@ public class Group
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; }
public Status? Status { get; set; }
[Required] public int StatusId { get; set; }
[Required] public bool IsFinished { get; set; }
[Required] public string? Title { get; set; }
[Required] public string? Description { get; set; }
-11
View File
@@ -1,11 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace BeReadyBackend.Models;
public class Status
{
[Key] public int Id { get; set; }
[Required] public string? Label { get; set; }
public List<Group>? Groups { get; set; }
}
-1
View File
@@ -38,7 +38,6 @@ builder.Services.AddScoped<DesignationsRepository>();
builder.Services.AddScoped<GroupsRepository>();
builder.Services.AddScoped<MessagesRepository>();
builder.Services.AddScoped<RandomChallengesRepository>();
builder.Services.AddScoped<StatusRepository>();
builder.Services.AddScoped<UserAchievementsRepository>();
builder.Services.AddScoped<UserFriendsRepository>();
builder.Services.AddScoped<UserGroupsRepository>();
@@ -1,5 +0,0 @@
using BeReadyBackend.Models;
namespace BeReadyBackend.Repositories;
public class StatusRepository(BeReadyDbContext beReadyDbContext, AutoMapper.IMapper mapper) : BeReadyRepository<Status>(beReadyDbContext, mapper);