parent
0217b4be2c
commit
5d9d23b47d
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue