freetubesync/FreeTubeSync/EndPoints/PingEndpoint.cs
Mario Steele 004c490dd8 Looks like we finally have a solution.
Change logging to just log a message, instead of the exception.
Moved logic to Syncer involvement.  When posting the data, if a 500 is
returned, then it is up to the Syncer to re-submit it.
2025-08-09 04:09:17 -05:00

29 lines
No EOL
913 B
C#

using FreeTubeSync.Database;
namespace FreeTubeSync.EndPoints;
public static class PingEndpoint
{
public static void MapPingEndpoints(this WebApplication app)
{
var group = app.MapGroup("ping");
group.MapGet("/", async (DataContext dbContext, CancellationToken token) =>
{
await dbContext.CleanupChangeLogAsync(token);
var dict = new { AppVersion = "0.1.5" };
return Results.Ok(dict);
});
group.MapGet("/lastUpdated", async (DataContext dbContext, CancellationToken token) =>
{
var log = await dbContext.GetLatestChangeAsync(token);
if (log == null)
return Results.NotFound();
var dict = new { LastUpdated = log.ChangeTime };
await dbContext.CleanupChangeLogAsync(token);
return Results.Ok(dict);
});
}
}