From be55d9117a63c0c5b1240ec809df59e4d81d4f7f Mon Sep 17 00:00:00 2001 From: Vernon Keenan Date: Tue, 19 Jan 2021 12:11:18 -0800 Subject: [PATCH] rules --- rules/new-developer.go | 11 ++++------- rules/new-lead.go | 12 ++++++------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/rules/new-developer.go b/rules/new-developer.go index ec782d6..697b306 100644 --- a/rules/new-developer.go +++ b/rules/new-developer.go @@ -9,8 +9,8 @@ import ( "go.temporal.io/sdk/workflow" ) -// NewDeveloperWrapper wraps a contact, account, payment method and a user identifier (app.User) -type NewDeveloperWrapper struct { +// NewDeveloperWorkflowWrapper wraps a contact, account, payment method with auth and saga info +type NewDeveloperWorkflowWrapper struct { AccountName string BillingStreet string BillingCity string @@ -32,16 +32,13 @@ type NewDeveloperWrapper struct { } // NewDeveloperWorkflow is a Temporal workflow -func NewDeveloperWorkflow( - ctx workflow.Context, - w *NewDeveloperWrapper, -) error { +func NewDeveloperWorkflow(ctx workflow.Context, w NewDeveloperWorkflowWrapper) error { //nolint:funlen,gocritic,lll // don't care ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{ StartToCloseTimeout: time.Minute, }) err := workflow.ExecuteActivity(ctx, StoreContactActivity, - &app.ContactChannelWrapper{ + app.ContactChannelWrapper{ Obj: crm_models.Contact{ AccountID: "", AssistantName: "", diff --git a/rules/new-lead.go b/rules/new-lead.go index 475b8eb..ff63a48 100644 --- a/rules/new-lead.go +++ b/rules/new-lead.go @@ -8,9 +8,9 @@ import ( temporal_workflow "go.temporal.io/sdk/workflow" ) -// NewLeadWrapper wraps a Lead and a user identifier (app.User) -type NewLeadWrapper struct { - // Address *crm_models.Address +// NewLeadWorkflowWrapper wraps a Lead with auth and saga info +type NewLeadWorkflowWrapper struct { + // Address crm_models.Address Company string Description string Email string @@ -40,7 +40,7 @@ type NewLeadWrapper struct { } // NewLeadWorkflow is a Temporal workflow -func NewLeadWorkflow(ctx temporal_workflow.Context, w *NewLeadWrapper) error { +func NewLeadWorkflow(ctx temporal_workflow.Context, w NewLeadWorkflowWrapper) error { //nolint:gocritic // don't care obj := crm_models.Lead{ // Address: w.Address, Company: w.Company, @@ -76,7 +76,7 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, w *NewLeadWrapper) error { ExecuteActivity( ctx, StoreLeadActivity, - &app.LeadChannelWrapper{ + app.LeadChannelWrapper{ Obj: obj, SagaID: w.SagaID, SagaType: w.SagaType, @@ -89,7 +89,7 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, w *NewLeadWrapper) error { ExecuteActivity( ctx, NotifyLeadActivity, - &app.LeadChannelWrapper{ + app.LeadChannelWrapper{ Obj: obj, APIKey: w.APIKey, }).Get(ctx, nil)