consolidation of some of the modules, localization fixes, product advisories work, qa work
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
|
||||
using StellaOps.Scheduler.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StellaOps.Scheduler.WebService.GraphJobs.Events;
|
||||
|
||||
internal static class GraphJobEventFactory
|
||||
{
|
||||
public static GraphJobCompletedEvent Create(GraphJobCompletionNotification notification)
|
||||
{
|
||||
var eventId = Guid.CreateVersion7().ToString("n");
|
||||
var attributes = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(notification.CorrelationId))
|
||||
{
|
||||
attributes["correlationId"] = notification.CorrelationId!;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(notification.Error))
|
||||
{
|
||||
attributes["error"] = notification.Error!;
|
||||
}
|
||||
|
||||
var payload = new GraphJobCompletedPayload
|
||||
{
|
||||
JobType = notification.JobType.ToString().ToLowerInvariant(),
|
||||
Status = notification.Status,
|
||||
OccurredAt = notification.OccurredAt,
|
||||
Job = notification.Job,
|
||||
ResultUri = notification.ResultUri
|
||||
};
|
||||
|
||||
return new GraphJobCompletedEvent
|
||||
{
|
||||
EventId = eventId,
|
||||
Kind = GraphJobEventKinds.GraphJobCompleted,
|
||||
Tenant = notification.TenantId,
|
||||
Timestamp = notification.OccurredAt,
|
||||
Payload = payload,
|
||||
Attributes = attributes.Count == 0 ? null : attributes
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user