diff --git a/Verax_API_EF/Verax_API_EF/.idea/.idea.Verax_API_EF/.idea/vcs.xml b/Verax_API_EF/Verax_API_EF/.idea/.idea.Verax_API_EF/.idea/vcs.xml
index 6c0b863..64713b8 100644
--- a/Verax_API_EF/Verax_API_EF/.idea/.idea.Verax_API_EF/.idea/vcs.xml
+++ b/Verax_API_EF/Verax_API_EF/.idea/.idea.Verax_API_EF/.idea/vcs.xml
@@ -1,6 +1,7 @@
+
\ No newline at end of file
diff --git a/Verax_API_EF/Verax_API_EF/API/Entity_FrameWork.Article.db b/Verax_API_EF/Verax_API_EF/API/Entity_FrameWork.Article.db
index 3cd9f2f..175a9e3 100644
Binary files a/Verax_API_EF/Verax_API_EF/API/Entity_FrameWork.Article.db and b/Verax_API_EF/Verax_API_EF/API/Entity_FrameWork.Article.db differ
diff --git a/Verax_API_EF/Verax_API_EF/API/Entity_FrameWork.Article.db-shm b/Verax_API_EF/Verax_API_EF/API/Entity_FrameWork.Article.db-shm
new file mode 100644
index 0000000..fe9ac28
Binary files /dev/null and b/Verax_API_EF/Verax_API_EF/API/Entity_FrameWork.Article.db-shm differ
diff --git a/Verax_API_EF/Verax_API_EF/API/Entity_FrameWork.Article.db-wal b/Verax_API_EF/Verax_API_EF/API/Entity_FrameWork.Article.db-wal
new file mode 100644
index 0000000..e69de29
diff --git a/Verax_API_EF/Verax_API_EF/API/Program.cs b/Verax_API_EF/Verax_API_EF/API/Program.cs
index f57c6e0..eb6fa14 100644
--- a/Verax_API_EF/Verax_API_EF/API/Program.cs
+++ b/Verax_API_EF/Verax_API_EF/API/Program.cs
@@ -39,7 +39,7 @@ app.MapControllers();
using var scoped = app.Services.CreateScope();
var libraryContext = scoped.ServiceProvider.GetService();
-//libraryContext.Database.EnsureCreated();
+//libraryContext.Database.EnsureCreated();
libraryContext.Database.Migrate();
app.Run();
diff --git a/Verax_API_EF/Verax_API_EF/DbContextLib/Class1.cs b/Verax_API_EF/Verax_API_EF/DbContextLib/Class1.cs
deleted file mode 100644
index 6ef8d5f..0000000
--- a/Verax_API_EF/Verax_API_EF/DbContextLib/Class1.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-using DbContextLib;
-using Entities;
-using Microsoft.EntityFrameworkCore;
-
-namespace StubbedContextLib;
-
-public class StubbedContext : LibraryContext
-{
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- base.OnModelCreating(modelBuilder);
-
- modelBuilder.Entity().HasData(
- new ArticleEntity
- {
- Id = 1,
- Title = "Breaking News Elisabeth 2 Died",
- Description = "The queen of England died today at the age of 95",
- DatePublished = "2022-02-06",
- LectureTime = 2,
- Author = "Tom Smith"
-
- },
- new ArticleEntity
- {
- Id = 2,
- Title = "The new iPhone 15",
- Description = "The new iPhone 15 is out and it's the best phone ever",
- DatePublished = "2022-02-06",
- LectureTime = 3,
- Author = "Tom Smith"
-
- },
- new ArticleEntity
- {
- Id = 3,
- Title = "M&M's new recipe",
- Description = "M&M's new recipe is out and it's the best chocolate ever",
- DatePublished = "2022-02-06",
- LectureTime = 1,
- Author = "M&M's Red"
- }
- );
-
- modelBuilder.Entity().HasData(
- new UserEntity
- {
- Nom = "Fages", Prenom = "Tony", Pseudo = "TonyF", Mail = "tony@gmail.com", Mdp = "1234", Role = "Admin"
- },
- new UserEntity
- {
- Nom = "Smith", Prenom = "Tom", Pseudo = "TomS", Mail = "tom@mail.com", Mdp = "1234",
- Role = "User"
- },
- new UserEntity
- {
- Nom = "M&M's", Prenom = "Red", Pseudo = "RedM", Mail = "M&M#mail.com", Mdp = "1234", Role = "Modérator"
- }
- );
-
- modelBuilder.Entity().HasData(
- new ArticleUserEntity
- {
- ArticleEntityId = 1,
- UserEntityPseudo = "Sha"
- },
- new ArticleUserEntity
- {
- ArticleEntityId = 2,
- UserEntityPseudo = "Sha"
- },
- new ArticleUserEntity
- {
- ArticleEntityId = 3,
- UserEntityPseudo = "Sha"
- },
- new ArticleUserEntity
- {
- ArticleEntityId = 3,
- UserEntityPseudo = "Sha"
- },
- new ArticleUserEntity
- {
- ArticleEntityId = 2,
- UserEntityPseudo = "Sha"
- }
- );
- }
-}
\ No newline at end of file
diff --git a/Verax_API_EF/Verax_API_EF/DbContextLib/LibraryContext.cs b/Verax_API_EF/Verax_API_EF/DbContextLib/LibraryContext.cs
index 8923007..053406d 100644
--- a/Verax_API_EF/Verax_API_EF/DbContextLib/LibraryContext.cs
+++ b/Verax_API_EF/Verax_API_EF/DbContextLib/LibraryContext.cs
@@ -51,7 +51,6 @@ public class LibraryContext : DbContext
.HasOne(f => f.User)
.WithMany(u => u.Forms)
.HasForeignKey(f => f.UserEntityPseudo);
-
/*
modelBuilder.Entity().HasData(
new ArticleEntity
diff --git a/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240311132206_mrg1.Designer.cs b/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240312155559_mrg1.Designer.cs
similarity index 86%
rename from Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240311132206_mrg1.Designer.cs
rename to Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240312155559_mrg1.Designer.cs
index 6c21748..850cf0c 100644
--- a/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240311132206_mrg1.Designer.cs
+++ b/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240312155559_mrg1.Designer.cs
@@ -10,7 +10,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace DbContextLib.Migrations
{
[DbContext(typeof(LibraryContext))]
- [Migration("20240311132206_mrg1")]
+ [Migration("20240312155559_mrg1")]
partial class mrg1
{
///
@@ -83,12 +83,12 @@ namespace DbContextLib.Migrations
b.Property("ArticleEntityId")
.HasColumnType("INTEGER");
- b.Property("UserEntityId")
- .HasColumnType("INTEGER");
+ b.Property("UserEntityPseudo")
+ .HasColumnType("TEXT");
- b.HasKey("ArticleEntityId", "UserEntityId");
+ b.HasKey("ArticleEntityId", "UserEntityPseudo");
- b.HasIndex("UserEntityId");
+ b.HasIndex("UserEntityPseudo");
b.ToTable("ArticleUserSet");
@@ -96,27 +96,27 @@ namespace DbContextLib.Migrations
new
{
ArticleEntityId = 1L,
- UserEntityId = 1L
+ UserEntityPseudo = "TonyF"
},
new
{
ArticleEntityId = 2L,
- UserEntityId = 2L
+ UserEntityPseudo = "NoaSil"
},
new
{
ArticleEntityId = 3L,
- UserEntityId = 3L
+ UserEntityPseudo = "Sha"
},
new
{
ArticleEntityId = 3L,
- UserEntityId = 1L
+ UserEntityPseudo = "RedM"
},
new
{
ArticleEntityId = 2L,
- UserEntityId = 3L
+ UserEntityPseudo = "TomS"
});
});
@@ -134,20 +134,17 @@ namespace DbContextLib.Migrations
.IsRequired()
.HasColumnType("TEXT");
- b.Property("Pseudo")
+ b.Property("Theme")
.IsRequired()
.HasColumnType("TEXT");
- b.Property("Theme")
+ b.Property("UserEntityPseudo")
.IsRequired()
.HasColumnType("TEXT");
- b.Property("UserEntityId")
- .HasColumnType("INTEGER");
-
b.HasKey("Id");
- b.HasIndex("UserEntityId");
+ b.HasIndex("UserEntityPseudo");
b.ToTable("FormSet");
@@ -157,35 +154,31 @@ namespace DbContextLib.Migrations
Id = 1L,
DatePublication = "Form 1 Description",
Link = "hhtp://form1.com",
- Pseudo = "Form 1",
Theme = "",
- UserEntityId = 1L
+ UserEntityPseudo = "Sha"
},
new
{
Id = 2L,
DatePublication = "Form 2 Description",
Link = "hhtp://form2.com",
- Pseudo = "Form 2",
Theme = "",
- UserEntityId = 2L
+ UserEntityPseudo = "Sha"
},
new
{
Id = 3L,
DatePublication = "Form 3 Description",
Link = "hhtp://form3.com",
- Pseudo = "Form 3",
Theme = "",
- UserEntityId = 3L
+ UserEntityPseudo = "Sha"
});
});
modelBuilder.Entity("Entities.UserEntity", b =>
{
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
+ b.Property("Pseudo")
+ .HasColumnType("TEXT");
b.Property("Mail")
.IsRequired()
@@ -203,67 +196,58 @@ namespace DbContextLib.Migrations
.IsRequired()
.HasColumnType("TEXT");
- b.Property("Pseudo")
- .IsRequired()
- .HasColumnType("TEXT");
-
b.Property("Role")
.IsRequired()
.HasColumnType("TEXT");
- b.HasKey("Id");
+ b.HasKey("Pseudo");
b.ToTable("UserSet");
b.HasData(
new
{
- Id = 1L,
+ Pseudo = "TonyF",
Mail = "tony@gmail.com",
Mdp = "1234",
Nom = "Fages",
Prenom = "Tony",
- Pseudo = "TonyF",
Role = "Admin"
},
new
{
- Id = 2L,
+ Pseudo = "TomS",
Mail = "tom@mail.com",
Mdp = "1234",
Nom = "Smith",
Prenom = "Tom",
- Pseudo = "TomS",
Role = "User"
},
new
{
- Id = 3L,
+ Pseudo = "RedM",
Mail = "M&M#mail.com",
Mdp = "1234",
Nom = "M&M's",
Prenom = "Red",
- Pseudo = "RedM",
Role = "Modérator"
},
new
{
- Id = 4L,
+ Pseudo = "Sha",
Mail = "ShaCasca@gmail.com",
Mdp = "1234",
Nom = "Cascarra",
Prenom = "Cascarra",
- Pseudo = "Sha",
Role = "Admin"
},
new
{
- Id = 5L,
+ Pseudo = "NoaSil",
Mail = "",
Mdp = "1234",
Nom = "Sillard",
Prenom = "Noa",
- Pseudo = "NoaSil",
Role = "Admin"
});
});
@@ -278,7 +262,7 @@ namespace DbContextLib.Migrations
b.HasOne("Entities.UserEntity", null)
.WithMany()
- .HasForeignKey("UserEntityId")
+ .HasForeignKey("UserEntityPseudo")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
@@ -287,7 +271,7 @@ namespace DbContextLib.Migrations
{
b.HasOne("Entities.UserEntity", "User")
.WithMany("Forms")
- .HasForeignKey("UserEntityId")
+ .HasForeignKey("UserEntityPseudo")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
diff --git a/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240311132206_mrg1.cs b/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240312155559_mrg1.cs
similarity index 75%
rename from Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240311132206_mrg1.cs
rename to Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240312155559_mrg1.cs
index b9278d6..df6fd44 100644
--- a/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240311132206_mrg1.cs
+++ b/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240312155559_mrg1.cs
@@ -33,8 +33,6 @@ namespace DbContextLib.Migrations
name: "UserSet",
columns: table => new
{
- Id = table.Column(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
Pseudo = table.Column(type: "TEXT", nullable: false),
Mdp = table.Column(type: "TEXT", nullable: false),
Nom = table.Column(type: "TEXT", nullable: false),
@@ -44,19 +42,19 @@ namespace DbContextLib.Migrations
},
constraints: table =>
{
- table.PrimaryKey("PK_UserSet", x => x.Id);
+ table.PrimaryKey("PK_UserSet", x => x.Pseudo);
});
migrationBuilder.CreateTable(
name: "ArticleUserSet",
columns: table => new
{
- UserEntityId = table.Column(type: "INTEGER", nullable: false),
+ UserEntityPseudo = table.Column(type: "TEXT", nullable: false),
ArticleEntityId = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
- table.PrimaryKey("PK_ArticleUserSet", x => new { x.ArticleEntityId, x.UserEntityId });
+ table.PrimaryKey("PK_ArticleUserSet", x => new { x.ArticleEntityId, x.UserEntityPseudo });
table.ForeignKey(
name: "FK_ArticleUserSet_ArticleSet_ArticleEntityId",
column: x => x.ArticleEntityId,
@@ -64,10 +62,10 @@ namespace DbContextLib.Migrations
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
- name: "FK_ArticleUserSet_UserSet_UserEntityId",
- column: x => x.UserEntityId,
+ name: "FK_ArticleUserSet_UserSet_UserEntityPseudo",
+ column: x => x.UserEntityPseudo,
principalTable: "UserSet",
- principalColumn: "Id",
+ principalColumn: "Pseudo",
onDelete: ReferentialAction.Cascade);
});
@@ -80,17 +78,16 @@ namespace DbContextLib.Migrations
Theme = table.Column(type: "TEXT", nullable: false),
DatePublication = table.Column(type: "TEXT", nullable: false),
Link = table.Column(type: "TEXT", nullable: false),
- Pseudo = table.Column(type: "TEXT", nullable: false),
- UserEntityId = table.Column(type: "INTEGER", nullable: false)
+ UserEntityPseudo = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_FormSet", x => x.Id);
table.ForeignKey(
- name: "FK_FormSet_UserSet_UserEntityId",
- column: x => x.UserEntityId,
+ name: "FK_FormSet_UserSet_UserEntityPseudo",
+ column: x => x.UserEntityPseudo,
principalTable: "UserSet",
- principalColumn: "Id",
+ principalColumn: "Pseudo",
onDelete: ReferentialAction.Cascade);
});
@@ -106,47 +103,47 @@ namespace DbContextLib.Migrations
migrationBuilder.InsertData(
table: "UserSet",
- columns: new[] { "Id", "Mail", "Mdp", "Nom", "Prenom", "Pseudo", "Role" },
+ columns: new[] { "Pseudo", "Mail", "Mdp", "Nom", "Prenom", "Role" },
values: new object[,]
{
- { 1L, "tony@gmail.com", "1234", "Fages", "Tony", "TonyF", "Admin" },
- { 2L, "tom@mail.com", "1234", "Smith", "Tom", "TomS", "User" },
- { 3L, "M&M#mail.com", "1234", "M&M's", "Red", "RedM", "Modérator" },
- { 4L, "ShaCasca@gmail.com", "1234", "Cascarra", "Cascarra", "Sha", "Admin" },
- { 5L, "", "1234", "Sillard", "Noa", "NoaSil", "Admin" }
+ { "NoaSil", "", "1234", "Sillard", "Noa", "Admin" },
+ { "RedM", "M&M#mail.com", "1234", "M&M's", "Red", "Modérator" },
+ { "Sha", "ShaCasca@gmail.com", "1234", "Cascarra", "Cascarra", "Admin" },
+ { "TomS", "tom@mail.com", "1234", "Smith", "Tom", "User" },
+ { "TonyF", "tony@gmail.com", "1234", "Fages", "Tony", "Admin" }
});
migrationBuilder.InsertData(
table: "ArticleUserSet",
- columns: new[] { "ArticleEntityId", "UserEntityId" },
+ columns: new[] { "ArticleEntityId", "UserEntityPseudo" },
values: new object[,]
{
- { 1L, 1L },
- { 2L, 2L },
- { 2L, 3L },
- { 3L, 1L },
- { 3L, 3L }
+ { 1L, "TonyF" },
+ { 2L, "NoaSil" },
+ { 2L, "TomS" },
+ { 3L, "RedM" },
+ { 3L, "Sha" }
});
migrationBuilder.InsertData(
table: "FormSet",
- columns: new[] { "Id", "DatePublication", "Link", "Pseudo", "Theme", "UserEntityId" },
+ columns: new[] { "Id", "DatePublication", "Link", "Theme", "UserEntityPseudo" },
values: new object[,]
{
- { 1L, "Form 1 Description", "hhtp://form1.com", "Form 1", "", 1L },
- { 2L, "Form 2 Description", "hhtp://form2.com", "Form 2", "", 2L },
- { 3L, "Form 3 Description", "hhtp://form3.com", "Form 3", "", 3L }
+ { 1L, "Form 1 Description", "hhtp://form1.com", "", "Sha" },
+ { 2L, "Form 2 Description", "hhtp://form2.com", "", "Sha" },
+ { 3L, "Form 3 Description", "hhtp://form3.com", "", "Sha" }
});
migrationBuilder.CreateIndex(
- name: "IX_ArticleUserSet_UserEntityId",
+ name: "IX_ArticleUserSet_UserEntityPseudo",
table: "ArticleUserSet",
- column: "UserEntityId");
+ column: "UserEntityPseudo");
migrationBuilder.CreateIndex(
- name: "IX_FormSet_UserEntityId",
+ name: "IX_FormSet_UserEntityPseudo",
table: "FormSet",
- column: "UserEntityId");
+ column: "UserEntityPseudo");
}
///
diff --git a/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/LibraryContextModelSnapshot.cs b/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/LibraryContextModelSnapshot.cs
index 4e992dc..8cff281 100644
--- a/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/LibraryContextModelSnapshot.cs
+++ b/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/LibraryContextModelSnapshot.cs
@@ -80,12 +80,12 @@ namespace DbContextLib.Migrations
b.Property("ArticleEntityId")
.HasColumnType("INTEGER");
- b.Property("UserEntityId")
- .HasColumnType("INTEGER");
+ b.Property("UserEntityPseudo")
+ .HasColumnType("TEXT");
- b.HasKey("ArticleEntityId", "UserEntityId");
+ b.HasKey("ArticleEntityId", "UserEntityPseudo");
- b.HasIndex("UserEntityId");
+ b.HasIndex("UserEntityPseudo");
b.ToTable("ArticleUserSet");
@@ -93,27 +93,27 @@ namespace DbContextLib.Migrations
new
{
ArticleEntityId = 1L,
- UserEntityId = 1L
+ UserEntityPseudo = "TonyF"
},
new
{
ArticleEntityId = 2L,
- UserEntityId = 2L
+ UserEntityPseudo = "NoaSil"
},
new
{
ArticleEntityId = 3L,
- UserEntityId = 3L
+ UserEntityPseudo = "Sha"
},
new
{
ArticleEntityId = 3L,
- UserEntityId = 1L
+ UserEntityPseudo = "RedM"
},
new
{
ArticleEntityId = 2L,
- UserEntityId = 3L
+ UserEntityPseudo = "TomS"
});
});
@@ -131,20 +131,17 @@ namespace DbContextLib.Migrations
.IsRequired()
.HasColumnType("TEXT");
- b.Property("Pseudo")
+ b.Property("Theme")
.IsRequired()
.HasColumnType("TEXT");
- b.Property("Theme")
+ b.Property("UserEntityPseudo")
.IsRequired()
.HasColumnType("TEXT");
- b.Property("UserEntityId")
- .HasColumnType("INTEGER");
-
b.HasKey("Id");
- b.HasIndex("UserEntityId");
+ b.HasIndex("UserEntityPseudo");
b.ToTable("FormSet");
@@ -154,35 +151,31 @@ namespace DbContextLib.Migrations
Id = 1L,
DatePublication = "Form 1 Description",
Link = "hhtp://form1.com",
- Pseudo = "Form 1",
Theme = "",
- UserEntityId = 1L
+ UserEntityPseudo = "Sha"
},
new
{
Id = 2L,
DatePublication = "Form 2 Description",
Link = "hhtp://form2.com",
- Pseudo = "Form 2",
Theme = "",
- UserEntityId = 2L
+ UserEntityPseudo = "Sha"
},
new
{
Id = 3L,
DatePublication = "Form 3 Description",
Link = "hhtp://form3.com",
- Pseudo = "Form 3",
Theme = "",
- UserEntityId = 3L
+ UserEntityPseudo = "Sha"
});
});
modelBuilder.Entity("Entities.UserEntity", b =>
{
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
+ b.Property("Pseudo")
+ .HasColumnType("TEXT");
b.Property("Mail")
.IsRequired()
@@ -200,67 +193,58 @@ namespace DbContextLib.Migrations
.IsRequired()
.HasColumnType("TEXT");
- b.Property("Pseudo")
- .IsRequired()
- .HasColumnType("TEXT");
-
b.Property("Role")
.IsRequired()
.HasColumnType("TEXT");
- b.HasKey("Id");
+ b.HasKey("Pseudo");
b.ToTable("UserSet");
b.HasData(
new
{
- Id = 1L,
+ Pseudo = "TonyF",
Mail = "tony@gmail.com",
Mdp = "1234",
Nom = "Fages",
Prenom = "Tony",
- Pseudo = "TonyF",
Role = "Admin"
},
new
{
- Id = 2L,
+ Pseudo = "TomS",
Mail = "tom@mail.com",
Mdp = "1234",
Nom = "Smith",
Prenom = "Tom",
- Pseudo = "TomS",
Role = "User"
},
new
{
- Id = 3L,
+ Pseudo = "RedM",
Mail = "M&M#mail.com",
Mdp = "1234",
Nom = "M&M's",
Prenom = "Red",
- Pseudo = "RedM",
Role = "Modérator"
},
new
{
- Id = 4L,
+ Pseudo = "Sha",
Mail = "ShaCasca@gmail.com",
Mdp = "1234",
Nom = "Cascarra",
Prenom = "Cascarra",
- Pseudo = "Sha",
Role = "Admin"
},
new
{
- Id = 5L,
+ Pseudo = "NoaSil",
Mail = "",
Mdp = "1234",
Nom = "Sillard",
Prenom = "Noa",
- Pseudo = "NoaSil",
Role = "Admin"
});
});
@@ -275,7 +259,7 @@ namespace DbContextLib.Migrations
b.HasOne("Entities.UserEntity", null)
.WithMany()
- .HasForeignKey("UserEntityId")
+ .HasForeignKey("UserEntityPseudo")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
@@ -284,7 +268,7 @@ namespace DbContextLib.Migrations
{
b.HasOne("Entities.UserEntity", "User")
.WithMany("Forms")
- .HasForeignKey("UserEntityId")
+ .HasForeignKey("UserEntityPseudo")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();