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:
@@ -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; }
|
||||
|
||||
39
src/Indexer/Models/CallResultModels.cs
Normal file
39
src/Indexer/Models/CallResultModels.cs
Normal 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; }
|
||||
}
|
||||
9
src/Indexer/Models/ConfigResultModels.cs
Normal file
9
src/Indexer/Models/ConfigResultModels.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Indexer.Models;
|
||||
|
||||
public class ConfigReloadResult
|
||||
{
|
||||
[JsonPropertyName("Success")]
|
||||
public required bool Success { get; set; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user