86 lines
2.6 KiB
C#
86 lines
2.6 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 UsersCount { 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)
|
|
{
|
|
return new OperationResult { Success = true, Message = message };
|
|
}
|
|
|
|
public static OperationResult Fail(string message, string? errorDetails = null)
|
|
{
|
|
return new OperationResult
|
|
{
|
|
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 int UsersSeeded { 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}");
|
|
}
|
|
} |