it's this async stuff man
Some checks are pending
/ test-build-and-push (push) Waiting to run

This commit is contained in:
notfire 2025-03-30 22:45:44 -04:00
parent f486266bb7
commit d497e06643
Signed by: notfire
GPG key ID: 3AFDACAAB4E56B16

View file

@ -89,24 +89,19 @@ public class AdminController(
[Authenticate("admin:read:reports")] [Authenticate("admin:read:reports")]
[ProducesResults(HttpStatusCode.OK)] [ProducesResults(HttpStatusCode.OK)]
[ProducesErrors(HttpStatusCode.NotFound)] [ProducesErrors(HttpStatusCode.NotFound)]
public async void SetReportState(ReportsQuery query) // ReSharper disable once AsyncVoidMethod
public async Task<ReportsQuery>? SetReportState(ReportsQuery query)
{ {
try foreach (var list in query.Reports)
{ {
foreach (var list in query.Reports) var report = await db.Reports.Where(p => p.Id == list.Id).FirstOrDefaultAsync()
{ ?? throw GracefulException.NotFound("Report not found");
var report = await db.Reports.Where(p => p.Id == list.Id).FirstOrDefaultAsync()
?? throw GracefulException.NotFound("Report not found");
report.Resolved = list.State is "resolved" or "closed"; report.Resolved = list.State is "resolved" or "closed";
await db.SaveChangesAsync(); await db.SaveChangesAsync();
}
}
catch (Exception e)
{
// ReSharper disable once AsyncVoidMethod
throw GracefulException.Conflict(e.ToString());
} }
return query;
} }
} }