refactor(architecture): enforce module boundaries

This commit is contained in:
2026-08-03 12:26:09 +08:00
parent 290a0c7bd7
commit caea0062b0
234 changed files with 21723 additions and 18117 deletions

View File

@@ -35,12 +35,16 @@ public sealed record BackgroundJobItem(
Guid? OutputAssetId,
JsonElement Result);
public interface IBackgroundJobService
public interface IBackgroundJobQueue
{
Task<BackgroundJobItem> EnqueueAsync(
CreateBackgroundJobCommand command,
CancellationToken cancellationToken = default);
}
public interface IBackgroundJobProcessor
{
Task<int> ProcessPendingAsync(
string workerId,
int batchSize,
@@ -54,6 +58,10 @@ public interface IBackgroundJobService
string workerId,
CancellationToken cancellationToken = default);
}
public interface IBackgroundJobOperations
{
Task<IReadOnlyCollection<BackgroundJobItem>> ListAsync(
Guid tenantId,
string? jobType = null,
@@ -85,3 +93,23 @@ public interface IBackgroundJobService
Guid actorUserId,
CancellationToken cancellationToken = default);
}
public interface IBackgroundJobService :
IBackgroundJobQueue,
IBackgroundJobProcessor,
IBackgroundJobOperations;
public sealed record BackgroundJobExecutionContext(
Guid JobId,
Guid TenantId,
string JobType,
JsonElement Payload);
public interface IBackgroundJobHandler
{
string JobType { get; }
Task<JsonElement> HandleAsync(
BackgroundJobExecutionContext context,
CancellationToken cancellationToken = default);
}