first commit

This commit is contained in:
Vitalii Litvinchuk
2026-06-13 23:23:50 +03:00
commit 23958e8e2c
72 changed files with 6142 additions and 0 deletions
@@ -0,0 +1,27 @@
using Microsoft.EntityFrameworkCore;
using SequenceAuth.Example.Domain;
namespace SequenceAuth.Example.Infrastructure;
public class AppDbContext(DbContextOptions<AppDbContext> options) : DbContext(options)
{
public DbSet<User> Users => Set<User>();
public DbSet<TodoItem> Todos => Set<TodoItem>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Username).IsRequired();
entity.HasIndex(e => e.Username).IsUnique();
});
modelBuilder.Entity<TodoItem>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Title).IsRequired();
entity.Property(e => e.Status).HasConversion<string>();
});
}
}
@@ -0,0 +1,21 @@
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Routing;
namespace SequenceAuth.Example.Infrastructure;
public class KebabCaseParameterTransformer : IOutboundParameterTransformer
{
public string? TransformOutbound(object? value)
{
return value == null ? null : value.ToString()!.ToKebabCase();
}
}
public static partial class StringExtension
{
[GeneratedRegex("([a-z0-9])([A-Z])", RegexOptions.Compiled)]
private static partial Regex KebabCaseRule();
public static string ToKebabCase(this string input)
=> KebabCaseRule().Replace(input, "$1-$2").ToLower().Trim('-');
}