This commit is contained in:
2025-09-12 14:18:08 +04:30
parent ad4c92f4c0
commit 338895a1ad
48 changed files with 361 additions and 357 deletions
@@ -15,6 +15,7 @@ internal class FileGroupConfiguration : IEntityTypeConfiguration<FileGroup>
builder.Property(x => x.Id)
.ValueGeneratedOnAdd()
.HasConversion(x => x.Value, x => new Domain.TypeIds.FileGroupId(x));
builder.Property(x => x.Title)
.HasColumnName("Title")
.HasConversion(x => x.Value, x => new FileGroupTitle(x));
@@ -12,7 +12,8 @@ internal class MediaConfiguration : IEntityTypeConfiguration<Media>
builder.HasKey(x => x.Id);
builder.Property(x => x.Id)
.HasConversion(x => x.Value, x => new Domain.TypeIds.MediaId(x));
.HasConversion(x => x.Value, x => new Domain.TypeIds.MediaId(x))
.ValueGeneratedOnAdd();
builder.Property(x => x.Name)
.HasMaxLength(150);
@@ -24,10 +25,6 @@ internal class MediaConfiguration : IEntityTypeConfiguration<Media>
op.Property(x => x.Type)
.HasColumnName("EntityType")
.HasMaxLength(200);
op.Property(x => x.EntityId)
.HasColumnName("EntityId")
.HasMaxLength(50);
});
}
}
@@ -10,6 +10,7 @@ using VizhTalk.BuildingBlocks.Application.Outbox;
using VizhTalk.BuildingBlocks.Infrastructure;
using VizhTalk.BuildingBlocks.Infrastructure.DomainEventsDispatching;
using VizhTalk.Grpc.CDN;
using VizhTalk.Grpc.Learning.Language;
using VizhTalk.Learning.Application;
using VizhTalk.Learning.Application.Mappers;
using VizhTalk.Learning.Infrastructure.Configuration;
@@ -29,6 +30,10 @@ public static class LearningStartup
{
op.UseSqlServer(connectionString);
});
services.AddGrpcClient<CDNGrpc.CDNGrpcClient>(o =>
{
o.Address = new Uri("https://localhost:5001");
});
services.AddScoped<DbContext>(sp => sp.GetService<LearningDbContext>());
services.AddScoped<ILearningModule, LearningModule>();
services.AddScoped<IExecutor, LearningModule>();
@@ -1,183 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using VizhTalk.Learning.Infrastructure.EF;
#nullable disable
namespace VizhTalk.Learning.Infrastructure.Migrations
{
[DbContext(typeof(LearningDbContext))]
[Migration("20250905153842_initial")]
partial class initial
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("Learning")
.HasAnnotation("ProductVersion", "8.0.19")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("VizhTalk.Learning.Domain.Entities.FileGroup", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<DateTime>("CreateOn")
.HasColumnType("datetime2");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<bool>("IsSecure")
.HasColumnType("bit");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("nvarchar(150)")
.HasColumnName("Key");
b.Property<DateTime>("LastUpdate")
.HasColumnType("datetime2");
b.Property<long>("MediaGroupId")
.HasColumnType("bigint");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnName("Title");
b.HasKey("Id");
b.ToTable("FileGroups", "Attachment");
});
modelBuilder.Entity("VizhTalk.Learning.Domain.Entities.Language", b =>
{
b.Property<short>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("smallint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<short>("Id"));
b.Property<DateTime>("CreateOn")
.HasColumnType("datetime2");
b.Property<Guid>("IconId")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<DateTime>("LastUpdate")
.HasColumnType("datetime2");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b.HasKey("Id");
b.HasIndex("IconId");
b.ToTable("Languages", "Learning");
});
modelBuilder.Entity("VizhTalk.Learning.Domain.Entities.Media", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("ContentType")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreateOn")
.HasColumnType("datetime2");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<DateTime>("LastUpdate")
.HasColumnType("datetime2");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("nvarchar(150)");
b.Property<int>("Size")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Medias", "Learning");
});
modelBuilder.Entity("VizhTalk.Learning.Domain.Entities.Language", b =>
{
b.HasOne("VizhTalk.Learning.Domain.Entities.Media", "Icon")
.WithMany()
.HasForeignKey("IconId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Icon");
});
modelBuilder.Entity("VizhTalk.Learning.Domain.Entities.Media", b =>
{
b.OwnsOne("VizhTalk.Learning.Domain.ValueObjects.EntityType", "EntityType", b1 =>
{
b1.Property<Guid>("MediaId")
.HasColumnType("uniqueidentifier");
b1.Property<string>("EntityId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)")
.HasColumnName("EntityId");
b1.Property<int>("Type")
.HasMaxLength(200)
.HasColumnType("int")
.HasColumnName("EntityType");
b1.HasKey("MediaId");
b1.ToTable("Medias", "Learning");
b1.WithOwner()
.HasForeignKey("MediaId");
});
b.Navigation("EntityType")
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
@@ -1,69 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace VizhTalk.Learning.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class Course : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Courses",
schema: "Learning",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
ImageId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Order = table.Column<int>(type: "int", nullable: false),
LanguageId = table.Column<short>(type: "smallint", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
IsActive = table.Column<bool>(type: "bit", nullable: false),
CreateOn = table.Column<DateTime>(type: "datetime2", nullable: false),
LastUpdate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Courses", x => x.Id);
table.ForeignKey(
name: "FK_Courses_Languages_LanguageId",
column: x => x.LanguageId,
principalSchema: "Learning",
principalTable: "Languages",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Courses_Medias_ImageId",
column: x => x.ImageId,
principalSchema: "Learning",
principalTable: "Medias",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Courses_ImageId",
schema: "Learning",
table: "Courses",
column: "ImageId");
migrationBuilder.CreateIndex(
name: "IX_Courses_LanguageId",
schema: "Learning",
table: "Courses",
column: "LanguageId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Courses",
schema: "Learning");
}
}
}
@@ -12,8 +12,8 @@ using VizhTalk.Learning.Infrastructure.EF;
namespace VizhTalk.Learning.Infrastructure.Migrations
{
[DbContext(typeof(LearningDbContext))]
[Migration("20250907192005_Course")]
partial class Course
[Migration("20250912083328_initial")]
partial class initial
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -37,8 +37,8 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
b.Property<DateTime>("CreateOn")
.HasColumnType("datetime2");
b.Property<Guid>("ImageId")
.HasColumnType("uniqueidentifier");
b.Property<long>("ImageId")
.HasColumnType("bigint");
b.Property<bool>("IsActive")
.HasColumnType("bit");
@@ -97,8 +97,8 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
b.Property<DateTime>("LastUpdate")
.HasColumnType("datetime2");
b.Property<long>("MediaGroupId")
.HasColumnType("bigint");
b.Property<Guid>("MediaGroupId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Title")
.IsRequired()
@@ -121,8 +121,8 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
b.Property<DateTime>("CreateOn")
.HasColumnType("datetime2");
b.Property<Guid>("IconId")
.HasColumnType("uniqueidentifier");
b.Property<long>("IconId")
.HasColumnType("bigint");
b.Property<bool>("IsActive")
.HasColumnType("bit");
@@ -147,8 +147,11 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
modelBuilder.Entity("VizhTalk.Learning.Domain.Entities.Media", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<string>("ContentType")
.IsRequired()
@@ -157,6 +160,9 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
b.Property<DateTime>("CreateOn")
.HasColumnType("datetime2");
b.Property<Guid>("FileId")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsActive")
.HasColumnType("bit");
@@ -209,14 +215,8 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
{
b.OwnsOne("VizhTalk.Learning.Domain.ValueObjects.EntityType", "EntityType", b1 =>
{
b1.Property<Guid>("MediaId")
.HasColumnType("uniqueidentifier");
b1.Property<string>("EntityId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)")
.HasColumnName("EntityId");
b1.Property<long>("MediaId")
.HasColumnType("bigint");
b1.Property<int>("Type")
.HasMaxLength(200)
@@ -12,10 +12,10 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "Attachment");
name: "Learning");
migrationBuilder.EnsureSchema(
name: "Learning");
name: "Attachment");
migrationBuilder.CreateTable(
name: "FileGroups",
@@ -26,7 +26,7 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
Key = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false),
MediaGroupId = table.Column<long>(type: "bigint", nullable: false),
MediaGroupId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
IsSecure = table.Column<bool>(type: "bit", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
IsActive = table.Column<bool>(type: "bit", nullable: false),
@@ -43,11 +43,12 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
schema: "Learning",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false),
ContentType = table.Column<string>(type: "nvarchar(max)", nullable: false),
Size = table.Column<int>(type: "int", nullable: false),
EntityId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
FileId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
EntityType = table.Column<int>(type: "int", maxLength: 200, nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
IsActive = table.Column<bool>(type: "bit", nullable: false),
@@ -67,7 +68,7 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
Id = table.Column<short>(type: "smallint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: false),
IconId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
IconId = table.Column<long>(type: "bigint", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
IsActive = table.Column<bool>(type: "bit", nullable: false),
CreateOn = table.Column<DateTime>(type: "datetime2", nullable: false),
@@ -85,6 +86,52 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Courses",
schema: "Learning",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
ImageId = table.Column<long>(type: "bigint", nullable: false),
Order = table.Column<int>(type: "int", nullable: false),
LanguageId = table.Column<short>(type: "smallint", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
IsActive = table.Column<bool>(type: "bit", nullable: false),
CreateOn = table.Column<DateTime>(type: "datetime2", nullable: false),
LastUpdate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Courses", x => x.Id);
table.ForeignKey(
name: "FK_Courses_Languages_LanguageId",
column: x => x.LanguageId,
principalSchema: "Learning",
principalTable: "Languages",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Courses_Medias_ImageId",
column: x => x.ImageId,
principalSchema: "Learning",
principalTable: "Medias",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Courses_ImageId",
schema: "Learning",
table: "Courses",
column: "ImageId");
migrationBuilder.CreateIndex(
name: "IX_Courses_LanguageId",
schema: "Learning",
table: "Courses",
column: "LanguageId");
migrationBuilder.CreateIndex(
name: "IX_Languages_IconId",
schema: "Learning",
@@ -95,6 +142,10 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Courses",
schema: "Learning");
migrationBuilder.DropTable(
name: "FileGroups",
schema: "Attachment");
@@ -34,8 +34,8 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
b.Property<DateTime>("CreateOn")
.HasColumnType("datetime2");
b.Property<Guid>("ImageId")
.HasColumnType("uniqueidentifier");
b.Property<long>("ImageId")
.HasColumnType("bigint");
b.Property<bool>("IsActive")
.HasColumnType("bit");
@@ -94,8 +94,8 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
b.Property<DateTime>("LastUpdate")
.HasColumnType("datetime2");
b.Property<long>("MediaGroupId")
.HasColumnType("bigint");
b.Property<Guid>("MediaGroupId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Title")
.IsRequired()
@@ -118,8 +118,8 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
b.Property<DateTime>("CreateOn")
.HasColumnType("datetime2");
b.Property<Guid>("IconId")
.HasColumnType("uniqueidentifier");
b.Property<long>("IconId")
.HasColumnType("bigint");
b.Property<bool>("IsActive")
.HasColumnType("bit");
@@ -144,8 +144,11 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
modelBuilder.Entity("VizhTalk.Learning.Domain.Entities.Media", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<string>("ContentType")
.IsRequired()
@@ -154,6 +157,9 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
b.Property<DateTime>("CreateOn")
.HasColumnType("datetime2");
b.Property<Guid>("FileId")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsActive")
.HasColumnType("bit");
@@ -206,14 +212,8 @@ namespace VizhTalk.Learning.Infrastructure.Migrations
{
b.OwnsOne("VizhTalk.Learning.Domain.ValueObjects.EntityType", "EntityType", b1 =>
{
b1.Property<Guid>("MediaId")
.HasColumnType("uniqueidentifier");
b1.Property<string>("EntityId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)")
.HasColumnName("EntityId");
b1.Property<long>("MediaId")
.HasColumnType("bigint");
b1.Property<int>("Type")
.HasMaxLength(200)