28 lines
1.1 KiB
C#
28 lines
1.1 KiB
C#
using ControlPlane.Core.Interfaces;
|
|
using ControlPlane.Core.Models;
|
|
|
|
namespace ControlPlane.Worker.Steps;
|
|
|
|
public class HandoffStep(ILogger<HandoffStep> logger) : ISagaStep
|
|
{
|
|
public string StepName => "Handoff (Email Magic Link)";
|
|
|
|
public Task ExecuteAsync(SagaContext context, CancellationToken cancellationToken)
|
|
{
|
|
// TODO: SendGrid / AWS SES
|
|
// 1. Send email to context.Job.AdminEmail
|
|
// 2. Include context.MagicLink for password setup
|
|
// 3. Include login URL: https://{context.Job.Subdomain}
|
|
logger.LogInformation("[{JobId}] Handoff step is a stub - email provider not yet wired.", context.Job.Id);
|
|
context.Job.CompletedSteps |= CompletedSteps.HandoffSent;
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
public Task CompensateAsync(SagaContext context, CancellationToken cancellationToken)
|
|
{
|
|
// Email already sent cannot be recalled - log only
|
|
logger.LogWarning("[{JobId}] Handoff step: email cannot be compensated if already sent.", context.Job.Id);
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|