v0.1.16 v0.1.16
Vernon Keenan 2021-01-18 18:48:56 -08:00
parent 0217b4be2c
commit 5d9d23b47d
2 changed files with 25 additions and 25 deletions

View File

@ -14,7 +14,7 @@ type NewDeveloperWrapper struct {
Contact crm_models.Contact
Account crm_models.Account
PaymentMethod ops_models.PaymentMethod
Principal app.User
APIKey string
SagaID string
SagaType string
}
@ -22,7 +22,7 @@ type NewDeveloperWrapper struct {
// NewDeveloperWorkflow is a Temporal workflow
func NewDeveloperWorkflow(
ctx workflow.Context,
payload *NewDeveloperWrapper,
w *NewDeveloperWrapper,
) error {
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: time.Minute,
@ -30,10 +30,10 @@ func NewDeveloperWorkflow(
err := workflow.ExecuteActivity(ctx,
StoreContactActivity,
&app.ContactChannelWrapper{
Obj: payload.Contact,
APIKey: payload.Principal.APIKey,
SagaID: payload.SagaID,
SagaType: payload.SagaType,
Obj: w.Contact,
APIKey: w.APIKey,
SagaID: w.SagaID,
SagaType: w.SagaType,
}).Get(ctx, nil)
if err != nil {
return err
@ -41,10 +41,10 @@ func NewDeveloperWorkflow(
err = workflow.ExecuteActivity(ctx,
StoreAccountActivity,
&app.AccountChannelWrapper{
Obj: payload.Account,
APIKey: payload.Principal.APIKey,
SagaID: payload.SagaID,
SagaType: payload.SagaType,
Obj: w.Account,
APIKey: w.APIKey,
SagaID: w.SagaID,
SagaType: w.SagaType,
}).Get(ctx, nil)
if err != nil {
return err
@ -52,10 +52,10 @@ func NewDeveloperWorkflow(
err = workflow.ExecuteActivity(ctx,
StorePaymentMethodActivity,
&app.PaymentMethodChannelWrapper{
Obj: payload.PaymentMethod,
APIKey: payload.Principal.APIKey,
SagaID: payload.SagaID,
SagaType: payload.SagaType,
Obj: w.PaymentMethod,
APIKey: w.APIKey,
SagaID: w.SagaID,
SagaType: w.SagaType,
}).Get(ctx, nil)
if err != nil {
return err
@ -63,15 +63,15 @@ func NewDeveloperWorkflow(
err = workflow.ExecuteActivity(ctx,
NotifyContactActivity,
&app.ContactChannelWrapper{
Obj: payload.Contact,
APIKey: payload.Principal.APIKey,
SagaID: payload.SagaID,
SagaType: payload.SagaType,
Obj: w.Contact,
APIKey: w.APIKey,
SagaID: w.SagaID,
SagaType: w.SagaType,
}).Get(ctx, nil)
if err != nil {
return err
}
err = workflow.ExecuteActivity(ctx, NotifyLeadActivity, payload).Get(ctx, nil)
err = workflow.ExecuteActivity(ctx, NotifyLeadActivity, w).Get(ctx, nil)
if err != nil {
return err
}

View File

@ -11,7 +11,7 @@ import (
// NewLeadWrapper wraps a Lead and a user identifier (app.User)
type NewLeadWrapper struct {
Lead crm_models.Lead
Principal app.User
APIKey string
SagaID string
SagaType string
}
@ -30,7 +30,7 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, payload *NewLeadWrapper) err
StoreLeadActivity,
&app.LeadChannelWrapper{
Obj: payload.Lead,
APIKey: payload.Principal.APIKey,
APIKey: payload.APIKey,
}).Get(ctx, nil)
if err != nil {
return err
@ -41,7 +41,7 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, payload *NewLeadWrapper) err
NotifyLeadActivity,
&app.LeadChannelWrapper{
Obj: payload.Lead,
APIKey: payload.Principal.APIKey,
APIKey: payload.APIKey,
}).Get(ctx, nil)
if err != nil {
return err