- Add QuizQuestion and QuizOption domain entities with QuestionType enum - Add IQuizQuestionRepository and IQuizOptionRepository interfaces - Add QuizQuestionRepository and QuizOptionRepository EF Core implementations - Add QuizQuestionService with CRUD, quiz submission, and statistics - Add QuizQuestionsController with comprehensive REST API endpoints - Add QuizQuestionDto and related DTOs for API communication - Add EF Core migration (20260612050652_AddQuizQuestionTables) for QuizQuestion and QuizOption - Add seed data with sample quiz questions for Greetings, Numbers, Grammar lessons - Update AppDbContext with DbSets and entity configurations - Update Program.cs with migration retry logic for Docker - Update docker-compose.yml with SeedDatabase configuration - Add unit tests for QuizQuestionService Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
387 lines
14 KiB
C#
387 lines
14 KiB
C#
// <auto-generated />
|
|
using System;
|
|
using GermanApp.Infrastructure.Data.DbContext;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace GermanApp.Migrations
|
|
{
|
|
[DbContext(typeof(AppDbContext))]
|
|
partial class AppDbContextModelSnapshot : ModelSnapshot
|
|
{
|
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
|
{
|
|
#pragma warning disable 612, 618
|
|
modelBuilder
|
|
.HasAnnotation("ProductVersion", "9.0.0")
|
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
|
|
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
|
|
|
modelBuilder.Entity("GermanApp.Domain.Entities.Lesson", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<string>("Description")
|
|
.IsRequired()
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("character varying(2000)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("boolean")
|
|
.HasDefaultValue(true);
|
|
|
|
b.Property<int>("LevelId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int>("Order")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("Title")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("character varying(200)");
|
|
|
|
b.Property<string>("Topic")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("character varying(100)");
|
|
|
|
b.Property<DateTime?>("UpdatedAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("LevelId", "Order")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Lessons");
|
|
});
|
|
|
|
modelBuilder.Entity("GermanApp.Domain.Entities.Level", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Code")
|
|
.IsRequired()
|
|
.HasMaxLength(10)
|
|
.HasColumnType("character varying(10)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("character varying(100)");
|
|
|
|
b.Property<int>("Order")
|
|
.HasColumnType("integer");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Code")
|
|
.IsUnique();
|
|
|
|
b.HasIndex("Order")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Levels");
|
|
});
|
|
|
|
modelBuilder.Entity("GermanApp.Domain.Entities.QuizOption", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<bool>("IsCorrect")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("boolean")
|
|
.HasDefaultValue(false);
|
|
|
|
b.Property<int>("Order")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer")
|
|
.HasDefaultValue(1);
|
|
|
|
b.Property<int>("QuizQuestionId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("Text")
|
|
.IsRequired()
|
|
.HasMaxLength(1000)
|
|
.HasColumnType("character varying(1000)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("QuizQuestionId", "Order")
|
|
.IsUnique();
|
|
|
|
b.ToTable("QuizOptions");
|
|
});
|
|
|
|
modelBuilder.Entity("GermanApp.Domain.Entities.QuizQuestion", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("CorrectAnswer")
|
|
.HasMaxLength(1000)
|
|
.HasColumnType("character varying(1000)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<int>("Difficulty")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer")
|
|
.HasDefaultValue(3);
|
|
|
|
b.Property<bool>("IsActive")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("boolean")
|
|
.HasDefaultValue(true);
|
|
|
|
b.Property<int>("LessonId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int>("Order")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer")
|
|
.HasDefaultValue(1);
|
|
|
|
b.Property<string>("QuestionText")
|
|
.IsRequired()
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("character varying(2000)");
|
|
|
|
b.Property<int>("Type")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<DateTime?>("UpdatedAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("LessonId", "Order")
|
|
.IsUnique();
|
|
|
|
b.ToTable("QuizQuestions");
|
|
});
|
|
|
|
modelBuilder.Entity("GermanApp.Domain.Entities.RefreshToken", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<DateTime>("ExpiresAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("boolean")
|
|
.HasDefaultValue(true);
|
|
|
|
b.Property<DateTime?>("RevokedAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<string>("Token")
|
|
.IsRequired()
|
|
.HasMaxLength(255)
|
|
.HasColumnType("character varying(255)");
|
|
|
|
b.Property<int>("UserId")
|
|
.HasColumnType("integer");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("UserId");
|
|
|
|
b.ToTable("RefreshTokens");
|
|
});
|
|
|
|
modelBuilder.Entity("GermanApp.Domain.Entities.User", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<string>("CurrentLevel")
|
|
.IsRequired()
|
|
.ValueGeneratedOnAdd()
|
|
.HasMaxLength(10)
|
|
.HasColumnType("character varying(10)")
|
|
.HasDefaultValue("A1");
|
|
|
|
b.Property<string>("Email")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("character varying(100)");
|
|
|
|
b.Property<string>("PasswordHash")
|
|
.IsRequired()
|
|
.HasMaxLength(255)
|
|
.HasColumnType("character varying(255)");
|
|
|
|
b.Property<int>("Streak")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer")
|
|
.HasDefaultValue(0);
|
|
|
|
b.Property<int>("TotalPoints")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer")
|
|
.HasDefaultValue(0);
|
|
|
|
b.Property<string>("Username")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("character varying(50)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Email")
|
|
.IsUnique();
|
|
|
|
b.HasIndex("Username")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Users");
|
|
});
|
|
|
|
modelBuilder.Entity("GermanApp.Domain.Entities.UserProgress", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<bool>("IsCompleted")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("boolean")
|
|
.HasDefaultValue(false);
|
|
|
|
b.Property<DateTime>("LastAttemptDate")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<int>("LessonId")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int>("QuizScore")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer")
|
|
.HasDefaultValue(0);
|
|
|
|
b.Property<int>("UserId")
|
|
.HasColumnType("integer");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("LessonId");
|
|
|
|
b.HasIndex("UserId", "LessonId")
|
|
.IsUnique();
|
|
|
|
b.ToTable("UserProgress");
|
|
});
|
|
|
|
modelBuilder.Entity("GermanApp.Domain.Entities.Lesson", b =>
|
|
{
|
|
b.HasOne("GermanApp.Domain.Entities.Level", "Level")
|
|
.WithMany()
|
|
.HasForeignKey("LevelId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Level");
|
|
});
|
|
|
|
modelBuilder.Entity("GermanApp.Domain.Entities.QuizOption", b =>
|
|
{
|
|
b.HasOne("GermanApp.Domain.Entities.QuizQuestion", "QuizQuestion")
|
|
.WithMany("Options")
|
|
.HasForeignKey("QuizQuestionId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("QuizQuestion");
|
|
});
|
|
|
|
modelBuilder.Entity("GermanApp.Domain.Entities.QuizQuestion", b =>
|
|
{
|
|
b.HasOne("GermanApp.Domain.Entities.Lesson", "Lesson")
|
|
.WithMany()
|
|
.HasForeignKey("LessonId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Lesson");
|
|
});
|
|
|
|
modelBuilder.Entity("GermanApp.Domain.Entities.RefreshToken", b =>
|
|
{
|
|
b.HasOne("GermanApp.Domain.Entities.User", null)
|
|
.WithMany()
|
|
.HasForeignKey("UserId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("GermanApp.Domain.Entities.UserProgress", b =>
|
|
{
|
|
b.HasOne("GermanApp.Domain.Entities.Lesson", "Lesson")
|
|
.WithMany()
|
|
.HasForeignKey("LessonId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("GermanApp.Domain.Entities.User", "User")
|
|
.WithMany()
|
|
.HasForeignKey("UserId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Lesson");
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("GermanApp.Domain.Entities.QuizQuestion", b =>
|
|
{
|
|
b.Navigation("Options");
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|