Files
ChronoCCG/Chrono/DatabaseTest/Models/DatabaseModels.cs
T
6d486f49 09a8adfc4a Test
2026-08-14 17:19:24 -04:00

78 lines
2.4 KiB
C#

namespace DatabaseTest.Models;
public class DatabaseHealthStatus
{
public bool IsConnected { get; set; }
public DatabaseProviderType ProviderType { get; set; }
public string ProviderName { get; set; } = string.Empty;
public string ConnectionString { get; set; } = string.Empty;
public long ResponseTimeMs { get; set; }
public int CardNotesCount { get; set; }
public int UserDecksCount { get; set; }
public int PasskeysCount { get; set; }
public int PendingMigrationsCount { get; set; }
public int AppliedMigrationsCount { get; set; }
public string? ErrorMessage { get; set; }
public DateTime CheckedAt { get; set; } = DateTime.UtcNow;
}
public class OperationResult
{
public bool Success { get; set; }
public string Message { get; set; } = string.Empty;
public string? ErrorDetails { get; set; }
public static OperationResult Ok(string message) => new() { Success = true, Message = message };
public static OperationResult Fail(string message, string? errorDetails = null) => new()
{
Success = false,
Message = message,
ErrorDetails = errorDetails
};
}
public class SeedResult
{
public bool Success { get; set; }
public int CardNotesSeeded { get; set; }
public int UserDecksSeeded { get; set; }
public int PasskeysSeeded { get; set; }
public string Message { get; set; } = string.Empty;
}
public class MigrationReport
{
public DatabaseProviderType ProviderType { get; set; }
public List<string> AppliedMigrations { get; set; } = [];
public List<string> PendingMigrations { get; set; } = [];
public bool SupportsMigrations { get; set; }
public string? Error { get; set; }
}
public enum TestStatus
{
Pending,
Running,
Passed,
Failed,
Skipped
}
public class DatabaseTestCaseResult
{
public string Id { get; set; } = Guid.NewGuid().ToString("N")[..8];
public string Name { get; set; } = string.Empty;
public string Category { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public TestStatus Status { get; set; } = TestStatus.Pending;
public long DurationMs { get; set; }
public List<string> Logs { get; set; } = [];
public string? ErrorMessage { get; set; }
public string? StackTrace { get; set; }
public void AddLog(string message)
{
Logs.Add($"[{DateTime.UtcNow:HH:mm:ss.fff}] {message}");
}
}