- Fix MSTest compatibility with .NET 9.0 by upgrading to MSTest.TestFramework 4.2.3 - Move Tests directory to solution level (Tests/) to prevent test files from being compiled with GermanApp - Update test project references to point to GermanApp/GermanApp.csproj - Add InternalsVisibleTo attributes for test assemblies - Make RefreshToken properties internal for testability - Fix User.ChangeEmail null handling - Add 46 comprehensive unit tests for User and RefreshToken domain entities - All tests passing successfully Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
162 lines
5.7 KiB
C#
162 lines
5.7 KiB
C#
// <auto-generated />
|
|
using System;
|
|
using GermanApp.Infrastructure.Data.DbContext;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace GermanApp.Infrastructure.Data.Migrations
|
|
{
|
|
[DbContext(typeof(AppDbContext))]
|
|
[Migration("20260605131551_AddRefreshTokensTable")]
|
|
partial class AddRefreshTokensTable
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void BuildTargetModel(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<int>("Level")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("Title")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("character varying(200)");
|
|
|
|
b.Property<DateTime?>("UpdatedAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("Lessons");
|
|
});
|
|
|
|
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.RefreshToken", b =>
|
|
{
|
|
b.HasOne("GermanApp.Domain.Entities.User", null)
|
|
.WithMany()
|
|
.HasForeignKey("UserId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|