Initial commit
This commit is contained in:
@@ -0,0 +1,476 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MetaCourse.Api.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MetaCourse.Api.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260326141046_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.14")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.Course", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatorId");
|
||||
|
||||
b.ToTable("Courses");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"),
|
||||
CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
CreatorId = new Guid("11111111-1111-1111-1111-111111111111"),
|
||||
Description = "Maîtrisez React, Tailwind CSS et TypeScript pour créer des applications web performantes.",
|
||||
Status = "Published",
|
||||
Title = "Développement Web Moderne avec React",
|
||||
UpdatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"),
|
||||
CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
CreatorId = new Guid("22222222-2222-2222-2222-222222222222"),
|
||||
Description = "Apprenez à construire des APIs REST robustes avec ASP.NET Core et FastEndpoints.",
|
||||
Status = "Draft",
|
||||
Title = "API REST avec .NET et FastEndpoints",
|
||||
UpdatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.Resource", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Resources");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("ffffffff-ffff-ffff-ffff-ffffffffffff"),
|
||||
Content = "https://youtube.com/watch?v=example1",
|
||||
CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
Title = "React en 30 minutes",
|
||||
Type = "Video"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("00000000-0000-0000-aaaa-000000000001"),
|
||||
Content = "Les hooks permettent d'utiliser le state et d'autres fonctionnalités React dans des composants fonctionnels.",
|
||||
CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
Title = "Guide des Hooks",
|
||||
Type = "Text"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("00000000-0000-0000-aaaa-000000000002"),
|
||||
Content = "https://react.dev",
|
||||
CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
Title = "Documentation officielle React",
|
||||
Type = "Url"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.Topic", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("CourseId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Position")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CourseId");
|
||||
|
||||
b.ToTable("Topics");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("cccccccc-cccc-cccc-cccc-cccccccccccc"),
|
||||
CourseId = new Guid("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"),
|
||||
Description = "Les bases de React : composants, JSX, props.",
|
||||
Position = 1,
|
||||
Title = "Introduction à React"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("dddddddd-dddd-dddd-dddd-dddddddddddd"),
|
||||
CourseId = new Guid("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"),
|
||||
Description = "useState, useEffect et hooks personnalisés.",
|
||||
Position = 2,
|
||||
Title = "Hooks et State"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee"),
|
||||
CourseId = new Guid("bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"),
|
||||
Description = "Principes REST et verbes HTTP.",
|
||||
Position = 1,
|
||||
Title = "Fondamentaux REST"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.TopicResource", b =>
|
||||
{
|
||||
b.Property<Guid>("TopicId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("ResourceId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("Position")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("TopicId", "ResourceId");
|
||||
|
||||
b.HasIndex("ResourceId");
|
||||
|
||||
b.ToTable("TopicResources");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
TopicId = new Guid("cccccccc-cccc-cccc-cccc-cccccccccccc"),
|
||||
ResourceId = new Guid("ffffffff-ffff-ffff-ffff-ffffffffffff"),
|
||||
Position = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
TopicId = new Guid("cccccccc-cccc-cccc-cccc-cccccccccccc"),
|
||||
ResourceId = new Guid("00000000-0000-0000-aaaa-000000000002"),
|
||||
Position = 2
|
||||
},
|
||||
new
|
||||
{
|
||||
TopicId = new Guid("dddddddd-dddd-dddd-dddd-dddddddddddd"),
|
||||
ResourceId = new Guid("00000000-0000-0000-aaaa-000000000001"),
|
||||
Position = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.User", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Users");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("11111111-1111-1111-1111-111111111111"),
|
||||
CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
Email = "alice@metacourse.io",
|
||||
Name = "Alice Dupont",
|
||||
PasswordHash = "$2a$11$iVlx6m6E1Nlwe5EuA1m4XeJoWc1P2fgS5i1iwEVo2xYbRNt9gSdFe"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("22222222-2222-2222-2222-222222222222"),
|
||||
CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
Email = "bob@metacourse.io",
|
||||
Name = "Bob Martin",
|
||||
PasswordHash = "$2a$11$LIWuKuO3ful3H1AjoRI1n.kmjW9n05alzfOyMCI0iIIO28q5cSOKu"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.UserCourse", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("CourseId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime?>("CompletedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("EnrolledAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("UserId", "CourseId");
|
||||
|
||||
b.HasIndex("CourseId");
|
||||
|
||||
b.ToTable("UserCourses");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
UserId = new Guid("22222222-2222-2222-2222-222222222222"),
|
||||
CourseId = new Guid("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"),
|
||||
EnrolledAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.UserResourceProgress", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("ResourceId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<bool>("Completed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime?>("CompletedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("UserId", "ResourceId");
|
||||
|
||||
b.HasIndex("ResourceId");
|
||||
|
||||
b.ToTable("UserResourceProgresses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.UserTopicProgress", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("TopicId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<bool>("Completed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime?>("CompletedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("UserId", "TopicId");
|
||||
|
||||
b.HasIndex("TopicId");
|
||||
|
||||
b.ToTable("UserTopicProgresses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.Course", b =>
|
||||
{
|
||||
b.HasOne("MetaCourse.Api.Entities.User", "Creator")
|
||||
.WithMany("CreatedCourses")
|
||||
.HasForeignKey("CreatorId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Creator");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.Topic", b =>
|
||||
{
|
||||
b.HasOne("MetaCourse.Api.Entities.Course", "Course")
|
||||
.WithMany("Topics")
|
||||
.HasForeignKey("CourseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Course");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.TopicResource", b =>
|
||||
{
|
||||
b.HasOne("MetaCourse.Api.Entities.Resource", "Resource")
|
||||
.WithMany("TopicResources")
|
||||
.HasForeignKey("ResourceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("MetaCourse.Api.Entities.Topic", "Topic")
|
||||
.WithMany("TopicResources")
|
||||
.HasForeignKey("TopicId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Resource");
|
||||
|
||||
b.Navigation("Topic");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.UserCourse", b =>
|
||||
{
|
||||
b.HasOne("MetaCourse.Api.Entities.Course", "Course")
|
||||
.WithMany("UserCourses")
|
||||
.HasForeignKey("CourseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("MetaCourse.Api.Entities.User", "User")
|
||||
.WithMany("UserCourses")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Course");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.UserResourceProgress", b =>
|
||||
{
|
||||
b.HasOne("MetaCourse.Api.Entities.Resource", "Resource")
|
||||
.WithMany("UserProgresses")
|
||||
.HasForeignKey("ResourceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("MetaCourse.Api.Entities.User", "User")
|
||||
.WithMany("ResourceProgresses")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Resource");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.UserTopicProgress", b =>
|
||||
{
|
||||
b.HasOne("MetaCourse.Api.Entities.Topic", "Topic")
|
||||
.WithMany("UserProgresses")
|
||||
.HasForeignKey("TopicId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("MetaCourse.Api.Entities.User", "User")
|
||||
.WithMany("TopicProgresses")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Topic");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.Course", b =>
|
||||
{
|
||||
b.Navigation("Topics");
|
||||
|
||||
b.Navigation("UserCourses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.Resource", b =>
|
||||
{
|
||||
b.Navigation("TopicResources");
|
||||
|
||||
b.Navigation("UserProgresses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.Topic", b =>
|
||||
{
|
||||
b.Navigation("TopicResources");
|
||||
|
||||
b.Navigation("UserProgresses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.User", b =>
|
||||
{
|
||||
b.Navigation("CreatedCourses");
|
||||
|
||||
b.Navigation("ResourceProgresses");
|
||||
|
||||
b.Navigation("TopicProgresses");
|
||||
|
||||
b.Navigation("UserCourses");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace MetaCourse.Api.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Resources",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Type = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Content = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Resources", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
||||
PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Users", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Courses",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Status = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Courses", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Courses_Users_CreatorId",
|
||||
column: x => x.CreatorId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UserResourceProgresses",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
ResourceId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Completed = table.Column<bool>(type: "bit", nullable: false),
|
||||
CompletedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserResourceProgresses", x => new { x.UserId, x.ResourceId });
|
||||
table.ForeignKey(
|
||||
name: "FK_UserResourceProgresses_Resources_ResourceId",
|
||||
column: x => x.ResourceId,
|
||||
principalTable: "Resources",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_UserResourceProgresses_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Topics",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Position = table.Column<int>(type: "int", nullable: false),
|
||||
CourseId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Topics", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Topics_Courses_CourseId",
|
||||
column: x => x.CourseId,
|
||||
principalTable: "Courses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UserCourses",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
CourseId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
EnrolledAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CompletedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserCourses", x => new { x.UserId, x.CourseId });
|
||||
table.ForeignKey(
|
||||
name: "FK_UserCourses_Courses_CourseId",
|
||||
column: x => x.CourseId,
|
||||
principalTable: "Courses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_UserCourses_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TopicResources",
|
||||
columns: table => new
|
||||
{
|
||||
TopicId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
ResourceId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Position = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TopicResources", x => new { x.TopicId, x.ResourceId });
|
||||
table.ForeignKey(
|
||||
name: "FK_TopicResources_Resources_ResourceId",
|
||||
column: x => x.ResourceId,
|
||||
principalTable: "Resources",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TopicResources_Topics_TopicId",
|
||||
column: x => x.TopicId,
|
||||
principalTable: "Topics",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UserTopicProgresses",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
TopicId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Completed = table.Column<bool>(type: "bit", nullable: false),
|
||||
CompletedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserTopicProgresses", x => new { x.UserId, x.TopicId });
|
||||
table.ForeignKey(
|
||||
name: "FK_UserTopicProgresses_Topics_TopicId",
|
||||
column: x => x.TopicId,
|
||||
principalTable: "Topics",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_UserTopicProgresses_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Resources",
|
||||
columns: new[] { "Id", "Content", "CreatedAt", "Title", "Type" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("00000000-0000-0000-aaaa-000000000001"), "Les hooks permettent d'utiliser le state et d'autres fonctionnalités React dans des composants fonctionnels.", new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Guide des Hooks", "Text" },
|
||||
{ new Guid("00000000-0000-0000-aaaa-000000000002"), "https://react.dev", new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Documentation officielle React", "Url" },
|
||||
{ new Guid("ffffffff-ffff-ffff-ffff-ffffffffffff"), "https://youtube.com/watch?v=example1", new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "React en 30 minutes", "Video" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Users",
|
||||
columns: new[] { "Id", "CreatedAt", "Email", "Name", "PasswordHash" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("11111111-1111-1111-1111-111111111111"), new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "alice@metacourse.io", "Alice Dupont", "$2a$11$iVlx6m6E1Nlwe5EuA1m4XeJoWc1P2fgS5i1iwEVo2xYbRNt9gSdFe" },
|
||||
{ new Guid("22222222-2222-2222-2222-222222222222"), new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "bob@metacourse.io", "Bob Martin", "$2a$11$LIWuKuO3ful3H1AjoRI1n.kmjW9n05alzfOyMCI0iIIO28q5cSOKu" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Courses",
|
||||
columns: new[] { "Id", "CreatedAt", "CreatorId", "Description", "Status", "Title", "UpdatedAt" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"), new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), new Guid("11111111-1111-1111-1111-111111111111"), "Maîtrisez React, Tailwind CSS et TypeScript pour créer des applications web performantes.", "Published", "Développement Web Moderne avec React", new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc) },
|
||||
{ new Guid("bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"), new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), new Guid("22222222-2222-2222-2222-222222222222"), "Apprenez à construire des APIs REST robustes avec ASP.NET Core et FastEndpoints.", "Draft", "API REST avec .NET et FastEndpoints", new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc) }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Topics",
|
||||
columns: new[] { "Id", "CourseId", "Description", "Position", "Title" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("cccccccc-cccc-cccc-cccc-cccccccccccc"), new Guid("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"), "Les bases de React : composants, JSX, props.", 1, "Introduction à React" },
|
||||
{ new Guid("dddddddd-dddd-dddd-dddd-dddddddddddd"), new Guid("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"), "useState, useEffect et hooks personnalisés.", 2, "Hooks et State" },
|
||||
{ new Guid("eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee"), new Guid("bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"), "Principes REST et verbes HTTP.", 1, "Fondamentaux REST" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "UserCourses",
|
||||
columns: new[] { "CourseId", "UserId", "CompletedAt", "EnrolledAt" },
|
||||
values: new object[] { new Guid("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"), new Guid("22222222-2222-2222-2222-222222222222"), null, new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc) });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "TopicResources",
|
||||
columns: new[] { "ResourceId", "TopicId", "Position" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("00000000-0000-0000-aaaa-000000000002"), new Guid("cccccccc-cccc-cccc-cccc-cccccccccccc"), 2 },
|
||||
{ new Guid("ffffffff-ffff-ffff-ffff-ffffffffffff"), new Guid("cccccccc-cccc-cccc-cccc-cccccccccccc"), 1 },
|
||||
{ new Guid("00000000-0000-0000-aaaa-000000000001"), new Guid("dddddddd-dddd-dddd-dddd-dddddddddddd"), 1 }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Courses_CreatorId",
|
||||
table: "Courses",
|
||||
column: "CreatorId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TopicResources_ResourceId",
|
||||
table: "TopicResources",
|
||||
column: "ResourceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Topics_CourseId",
|
||||
table: "Topics",
|
||||
column: "CourseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserCourses_CourseId",
|
||||
table: "UserCourses",
|
||||
column: "CourseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserResourceProgresses_ResourceId",
|
||||
table: "UserResourceProgresses",
|
||||
column: "ResourceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Users_Email",
|
||||
table: "Users",
|
||||
column: "Email",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserTopicProgresses_TopicId",
|
||||
table: "UserTopicProgresses",
|
||||
column: "TopicId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "TopicResources");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "UserCourses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "UserResourceProgresses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "UserTopicProgresses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Resources");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Topics");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Courses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,473 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MetaCourse.Api.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MetaCourse.Api.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
partial class AppDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.14")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.Course", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatorId");
|
||||
|
||||
b.ToTable("Courses");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"),
|
||||
CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
CreatorId = new Guid("11111111-1111-1111-1111-111111111111"),
|
||||
Description = "Maîtrisez React, Tailwind CSS et TypeScript pour créer des applications web performantes.",
|
||||
Status = "Published",
|
||||
Title = "Développement Web Moderne avec React",
|
||||
UpdatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"),
|
||||
CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
CreatorId = new Guid("22222222-2222-2222-2222-222222222222"),
|
||||
Description = "Apprenez à construire des APIs REST robustes avec ASP.NET Core et FastEndpoints.",
|
||||
Status = "Draft",
|
||||
Title = "API REST avec .NET et FastEndpoints",
|
||||
UpdatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.Resource", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Resources");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("ffffffff-ffff-ffff-ffff-ffffffffffff"),
|
||||
Content = "https://youtube.com/watch?v=example1",
|
||||
CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
Title = "React en 30 minutes",
|
||||
Type = "Video"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("00000000-0000-0000-aaaa-000000000001"),
|
||||
Content = "Les hooks permettent d'utiliser le state et d'autres fonctionnalités React dans des composants fonctionnels.",
|
||||
CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
Title = "Guide des Hooks",
|
||||
Type = "Text"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("00000000-0000-0000-aaaa-000000000002"),
|
||||
Content = "https://react.dev",
|
||||
CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
Title = "Documentation officielle React",
|
||||
Type = "Url"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.Topic", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("CourseId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Position")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CourseId");
|
||||
|
||||
b.ToTable("Topics");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("cccccccc-cccc-cccc-cccc-cccccccccccc"),
|
||||
CourseId = new Guid("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"),
|
||||
Description = "Les bases de React : composants, JSX, props.",
|
||||
Position = 1,
|
||||
Title = "Introduction à React"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("dddddddd-dddd-dddd-dddd-dddddddddddd"),
|
||||
CourseId = new Guid("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"),
|
||||
Description = "useState, useEffect et hooks personnalisés.",
|
||||
Position = 2,
|
||||
Title = "Hooks et State"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee"),
|
||||
CourseId = new Guid("bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"),
|
||||
Description = "Principes REST et verbes HTTP.",
|
||||
Position = 1,
|
||||
Title = "Fondamentaux REST"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.TopicResource", b =>
|
||||
{
|
||||
b.Property<Guid>("TopicId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("ResourceId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("Position")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("TopicId", "ResourceId");
|
||||
|
||||
b.HasIndex("ResourceId");
|
||||
|
||||
b.ToTable("TopicResources");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
TopicId = new Guid("cccccccc-cccc-cccc-cccc-cccccccccccc"),
|
||||
ResourceId = new Guid("ffffffff-ffff-ffff-ffff-ffffffffffff"),
|
||||
Position = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
TopicId = new Guid("cccccccc-cccc-cccc-cccc-cccccccccccc"),
|
||||
ResourceId = new Guid("00000000-0000-0000-aaaa-000000000002"),
|
||||
Position = 2
|
||||
},
|
||||
new
|
||||
{
|
||||
TopicId = new Guid("dddddddd-dddd-dddd-dddd-dddddddddddd"),
|
||||
ResourceId = new Guid("00000000-0000-0000-aaaa-000000000001"),
|
||||
Position = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.User", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Users");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("11111111-1111-1111-1111-111111111111"),
|
||||
CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
Email = "alice@metacourse.io",
|
||||
Name = "Alice Dupont",
|
||||
PasswordHash = "$2a$11$iVlx6m6E1Nlwe5EuA1m4XeJoWc1P2fgS5i1iwEVo2xYbRNt9gSdFe"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("22222222-2222-2222-2222-222222222222"),
|
||||
CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
Email = "bob@metacourse.io",
|
||||
Name = "Bob Martin",
|
||||
PasswordHash = "$2a$11$LIWuKuO3ful3H1AjoRI1n.kmjW9n05alzfOyMCI0iIIO28q5cSOKu"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.UserCourse", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("CourseId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime?>("CompletedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("EnrolledAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("UserId", "CourseId");
|
||||
|
||||
b.HasIndex("CourseId");
|
||||
|
||||
b.ToTable("UserCourses");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
UserId = new Guid("22222222-2222-2222-2222-222222222222"),
|
||||
CourseId = new Guid("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"),
|
||||
EnrolledAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.UserResourceProgress", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("ResourceId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<bool>("Completed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime?>("CompletedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("UserId", "ResourceId");
|
||||
|
||||
b.HasIndex("ResourceId");
|
||||
|
||||
b.ToTable("UserResourceProgresses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.UserTopicProgress", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("TopicId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<bool>("Completed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime?>("CompletedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("UserId", "TopicId");
|
||||
|
||||
b.HasIndex("TopicId");
|
||||
|
||||
b.ToTable("UserTopicProgresses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.Course", b =>
|
||||
{
|
||||
b.HasOne("MetaCourse.Api.Entities.User", "Creator")
|
||||
.WithMany("CreatedCourses")
|
||||
.HasForeignKey("CreatorId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Creator");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.Topic", b =>
|
||||
{
|
||||
b.HasOne("MetaCourse.Api.Entities.Course", "Course")
|
||||
.WithMany("Topics")
|
||||
.HasForeignKey("CourseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Course");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.TopicResource", b =>
|
||||
{
|
||||
b.HasOne("MetaCourse.Api.Entities.Resource", "Resource")
|
||||
.WithMany("TopicResources")
|
||||
.HasForeignKey("ResourceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("MetaCourse.Api.Entities.Topic", "Topic")
|
||||
.WithMany("TopicResources")
|
||||
.HasForeignKey("TopicId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Resource");
|
||||
|
||||
b.Navigation("Topic");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.UserCourse", b =>
|
||||
{
|
||||
b.HasOne("MetaCourse.Api.Entities.Course", "Course")
|
||||
.WithMany("UserCourses")
|
||||
.HasForeignKey("CourseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("MetaCourse.Api.Entities.User", "User")
|
||||
.WithMany("UserCourses")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Course");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.UserResourceProgress", b =>
|
||||
{
|
||||
b.HasOne("MetaCourse.Api.Entities.Resource", "Resource")
|
||||
.WithMany("UserProgresses")
|
||||
.HasForeignKey("ResourceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("MetaCourse.Api.Entities.User", "User")
|
||||
.WithMany("ResourceProgresses")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Resource");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.UserTopicProgress", b =>
|
||||
{
|
||||
b.HasOne("MetaCourse.Api.Entities.Topic", "Topic")
|
||||
.WithMany("UserProgresses")
|
||||
.HasForeignKey("TopicId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("MetaCourse.Api.Entities.User", "User")
|
||||
.WithMany("TopicProgresses")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Topic");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.Course", b =>
|
||||
{
|
||||
b.Navigation("Topics");
|
||||
|
||||
b.Navigation("UserCourses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.Resource", b =>
|
||||
{
|
||||
b.Navigation("TopicResources");
|
||||
|
||||
b.Navigation("UserProgresses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.Topic", b =>
|
||||
{
|
||||
b.Navigation("TopicResources");
|
||||
|
||||
b.Navigation("UserProgresses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MetaCourse.Api.Entities.User", b =>
|
||||
{
|
||||
b.Navigation("CreatedCourses");
|
||||
|
||||
b.Navigation("ResourceProgresses");
|
||||
|
||||
b.Navigation("TopicProgresses");
|
||||
|
||||
b.Navigation("UserCourses");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user