Generalised lead entries

This commit is contained in:
Khwezi Mngoma
2026-05-05 14:06:38 +02:00
parent 33112dcf79
commit f5c9557f59
10 changed files with 457 additions and 15 deletions
@@ -4,7 +4,9 @@ public class CreateLeadCommand : IRequest<Result<Guid>>
{
public Guid? CustomerId { get; set; }
public string? GoogleClickId { get; set; }
public string? Source { get; set; }
public string? ClickId { get; set; }
public string? WebClickId { get; set; }
@@ -24,10 +26,11 @@ public class CreateLeadCommand : IRequest<Result<Guid>>
public string? AttribusionHash { get; set; }
private CreateLeadCommand(Guid? customerId, string googleClickId, string webClickId, string appClickId, long? campaignId, long? adGroupId, long? adName, long? targetId, long? feedItemId, string? clickLocation, string? attribusionHash)
private CreateLeadCommand(Guid? customerId, string source, string clickId, string webClickId, string appClickId, long? campaignId, long? adGroupId, long? adName, long? targetId, long? feedItemId, string? clickLocation, string? attribusionHash)
{
CustomerId = customerId;
GoogleClickId = googleClickId;
Source = source;
ClickId = clickId;
WebClickId = webClickId;
AppClickId = appClickId;
CampaignId = campaignId;
@@ -39,11 +42,14 @@ public class CreateLeadCommand : IRequest<Result<Guid>>
AttribusionHash = attribusionHash;
}
public static CreateLeadCommand Create(Guid? customerId, string googleClickId, string webClickId, string appClickId, long? campaignId, long? adGroupId, long? adName, long? targetId, long? feedItemId, string? clickLocation, string? attribusionHash)
public static CreateLeadCommand Create(Guid? customerId, string source, string clickId, string webClickId, string appClickId, long? campaignId, long? adGroupId, long? adName, long? targetId, long? feedItemId, string? clickLocation, string? attribusionHash)
{
if (string.IsNullOrWhiteSpace(googleClickId) || string.IsNullOrWhiteSpace(appClickId) || string.IsNullOrWhiteSpace(webClickId))
throw new ArgumentException("Google ClickId, App ClickId and Web ClickId are required to create a lead.");
if(string.IsNullOrWhiteSpace(source))
throw new ArgumentNullException("Lead source is required to create a lead.", nameof(source));
return new(customerId, googleClickId, webClickId, appClickId, campaignId, adGroupId, adName, targetId, feedItemId, clickLocation, attribusionHash);
if (string.IsNullOrWhiteSpace(clickId) || string.IsNullOrWhiteSpace(appClickId) || string.IsNullOrWhiteSpace(webClickId))
throw new ArgumentException("ClickId, App ClickId and Web ClickId are required to create a lead.");
return new(customerId, source, clickId, webClickId, appClickId, campaignId, adGroupId, adName, targetId, feedItemId, clickLocation, attribusionHash);
}
}