first commit

This commit is contained in:
2026-06-03 18:31:41 +03:30
commit 01f87cc461
71 changed files with 10802 additions and 0 deletions

View File

@@ -0,0 +1,381 @@
// <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 backend.Data;
#nullable disable
namespace backend.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260603142557_AddKhatmItemUrl")]
partial class AddKhatmItemUrl
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("backend.Models.KhatmItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Points")
.HasColumnType("int");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("Url")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.HasKey("Id");
b.ToTable("KhatmItems");
b.HasData(
new
{
Id = 1,
Points = 5,
Title = "ختم نادعلی",
Url = "https://example.com/khatm/nadali"
},
new
{
Id = 2,
Points = 10,
Title = "خطبه غدیر",
Url = "https://example.com/khatm/ghadir"
},
new
{
Id = 3,
Points = 7,
Title = "دعای توسل",
Url = "https://example.com/khatm/tavassol"
});
});
modelBuilder.Entity("backend.Models.QuizQuestion", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CorrectOption")
.HasColumnType("int");
b.Property<string>("Option1")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("Option2")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("Option3")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("Option4")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("QuestionText")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.HasKey("Id");
b.ToTable("QuizQuestions");
b.HasData(
new
{
Id = 1,
CorrectOption = 1,
Option1 = "سال ۱۰ هجری",
Option2 = "سال ۱۱ هجری",
Option3 = "سال ۹ هجری",
Option4 = "سال ۱۲ هجری",
QuestionText = "غدیر در چه سالی واقع شد؟"
},
new
{
Id = 2,
CorrectOption = 3,
Option1 = "ابوبکر",
Option2 = "عمر",
Option3 = "علی (ع)",
Option4 = "عثمان",
QuestionText = "پیامبر اکرم (ص) در غدیر چه کسی را به عنوان جانشین معرفی کردند؟"
},
new
{
Id = 3,
CorrectOption = 2,
Option1 = "مسجد النبی",
Option2 = "غدیر خم",
Option3 = "مکه",
Option4 = "مدینه",
QuestionText = "خطبه غدیر در کجا ایراد شد؟"
});
});
modelBuilder.Entity("backend.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Contact")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("FullName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("TrackingCode")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("nvarchar(8)");
b.HasKey("Id");
b.HasIndex("Contact")
.IsUnique();
b.HasIndex("TrackingCode")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("backend.Models.UserKhatmSelection", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("IsSelected")
.HasColumnType("bit");
b.Property<int>("KhatmItemId")
.HasColumnType("int");
b.Property<DateTime>("LastModified")
.HasColumnType("datetime2");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("KhatmItemId");
b.HasIndex("UserId", "KhatmItemId")
.IsUnique();
b.ToTable("UserKhatmSelections");
});
modelBuilder.Entity("backend.Models.UserQuizAnswer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("IsCorrect")
.HasColumnType("bit");
b.Property<int>("QuestionId")
.HasColumnType("int");
b.Property<int>("SelectedOption")
.HasColumnType("int");
b.Property<int>("UserQuizAttemptId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("QuestionId");
b.HasIndex("UserQuizAttemptId");
b.ToTable("UserQuizAnswers");
});
modelBuilder.Entity("backend.Models.UserQuizAttempt", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("CompletedAt")
.HasColumnType("datetime2");
b.Property<int>("CorrectAnswersCount")
.HasColumnType("int");
b.Property<int>("ParticipationPoints")
.HasColumnType("int");
b.Property<int>("TotalQuizPoints")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("UserQuizAttempts");
});
modelBuilder.Entity("backend.Models.UserTotalScore", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("TotalPoints")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("UserTotalScores");
});
modelBuilder.Entity("backend.Models.UserKhatmSelection", b =>
{
b.HasOne("backend.Models.KhatmItem", "KhatmItem")
.WithMany("UserSelections")
.HasForeignKey("KhatmItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("backend.Models.User", "User")
.WithMany("KhatmSelections")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("KhatmItem");
b.Navigation("User");
});
modelBuilder.Entity("backend.Models.UserQuizAnswer", b =>
{
b.HasOne("backend.Models.QuizQuestion", "Question")
.WithMany("Answers")
.HasForeignKey("QuestionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("backend.Models.UserQuizAttempt", "QuizAttempt")
.WithMany("Answers")
.HasForeignKey("UserQuizAttemptId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Question");
b.Navigation("QuizAttempt");
});
modelBuilder.Entity("backend.Models.UserQuizAttempt", b =>
{
b.HasOne("backend.Models.User", "User")
.WithOne("QuizAttempt")
.HasForeignKey("backend.Models.UserQuizAttempt", "UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("backend.Models.UserTotalScore", b =>
{
b.HasOne("backend.Models.User", "User")
.WithOne("TotalScore")
.HasForeignKey("backend.Models.UserTotalScore", "UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("backend.Models.KhatmItem", b =>
{
b.Navigation("UserSelections");
});
modelBuilder.Entity("backend.Models.QuizQuestion", b =>
{
b.Navigation("Answers");
});
modelBuilder.Entity("backend.Models.User", b =>
{
b.Navigation("KhatmSelections");
b.Navigation("QuizAttempt");
b.Navigation("TotalScore");
});
modelBuilder.Entity("backend.Models.UserQuizAttempt", b =>
{
b.Navigation("Answers");
});
#pragma warning restore 612, 618
}
}
}