Skip to content

Commit f002337

Browse files
spaarke-devclaude
andcommitted
style(api): fix whitespace formatting in DI extension files
Run dotnet format to fix whitespace violations in DebugEndpointExtensions.cs and EndpointMappingExtensions.cs that caused Code Quality CI to fail. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a9e8e36 commit f002337

2 files changed

Lines changed: 73 additions & 19 deletions

File tree

src/server/api/Sprk.Bff.Api/Infrastructure/DI/DebugEndpointExtensions.cs

Lines changed: 64 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,18 @@ public static void MapDebugEndpoints(this WebApplication app)
1515
{
1616
var doc = await dv.GetDocumentAsync(id.ToString());
1717
if (doc == null) return Results.Ok(new { status = "NOT_FOUND", documentId = id.ToString() });
18-
return Results.Ok(new { status = "FOUND", documentId = doc.Id, name = doc.Name, fileName = doc.FileName,
19-
isEmailArchive = doc.IsEmailArchive, parentDocumentId = doc.ParentDocumentId,
20-
matterId = doc.MatterId, projectId = doc.ProjectId, invoiceId = doc.InvoiceId });
18+
return Results.Ok(new
19+
{
20+
status = "FOUND",
21+
documentId = doc.Id,
22+
name = doc.Name,
23+
fileName = doc.FileName,
24+
isEmailArchive = doc.IsEmailArchive,
25+
parentDocumentId = doc.ParentDocumentId,
26+
matterId = doc.MatterId,
27+
projectId = doc.ProjectId,
28+
invoiceId = doc.InvoiceId
29+
});
2130
}
2231
catch (Exception ex) { log.LogError(ex, "Error {Id}", id); return Results.Ok(new { status = "ERROR", error = ex.Message }); }
2332
}).AllowAnonymous();
@@ -27,9 +36,21 @@ public static void MapDebugEndpoints(this WebApplication app)
2736
try
2837
{
2938
var children = (await dv.GetDocumentsByParentAsync(parentId)).ToList();
30-
return Results.Ok(new { status = "OK", parentDocumentId = parentId.ToString(), childCount = children.Count,
31-
children = children.Select(c => new { documentId = c.Id, name = c.Name, fileName = c.FileName,
32-
isEmailArchive = c.IsEmailArchive, parentDocumentId = c.ParentDocumentId, createdOn = c.CreatedOn }) });
39+
return Results.Ok(new
40+
{
41+
status = "OK",
42+
parentDocumentId = parentId.ToString(),
43+
childCount = children.Count,
44+
children = children.Select(c => new
45+
{
46+
documentId = c.Id,
47+
name = c.Name,
48+
fileName = c.FileName,
49+
isEmailArchive = c.IsEmailArchive,
50+
parentDocumentId = c.ParentDocumentId,
51+
createdOn = c.CreatedOn
52+
})
53+
});
3354
}
3455
catch (Exception ex) { log.LogError(ex, "Error parent {Id}", parentId); return Results.Ok(new { status = "ERROR", error = ex.Message }); }
3556
}).AllowAnonymous();
@@ -80,9 +101,14 @@ private static void MapDiagnosticEndpoints(WebApplication app)
80101
var info = handlers.Select(h => new { jobType = h.JobType, handlerType = h.GetType().FullName }).ToList();
81102
string? err1 = TryResolve<Sprk.Bff.Api.Services.Jobs.Handlers.AppOnlyDocumentAnalysisJobHandler>(scope);
82103
string? err2 = TryResolve<Sprk.Bff.Api.Services.Ai.IAppOnlyAnalysisService>(scope);
83-
return Results.Ok(new { totalHandlers = handlers.Count, handlers = info,
104+
return Results.Ok(new
105+
{
106+
totalHandlers = handlers.Count,
107+
handlers = info,
84108
hasAppOnlyDocumentAnalysis = handlers.Any(h => h.JobType == "AppOnlyDocumentAnalysis"),
85-
directHandlerResolution = err1 ?? "OK", analysisServiceResolution = err2 ?? "OK" });
109+
directHandlerResolution = err1 ?? "OK",
110+
analysisServiceResolution = err2 ?? "OK"
111+
});
86112
}
87113
catch (Exception ex) { log.LogError(ex, "Error"); return Results.Ok(new { error = ex.Message }); }
88114
}).AllowAnonymous();
@@ -94,8 +120,11 @@ private static void MapDiagnosticEndpoints(WebApplication app)
94120
{
95121
var svc = sp.GetRequiredService<Sprk.Bff.Api.Services.Communication.CommunicationAccountService>();
96122
results["CommunicationAccountService"] = "OK";
97-
try { var accts = await svc.QueryReceiveEnabledAccountsAsync(); results["ReceiveEnabledAccounts"] = $"{accts.Length} found";
98-
foreach (var a in accts) results[$"Account:{a.EmailAddress}"] = $"SubId={a.SubscriptionId ?? "none"}, AutoCreate={a.AutoCreateRecords}"; }
123+
try
124+
{
125+
var accts = await svc.QueryReceiveEnabledAccountsAsync(); results["ReceiveEnabledAccounts"] = $"{accts.Length} found";
126+
foreach (var a in accts) results[$"Account:{a.EmailAddress}"] = $"SubId={a.SubscriptionId ?? "none"}, AutoCreate={a.AutoCreateRecords}";
127+
}
99128
catch (Exception ex) { results["ReceiveEnabledAccounts"] = $"FAILED: {ex.Message}"; }
100129
}
101130
catch (Exception ex) { results["CommunicationAccountService"] = $"FAILED: {ex.Message}"; }
@@ -129,17 +158,36 @@ private static async Task<object> PeekDlq(Azure.Messaging.ServiceBus.ServiceBusC
129158
ReceiveMode = Azure.Messaging.ServiceBus.ServiceBusReceiveMode.PeekLock
130159
});
131160
var messages = await receiver.PeekMessagesAsync(10);
132-
return new { queue = $"{queueName}/$DeadLetterQueue", count = messages.Count,
133-
messages = messages.Select(m => new { m.SequenceNumber, m.DeadLetterReason, m.EnqueuedTime, m.MessageId,
134-
bodyPreview = m.Body.ToString().Length > 500 ? m.Body.ToString()[..500] + "..." : m.Body.ToString() }) };
161+
return new
162+
{
163+
queue = $"{queueName}/$DeadLetterQueue",
164+
count = messages.Count,
165+
messages = messages.Select(m => new
166+
{
167+
m.SequenceNumber,
168+
m.DeadLetterReason,
169+
m.EnqueuedTime,
170+
m.MessageId,
171+
bodyPreview = m.Body.ToString().Length > 500 ? m.Body.ToString()[..500] + "..." : m.Body.ToString()
172+
})
173+
};
135174
}
136175

