22 lines
952 B
C#
22 lines
952 B
C#
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());
|
|
}
|
|
}
|