2025-06-26 21:30:32 +02:00
|
|
|
|
namespace PlanTempus.Core.CommandQueries;
|
2025-03-12 00:13:53 +01:00
|
|
|
|
|
2025-03-12 18:30:40 +01:00
|
|
|
|
/// <summary>
|
2025-06-26 21:30:32 +02:00
|
|
|
|
/// Represents a response to a command request
|
2025-03-12 18:30:40 +01:00
|
|
|
|
/// This class includes details such as a unique request ID, correlation ID, command name,
|
|
|
|
|
|
/// transaction ID, creation timestamp, and a URL to check the status of the command.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="correlationId">A unique identifier used to track the request across services.</param>
|
|
|
|
|
|
/// <param name="commandName">The name of the command being executed.</param>
|
|
|
|
|
|
/// <param name="transactionId">An optional unique identifier for the transaction associated with the command.</param>
|
|
|
|
|
|
public class CommandResponse(Guid correlationId, string commandName, Guid? transactionId)
|
2025-03-12 00:13:53 +01:00
|
|
|
|
{
|
2025-03-12 18:30:40 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// A unique identifier for the request. This is automatically generated using Guid.CreateVersion7().
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Guid RequestId { get; } = Guid.CreateVersion7();
|
2025-03-12 00:13:53 +01:00
|
|
|
|
|
2025-03-12 18:30:40 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// A unique identifier used to track the request across services. This is provided when creating the response.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Guid CorrelationId { get; } = correlationId;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The name of the command being executed.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string CommandName { get; } = commandName;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// An optional unique identifier for the transaction associated with the command.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Guid? TransactionId { get; } = transactionId;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The timestamp when the command response was created. This is automatically set to the current UTC time.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public DateTime CreatedAt { get; } = DateTime.UtcNow;
|
|
|
|
|
|
|
2025-03-12 00:13:53 +01:00
|
|
|
|
}
|