137176
private static async Task<object> PeekQueue(Azure.Messaging.ServiceBus.ServiceBusClient sbc, string queueName)
138177
{
139178
await using var receiver = sbc.CreateReceiver(queueName);
140179
var messages = await receiver.PeekMessagesAsync(10);
141-
return new { queue = queueName, count = messages.Count,
142-
messages = messages.Select(m => new { m.SequenceNumber, m.EnqueuedTime, m.MessageId,
143-
bodyPreview = m.Body.ToString().Length > 500 ? m.Body.ToString()[..500] + "..." : m.Body.ToString() }) };
180+
return new
181+
{
182+
queue = queueName,
183+
count = messages.Count,
184+
messages = messages.Select(m => new
185+
{
186+
m.SequenceNumber,
187+
m.EnqueuedTime,
188+
m.MessageId,
189+
bodyPreview = m.Body.ToString().Length > 500 ? m.Body.ToString()[..500] + "..." : m.Body.ToString()
190+
})
191+
};
144192
}
145193
}

src/server/api/Sprk.Bff.Api/Infrastructure/DI/EndpointMappingExtensions.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,15 @@ private static void MapHealthEndpoints(WebApplication app)
4444

4545
return Results.Ok(new
4646
{
47-
status = "FOUND", documentId = doc.Id, name = doc.Name, fileName = doc.FileName,
48-
isEmailArchive = doc.IsEmailArchive, parentDocumentId = doc.ParentDocumentId,
49-
matterId = doc.MatterId, projectId = doc.ProjectId, invoiceId = doc.InvoiceId,
47+
status = "FOUND",
48+
documentId = doc.Id,
49+
name = doc.Name,
50+
fileName = doc.FileName,
51+
isEmailArchive = doc.IsEmailArchive,
52+
parentDocumentId = doc.ParentDocumentId,
53+
matterId = doc.MatterId,
54+
projectId = doc.ProjectId,
55+
invoiceId = doc.InvoiceId,
5056
emailConversationIndex = doc.EmailConversationIndex
5157
});
5258
}

0 commit comments

Comments
 (0)