Added Name to Call, Added individual call disabling and enabling, added Call.Dispose() method, Refactored Controllers and result models, fixed config reload bug

This commit is contained in:
2025-08-31 02:37:08 +02:00
parent bb6f7c31fb
commit 2187a59936
8 changed files with 183 additions and 93 deletions

View File

@@ -4,6 +4,7 @@ namespace Indexer.Models;
public class CallConfig
{
public required string Name { get; set; }
public required string Type { get; set; }
public long? Interval { get; set; } // For Type: Interval
public string? Path { get; set; } // For Type: FileSystemWatcher
@@ -17,6 +18,8 @@ public interface ICall
public HealthCheckResult HealthCheck();
public void Start();
public void Stop();
public void Dispose();
public string Name { get; set; }
public bool IsEnabled { get; set; }
public bool IsExecuting { get; set; }
public CallConfig CallConfig { get; set; }

View File

@@ -0,0 +1,39 @@
using System.Text.Json.Serialization;
namespace Indexer.Models;
public class CallListResults
{
[JsonPropertyName("Calls")]
public required List<CallListResult> Calls { get; set; }
[JsonPropertyName("Success")]
public required bool Success { get; set; }
}
public class CallListResult
{
[JsonPropertyName("CallConfig")]
public required CallConfig CallConfig { get; set; }
[JsonPropertyName("IsActive")]
public required bool IsActive { get; set; }
[JsonPropertyName("IsExecuting")]
public required bool IsExecuting { get; set; }
[JsonPropertyName("LastExecution")]
public required DateTime? LastExecution { get; set; }
[JsonPropertyName("LastSuccessfulExecution")]
public required DateTime? LastSuccessfulExecution { get; set; }
[JsonPropertyName("HealthStatus")]
public required string HealthStatus { get; set; }
}
public class CallDisableResult
{
[JsonPropertyName("Success")]
public required bool Success { get; set; }
}
public class CallEnableResult
{
[JsonPropertyName("Success")]
public required bool Success { get; set; }
}

View File

@@ -0,0 +1,9 @@
using System.Text.Json.Serialization;
namespace Indexer.Models;
public class ConfigReloadResult
{
[JsonPropertyName("Success")]
public required bool Success { get; set; }
}

View File

@@ -26,50 +26,8 @@ public class WorkerListResult
public required string HealthStatus { get; set; }
}
public class CallListResults
{
[JsonPropertyName("Calls")]
public required List<CallListResult> Calls { get; set; }
[JsonPropertyName("Success")]
public required bool Success { get; set; }
}
public class CallListResult
{
[JsonPropertyName("CallConfig")]
public required CallConfig CallConfig { get; set; }
[JsonPropertyName("IsActive")]
public required bool IsActive { get; set; }
[JsonPropertyName("IsExecuting")]
public required bool IsExecuting { get; set; }
[JsonPropertyName("LastExecution")]
public required DateTime? LastExecution { get; set; }
[JsonPropertyName("LastSuccessfulExecution")]
public required DateTime? LastSuccessfulExecution { get; set; }
[JsonPropertyName("HealthStatus")]
public required string HealthStatus { get; set; }
}
public class WorkerStopResult
{
[JsonPropertyName("Success")]
public required bool Success { get; set; }
}
public class WorkerStartResult
{
[JsonPropertyName("Success")]
public required bool Success { get; set; }
}
public class WorkerTriggerUpdateResult
{
[JsonPropertyName("Success")]
public required bool Success { get; set; }
}
public class WorkerReloadConfigResult
{
[JsonPropertyName("Success")]
public required bool Success { get; set; }
}
}