parent
0217b4be2c
commit
5d9d23b47d
|
@ -14,7 +14,7 @@ type NewDeveloperWrapper struct {
|
||||||
Contact crm_models.Contact
|
Contact crm_models.Contact
|
||||||
Account crm_models.Account
|
Account crm_models.Account
|
||||||
PaymentMethod ops_models.PaymentMethod
|
PaymentMethod ops_models.PaymentMethod
|
||||||
Principal app.User
|
APIKey string
|
||||||
SagaID string
|
SagaID string
|
||||||
SagaType string
|
SagaType string
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ type NewDeveloperWrapper struct {
|
||||||
// NewDeveloperWorkflow is a Temporal workflow
|
// NewDeveloperWorkflow is a Temporal workflow
|
||||||
func NewDeveloperWorkflow(
|
func NewDeveloperWorkflow(
|
||||||
ctx workflow.Context,
|
ctx workflow.Context,
|
||||||
payload *NewDeveloperWrapper,
|
w *NewDeveloperWrapper,
|
||||||
) error {
|
) error {
|
||||||
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
|
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
|
||||||
StartToCloseTimeout: time.Minute,
|
StartToCloseTimeout: time.Minute,
|
||||||
|
@ -30,10 +30,10 @@ func NewDeveloperWorkflow(
|
||||||
err := workflow.ExecuteActivity(ctx,
|
err := workflow.ExecuteActivity(ctx,
|
||||||
StoreContactActivity,
|
StoreContactActivity,
|
||||||
&app.ContactChannelWrapper{
|
&app.ContactChannelWrapper{
|
||||||
Obj: payload.Contact,
|
Obj: w.Contact,
|
||||||
APIKey: payload.Principal.APIKey,
|
APIKey: w.APIKey,
|
||||||
SagaID: payload.SagaID,
|
SagaID: w.SagaID,
|
||||||
SagaType: payload.SagaType,
|
SagaType: w.SagaType,
|
||||||
}).Get(ctx, nil)
|
}).Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -41,10 +41,10 @@ func NewDeveloperWorkflow(
|
||||||
err = workflow.ExecuteActivity(ctx,
|
err = workflow.ExecuteActivity(ctx,
|
||||||
StoreAccountActivity,
|
StoreAccountActivity,
|
||||||
&app.AccountChannelWrapper{
|
&app.AccountChannelWrapper{
|
||||||
Obj: payload.Account,
|
Obj: w.Account,
|
||||||
APIKey: payload.Principal.APIKey,
|
APIKey: w.APIKey,
|
||||||
SagaID: payload.SagaID,
|
SagaID: w.SagaID,
|
||||||
SagaType: payload.SagaType,
|
SagaType: w.SagaType,
|
||||||
}).Get(ctx, nil)
|
}).Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -52,10 +52,10 @@ func NewDeveloperWorkflow(
|
||||||
err = workflow.ExecuteActivity(ctx,
|
err = workflow.ExecuteActivity(ctx,
|
||||||
StorePaymentMethodActivity,
|
StorePaymentMethodActivity,
|
||||||
&app.PaymentMethodChannelWrapper{
|
&app.PaymentMethodChannelWrapper{
|
||||||
Obj: payload.PaymentMethod,
|
Obj: w.PaymentMethod,
|
||||||
APIKey: payload.Principal.APIKey,
|
APIKey: w.APIKey,
|
||||||
SagaID: payload.SagaID,
|
SagaID: w.SagaID,
|
||||||
SagaType: payload.SagaType,
|
SagaType: w.SagaType,
|
||||||
}).Get(ctx, nil)
|
}).Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -63,15 +63,15 @@ func NewDeveloperWorkflow(
|
||||||
err = workflow.ExecuteActivity(ctx,
|
err = workflow.ExecuteActivity(ctx,
|
||||||
NotifyContactActivity,
|
NotifyContactActivity,
|
||||||
&app.ContactChannelWrapper{
|
&app.ContactChannelWrapper{
|
||||||
Obj: payload.Contact,
|
Obj: w.Contact,
|
||||||
APIKey: payload.Principal.APIKey,
|
APIKey: w.APIKey,
|
||||||
SagaID: payload.SagaID,
|
SagaID: w.SagaID,
|
||||||
SagaType: payload.SagaType,
|
SagaType: w.SagaType,
|
||||||
}).Get(ctx, nil)
|
}).Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = workflow.ExecuteActivity(ctx, NotifyLeadActivity, payload).Get(ctx, nil)
|
err = workflow.ExecuteActivity(ctx, NotifyLeadActivity, w).Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
// NewLeadWrapper wraps a Lead and a user identifier (app.User)
|
// NewLeadWrapper wraps a Lead and a user identifier (app.User)
|
||||||
type NewLeadWrapper struct {
|
type NewLeadWrapper struct {
|
||||||
Lead crm_models.Lead
|
Lead crm_models.Lead
|
||||||
Principal app.User
|
APIKey string
|
||||||
SagaID string
|
SagaID string
|
||||||
SagaType string
|
SagaType string
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, payload *NewLeadWrapper) err
|
||||||
StoreLeadActivity,
|
StoreLeadActivity,
|
||||||
&app.LeadChannelWrapper{
|
&app.LeadChannelWrapper{
|
||||||
Obj: payload.Lead,
|
Obj: payload.Lead,
|
||||||
APIKey: payload.Principal.APIKey,
|
APIKey: payload.APIKey,
|
||||||
}).Get(ctx, nil)
|
}).Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -41,7 +41,7 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, payload *NewLeadWrapper) err
|
||||||
NotifyLeadActivity,
|
NotifyLeadActivity,
|
||||||
&app.LeadChannelWrapper{
|
&app.LeadChannelWrapper{
|
||||||
Obj: payload.Lead,
|
Obj: payload.Lead,
|
||||||
APIKey: payload.Principal.APIKey,
|
APIKey: payload.APIKey,
|
||||||
}).Get(ctx, nil)
|
}).Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue