This commit is contained in:
fuenmao
2026-11-12 15:45:52 +08:00
parent 61e25175db
commit 718b138033
30 changed files with 1511 additions and 99 deletions
@@ -0,0 +1,21 @@
using Evergreen.Health.Application.Health.Sleep;
namespace Evergreen.Health.Application.Health.Integrations.Ib43;
public sealed class Ib43AutomationExecutionLog(IServiceScopeFactory scopes) : IBedPresenceExecutionLog
{
public async Task<string?> BeginAsync(string bindingId, long userId, string action, string target,
DateTimeOffset triggeredAt, CancellationToken token)
{
using var scope = scopes.CreateScope();
return await scope.ServiceProvider.GetRequiredService<Ib43DataRepository>()
.BeginAutomation(bindingId, userId, action, target, triggeredAt.ToUnixTimeMilliseconds(), token);
}
public async Task CompleteAsync(string id, string result, DateTimeOffset completedAt)
{
using var scope = scopes.CreateScope();
await scope.ServiceProvider.GetRequiredService<Ib43DataRepository>()
.CompleteAutomation(id, result, completedAt.ToUnixTimeMilliseconds());
}
}