feature/FA-misc_ReportingService #64

Merged
conco merged 14 commits from feature/FA-misc_ReportingService into master 2026-02-01 17:31:31 +00:00
2 changed files with 43 additions and 0 deletions
Showing only changes of commit c25f59a4b4 - Show all commits

View File

@@ -0,0 +1,23 @@
using FictionArchive.Common.Enums;
namespace FictionArchive.Service.Shared.Contracts.Events;
public interface IJobStatusUpdate
{
Guid JobId { get; }
Guid? ParentJobId { get; }
string JobType { get; }
string DisplayName { get; }
JobStatus Status { get; }
string? ErrorMessage { get; }
Dictionary<string, string>? Metadata { get; }
}
public record JobStatusUpdate(
Guid JobId,
Guid? ParentJobId,
string JobType,
string DisplayName,
JobStatus Status,
string? ErrorMessage,
Dictionary<string, string>? Metadata) : IJobStatusUpdate;

View File

@@ -0,0 +1,20 @@
using FictionArchive.Common.Enums;
using FictionArchive.Service.Shared.Contracts.Events;
using MassTransit;
namespace FictionArchive.Service.Shared.Extensions;
public static class JobStatusPublisher
{
public static Task ReportJobStatus(
this IPublishEndpoint endpoint,
Guid jobId,
string jobType,
string displayName,
JobStatus status,
Guid? parentJobId = null,
string? errorMessage = null,
Dictionary<string, string>? metadata = null)
=> endpoint.Publish<IJobStatusUpdate>(new JobStatusUpdate(
jobId, parentJobId, jobType, displayName, status, errorMessage, metadata));
}