Add operation executor

This commit is contained in:
2025-10-25 20:30:49 +09:00
parent 59470b49d1
commit 891d462af1
19 changed files with 144 additions and 52 deletions

View File

@ -7,13 +7,13 @@ namespace Hcs.WebApp.Services
{
private readonly IDbContextFactory<HcsDbContext> factory = factory;
public async Task<bool> HasActiveOperation(Operation.OperationType type)
public async Task<bool> HasActiveOperationAsync(Operation.OperationType type)
{
using var context = factory.CreateDbContext();
return await context.Operations.AnyAsync(x => x.Type == type && !x.EndedAt.HasValue);
}
public async Task<Operation> InitiateOperation(Operation.OperationType type, string initiatorId)
public async Task<Operation> InitiateOperationAsync(Operation.OperationType type, string initiatorId)
{
using var context = factory.CreateDbContext();
var operation = new Operation()
@ -27,7 +27,7 @@ namespace Hcs.WebApp.Services
return operation;
}
public async Task<IEnumerable<Operation>> GetInitiatedOperations()
public async Task<IEnumerable<Operation>> GetInitiatedOperationsAsync()
{
using var context = factory.CreateDbContext();
return await (from operation in context.Operations
@ -35,7 +35,7 @@ namespace Hcs.WebApp.Services
select operation).ToListAsync();
}
public async Task SetOperationMessageGuid(int operationId, string messageGuid)
public async Task SetOperationMessageGuidAsync(int operationId, string messageGuid)
{
using var context = factory.CreateDbContext();
var operation = await context.Operations.FirstOrDefaultAsync(x => x.Id == operationId);