Skip to content

Commit 6a99992

Browse files
committed
formatted
1 parent 6647c67 commit 6a99992

34 files changed

+266
-289
lines changed

.claude/settings.local.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"Bash(dotnet add package:*)",
77
"Bash(curl:*)",
88
"Bash(taskkill:*)",
9-
"Bash(dotnet clean:*)"
9+
"Bash(dotnet clean:*)",
10+
"Bash(dotnet run:*)",
11+
"Bash(powershell:*)"
1012
],
1113
"deny": [],
1214
"ask": []
Binary file not shown.

ThingConnect.Pulse.Server/Controllers/ConfigController.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public async Task<ActionResult<ApplyResultDto>> ApplyAsync()
2626
try
2727
{
2828
using var reader = new StreamReader(Request.Body);
29-
var yamlContent = await reader.ReadToEndAsync();
30-
29+
string yamlContent = await reader.ReadToEndAsync();
30+
3131
if (string.IsNullOrWhiteSpace(yamlContent))
3232
{
3333
return BadRequest(new ValidationErrorsDto
@@ -40,8 +40,8 @@ public async Task<ActionResult<ApplyResultDto>> ApplyAsync()
4040
});
4141
}
4242

43-
var result = await _configService.ApplyConfigurationAsync(
44-
yamlContent,
43+
ApplyResultDto result = await _configService.ApplyConfigurationAsync(
44+
yamlContent,
4545
Request.Headers["X-Actor"].FirstOrDefault(),
4646
Request.Headers["X-Note"].FirstOrDefault());
4747

@@ -80,7 +80,7 @@ public async Task<ActionResult<List<ConfigVersionDto>>> GetVersionsAsync()
8080
{
8181
try
8282
{
83-
var versions = await _configService.GetVersionsAsync();
83+
List<ConfigVersionDto> versions = await _configService.GetVersionsAsync();
8484
return Ok(versions);
8585
}
8686
catch (Exception ex)
@@ -99,7 +99,7 @@ public async Task<ActionResult> GetVersionAsync(string id)
9999
{
100100
try
101101
{
102-
var content = await _configService.GetVersionContentAsync(id);
102+
string? content = await _configService.GetVersionContentAsync(id);
103103
if (content == null)
104104
{
105105
return NotFound(new { message = "Configuration version not found" });
@@ -112,4 +112,4 @@ public async Task<ActionResult> GetVersionAsync(string id)
112112
return StatusCode(500, new { message = "Failed to retrieve configuration version", error = ex.Message });
113113
}
114114
}
115-
}
115+
}

ThingConnect.Pulse.Server/Controllers/StatusController.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public async Task<ActionResult<PagedLiveDto>> GetLiveStatusAsync(
5050
_logger.LogInformation("Getting live status - group: {Group}, search: {Search}, page: {Page}, pageSize: {PageSize}",
5151
group, search, page, pageSize);
5252

53-
var result = await _statusService.GetLiveStatusAsync(group, search, page, pageSize);
54-
53+
PagedLiveDto result = await _statusService.GetLiveStatusAsync(group, search, page, pageSize);
54+
5555
return Ok(result);
5656
}
5757
catch (Exception ex)
@@ -104,18 +104,18 @@ public async Task<ActionResult<HistoryResponseDto>> GetEndpointHistoryAsync(
104104
}
105105

106106
// Parse and validate date parameters
107-
if (!DateTimeOffset.TryParse(from, out var fromDate))
107+
if (!DateTimeOffset.TryParse(from, out DateTimeOffset fromDate))
108108
{
109109
return BadRequest(new { message = "Invalid 'from' date format. Use ISO 8601 format." });
110110
}
111111

112-
if (!DateTimeOffset.TryParse(to, out var toDate))
112+
if (!DateTimeOffset.TryParse(to, out DateTimeOffset toDate))
113113
{
114114
return BadRequest(new { message = "Invalid 'to' date format. Use ISO 8601 format." });
115115
}
116116

117117
// Validate bucket parameter
118-
var validBuckets = new[] { "raw", "15m", "daily" };
118+
string[] validBuckets = new[] { "raw", "15m", "daily" };
119119
if (!validBuckets.Contains(bucket.ToLower()))
120120
{
121121
return BadRequest(new { message = $"Invalid bucket type '{bucket}'. Valid values: {string.Join(", ", validBuckets)}" });
@@ -124,8 +124,8 @@ public async Task<ActionResult<HistoryResponseDto>> GetEndpointHistoryAsync(
124124
_logger.LogInformation("Getting endpoint history - id: {Id}, from: {From}, to: {To}, bucket: {Bucket}",
125125
id, fromDate, toDate, bucket);
126126

127-
var result = await _historyService.GetEndpointHistoryAsync(id, fromDate, toDate, bucket);
128-
127+
HistoryResponseDto? result = await _historyService.GetEndpointHistoryAsync(id, fromDate, toDate, bucket);
128+
129129
if (result == null)
130130
{
131131
return NotFound(new { message = $"Endpoint with ID {id} not found" });

ThingConnect.Pulse.Server/Controllers/TestMonitoringController.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ public async Task<IActionResult> TestProbes()
3939
var results = new List<object>();
4040

4141
// Test ICMP probe
42-
var pingResult = await _probeService.PingAsync(Guid.NewGuid(), "8.8.8.8", 2000);
42+
CheckResult pingResult = await _probeService.PingAsync(Guid.NewGuid(), "8.8.8.8", 2000);
4343
results.Add(new { Type = "ICMP", Target = "8.8.8.8", Status = pingResult.Status, RTT = pingResult.RttMs, Error = pingResult.Error });
4444

4545
// Test TCP probe
46-
var tcpResult = await _probeService.TcpConnectAsync(Guid.NewGuid(), "google.com", 80, 2000);
46+
CheckResult tcpResult = await _probeService.TcpConnectAsync(Guid.NewGuid(), "google.com", 80, 2000);
4747
results.Add(new { Type = "TCP", Target = "google.com:80", Status = tcpResult.Status, RTT = tcpResult.RttMs, Error = tcpResult.Error });
4848

4949
// Test HTTP probe
50-
var httpResult = await _probeService.HttpCheckAsync(Guid.NewGuid(), "httpbin.org", 80, "/get", null, 3000);
50+
CheckResult httpResult = await _probeService.HttpCheckAsync(Guid.NewGuid(), "httpbin.org", 80, "/get", null, 3000);
5151
results.Add(new { Type = "HTTP", Target = "httpbin.org/get", Status = httpResult.Status, RTT = httpResult.RttMs, Error = httpResult.Error });
5252

5353
return Ok(new { Results = results, Timestamp = DateTimeOffset.UtcNow });
@@ -63,7 +63,7 @@ public async Task<IActionResult> TestOutageDetection()
6363
var results = new List<object>();
6464

6565
// Simulate probe sequence: SUCCESS, SUCCESS, FAIL, FAIL (should trigger DOWN)
66-
var sequence = new[]
66+
CheckResult[] sequence = new[]
6767
{
6868
CheckResult.Success(testEndpointId, DateTimeOffset.UtcNow.AddMinutes(-4), 25.5),
6969
CheckResult.Success(testEndpointId, DateTimeOffset.UtcNow.AddMinutes(-3), 28.1),
@@ -73,11 +73,11 @@ public async Task<IActionResult> TestOutageDetection()
7373
CheckResult.Success(testEndpointId, DateTimeOffset.UtcNow, 19.7)
7474
};
7575

76-
foreach (var result in sequence)
76+
foreach (CheckResult? result in sequence)
7777
{
78-
var stateChanged = await _outageService.ProcessCheckResultAsync(result);
79-
var state = _outageService.GetMonitorState(testEndpointId);
80-
78+
bool stateChanged = await _outageService.ProcessCheckResultAsync(result);
79+
MonitorState? state = _outageService.GetMonitorState(testEndpointId);
80+
8181
results.Add(new
8282
{
8383
Timestamp = result.Timestamp,
@@ -110,7 +110,7 @@ public async Task<IActionResult> TestDiscovery()
110110
results.Add(new { Type = "Wildcard", Input = "10.0.0.*", Range = "1-5", Expanded = wildcardHosts });
111111

112112
// Test hostname resolution
113-
var resolvedHosts = await _discoveryService.ResolveHostnameAsync("google.com");
113+
IEnumerable<string> resolvedHosts = await _discoveryService.ResolveHostnameAsync("google.com");
114114
results.Add(new { Type = "Hostname", Input = "google.com", Resolved = resolvedHosts });
115115

116116
return Ok(new { Results = results, Timestamp = DateTimeOffset.UtcNow });

ThingConnect.Pulse.Server/Data/Entities.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
// ThingConnect Pulse - EF Core Entities (v1)
2-
using Microsoft.EntityFrameworkCore;
3-
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
4-
52
namespace ThingConnect.Pulse.Server.Data;
63

74
public enum ProbeType { icmp, tcp, http }

ThingConnect.Pulse.Server/Data/PulseDbContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public PulseDbContext(DbContextOptions<PulseDbContext> options) : base(options)
1919

2020
protected override void OnModelCreating(ModelBuilder b)
2121
{
22-
var isSqlite = Database.ProviderName?.Contains("Sqlite", StringComparison.OrdinalIgnoreCase) == true;
22+
bool isSqlite = Database.ProviderName?.Contains("Sqlite", StringComparison.OrdinalIgnoreCase) == true;
2323
var dateOnlyToString = new ValueConverter<DateOnly, string>(d => d.ToString("yyyy-MM-dd"), s => DateOnly.Parse(s));
2424

2525
b.Entity<Group>(e =>

ThingConnect.Pulse.Server/Data/SeedData.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// ThingConnect Pulse - Database Seed Data for Testing (v1)
2-
using Microsoft.EntityFrameworkCore;
3-
42
namespace ThingConnect.Pulse.Server.Data;
53

64
public static class SeedData
@@ -17,7 +15,7 @@ public static void Initialize(PulseDbContext context)
1715
}
1816

1917
// Seed Groups
20-
var groups = new[]
18+
Group[] groups = new[]
2119
{
2220
new Group { Id = "servers", Name = "Servers", Color = "#2563eb" },
2321
new Group { Id = "network", Name = "Network Equipment", Color = "#059669" },
@@ -27,7 +25,7 @@ public static void Initialize(PulseDbContext context)
2725
context.Groups.AddRange(groups);
2826

2927
// Seed Endpoints
30-
var endpoints = new[]
28+
Endpoint[] endpoints = new[]
3129
{
3230
new Endpoint
3331
{
@@ -73,10 +71,10 @@ public static void Initialize(PulseDbContext context)
7371
context.Endpoints.AddRange(endpoints);
7472

7573
// Seed some test check results
76-
var now = DateTimeOffset.UtcNow;
74+
DateTimeOffset now = DateTimeOffset.UtcNow;
7775
var checkResults = new List<CheckResultRaw>();
7876

79-
foreach (var endpoint in endpoints)
77+
foreach (Endpoint? endpoint in endpoints)
8078
{
8179
for (int i = 0; i < 5; i++)
8280
{
@@ -93,7 +91,7 @@ public static void Initialize(PulseDbContext context)
9391
context.CheckResultsRaw.AddRange(checkResults);
9492

9593
// Seed Settings
96-
var settings = new[]
94+
Setting[] settings = new[]
9795
{
9896
new Setting { K = "version", V = "1.0.0" },
9997
new Setting { K = "last_rollup_15m", V = now.ToString("O") },

ThingConnect.Pulse.Server/Infrastructure/PlainTextInputFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public override async Task<InputFormatterResult> ReadRequestBodyAsync(
1919
InputFormatterContext context, System.Text.Encoding encoding)
2020
{
2121
using var reader = new StreamReader(context.HttpContext.Request.Body, encoding);
22-
var content = await reader.ReadToEndAsync();
22+
string content = await reader.ReadToEndAsync();
2323
return await InputFormatterResult.SuccessAsync(content);
2424
}
2525
}

ThingConnect.Pulse.Server/Migrations/20250823180826_InitialCreate.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using Microsoft.EntityFrameworkCore.Migrations;
32

43
#nullable disable

0 commit comments

Comments
 (0)