1
0
mirror of https://github.com/XFox111/bonch-calendar.git synced 2026-04-22 07:08:01 +03:00

init: initial commit

This commit is contained in:
2025-11-18 20:16:48 +00:00
commit fe11e264de
69 changed files with 10008 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
using BonchCalendar.Services;
using Microsoft.Extensions.Diagnostics.HealthChecks;
namespace BonchCalendar.Health;
public class ApiHealthCheck(ApiService groupService) : IHealthCheck
{
public async Task<HealthCheckResult> CheckHealthAsync(
HealthCheckContext context, CancellationToken cancellationToken = default
)
{
try
{
Dictionary<int, string> faculties = await groupService.GetFacultiesListAsync();
if (faculties.Count > 0)
return HealthCheckResult.Healthy();
return HealthCheckResult.Degraded(description: "Timetable website looks to be up, but returned an empty list of faculties.");
}
catch (Exception ex)
{
return HealthCheckResult.Unhealthy(description: "Timetable website appears to be down.", exception: ex);
}
}
}