Refactor UserAccount repository methods and add stored procedures for user account management

This commit is contained in:
Aaron Po
2025-12-06 23:06:13 -05:00
parent 00a0f6c4ef
commit 8d6b903aa7
5 changed files with 146 additions and 221 deletions

View File

@@ -1,3 +1,33 @@
// Load a local .env file into environment variables when present (useful for local development)
try
{
var envPath = Path.Combine(Directory.GetCurrentDirectory(), ".env");
if (File.Exists(envPath))
{
foreach (var line in File.ReadAllLines(envPath))
{
var trimmed = line.Trim();
if (string.IsNullOrEmpty(trimmed) || trimmed.StartsWith("#"))
continue;
var idx = trimmed.IndexOf('=');
if (idx <= 0)
continue;
var key = trimmed.Substring(0, idx).Trim();
var val = trimmed.Substring(idx + 1).Trim();
if (val.Length >= 2 && ((val.StartsWith("\"") && val.EndsWith("\"")) || (val.StartsWith("'") && val.EndsWith("'"))))
{
val = val.Substring(1, val.Length - 2);
}
if (Environment.GetEnvironmentVariable(key) == null)
Environment.SetEnvironmentVariable(key, val);
}
}
}
catch
{
// If dotenv loading fails, continue without blocking startup.
}
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.