feat: harden auth ops and deployment baseline

This commit is contained in:
2026-06-27 10:53:53 +09:00
parent a6ca30eec8
commit 28060b71be
41 changed files with 714 additions and 208 deletions
@@ -169,8 +169,8 @@ public class MigrationRunner
private class Migration
{
public string Version { get; set; }
public string Description { get; set; }
public string Sql { get; set; }
public required string Version { get; set; }
public required string Description { get; set; }
public required string Sql { get; set; }
}
}
@@ -49,4 +49,20 @@ public class AdminUserRepository : BaseRepository, IAdminUserRepository
"INSERT INTO admin_users (username, password_hash, created_at) VALUES (@username, @passwordHash, NOW())",
new { username = user.Username, passwordHash = user.PasswordHash });
}
public async Task UpdatePasswordHashAsync(int id, string passwordHash)
{
using var conn = _connectionFactory.CreateConnection();
await conn.ExecuteAsync(
"UPDATE admin_users SET password_hash = @passwordHash WHERE id = @id",
new { id, passwordHash });
}
public async Task UpdateLastLoginAtAsync(int id)
{
using var conn = _connectionFactory.CreateConnection();
await conn.ExecuteAsync(
"UPDATE admin_users SET last_login_at = NOW() WHERE id = @id",
new { id });
}
}
@@ -6,7 +6,7 @@
<PackageReference Include="Dapper" Version="2.1.15" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Npgsql" Version="8.0.1" />
<PackageReference Include="Npgsql" Version="10.0.3" />
</ItemGroup>
<ItemGroup>