Add initial implementation of API, database, and user management components.

This commit is contained in:
2026-03-15 23:17:51 +01:00
commit 0543120f3b
53 changed files with 2241 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore;
using MikrocopDb.Entities;
namespace MikrocopDb;
public sealed class AppDbContext : DbContext
{
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
{
}
public DbSet<UserEntity> Users => Set<UserEntity>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<UserEntity>(entity =>
{
entity.HasKey(x => x.Id);
entity.Property(x => x.UserName).HasMaxLength(100).IsRequired();
entity.Property(x => x.FullName).HasMaxLength(200).IsRequired();
entity.Property(x => x.Email).HasMaxLength(200).IsRequired();
entity.Property(x => x.MobileNumber).HasMaxLength(30).IsRequired();
entity.Property(x => x.Language).HasMaxLength(20).IsRequired();
entity.Property(x => x.Culture).HasMaxLength(20).IsRequired();
entity.Property(x => x.PasswordHash).IsRequired();
entity.Property(x => x.PasswordSalt).HasMaxLength(128).IsRequired();
entity.HasIndex(x => x.UserName).IsUnique();
entity.HasIndex(x => x.Email).IsUnique();
});
}
}