package rules import ( "time" "code.tnxs.net/taxnexus/lib/app" temporal_workflow "go.temporal.io/sdk/workflow" ) // NewLeadWorkflowWrapper wraps a Lead with auth and saga info type NewLeadWorkflowWrapper struct { // Address crm_models.Address Company string Description string Email string FirstName string ID string LastName string MobilePhone string Name string OwnerID string PartnerAccountID string Phone string ProductID string RefererURL string Status string TenantID string Title string Type string UTMCampaign string UTMContent string UTMMedium string UTMSource string UTMTerm string Website string APIKey string SagaID string SagaType string } // NewLeadWorkflow is a Temporal workflow func NewLeadWorkflow(ctx temporal_workflow.Context, w NewLeadWorkflowWrapper) error { //nolint:gocritic // don't care obj := app.LeadActivityWrapper{ // Address: w.Address, Company: w.Company, Description: w.Description, Email: w.Email, FirstName: w.FirstName, LastName: w.LastName, MobilePhone: w.MobilePhone, Name: w.Name, Phone: w.Phone, RefererURL: w.RefererURL, Status: w.Status, TenantID: w.TenantID, Title: w.Title, Type: w.Type, UTMCampaign: w.UTMCampaign, UTMContent: w.UTMContent, UTMMedium: w.UTMMedium, UTMSource: w.UTMSource, UTMTerm: w.UTMTerm, Website: w.Website, } ctx = temporal_workflow. WithActivityOptions( ctx, temporal_workflow.ActivityOptions{ StartToCloseTimeout: time.Minute, }) err := temporal_workflow. ExecuteActivity( ctx, StoreLeadActivity, obj, ).Get(ctx, nil) if err != nil { return err } err = temporal_workflow. ExecuteActivity( ctx, NotifyLeadActivity, obj, ).Get(ctx, nil) if err != nil { return err } return nil }