parent
c3d872fff1
commit
be55d9117a
|
@ -9,8 +9,8 @@ import (
|
||||||
"go.temporal.io/sdk/workflow"
|
"go.temporal.io/sdk/workflow"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewDeveloperWrapper wraps a contact, account, payment method and a user identifier (app.User)
|
// NewDeveloperWorkflowWrapper wraps a contact, account, payment method with auth and saga info
|
||||||
type NewDeveloperWrapper struct {
|
type NewDeveloperWorkflowWrapper struct {
|
||||||
AccountName string
|
AccountName string
|
||||||
BillingStreet string
|
BillingStreet string
|
||||||
BillingCity string
|
BillingCity string
|
||||||
|
@ -32,16 +32,13 @@ type NewDeveloperWrapper struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDeveloperWorkflow is a Temporal workflow
|
// NewDeveloperWorkflow is a Temporal workflow
|
||||||
func NewDeveloperWorkflow(
|
func NewDeveloperWorkflow(ctx workflow.Context, w NewDeveloperWorkflowWrapper) error { //nolint:funlen,gocritic,lll // don't care
|
||||||
ctx workflow.Context,
|
|
||||||
w *NewDeveloperWrapper,
|
|
||||||
) error {
|
|
||||||
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
|
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
|
||||||
StartToCloseTimeout: time.Minute,
|
StartToCloseTimeout: time.Minute,
|
||||||
})
|
})
|
||||||
err := workflow.ExecuteActivity(ctx,
|
err := workflow.ExecuteActivity(ctx,
|
||||||
StoreContactActivity,
|
StoreContactActivity,
|
||||||
&app.ContactChannelWrapper{
|
app.ContactChannelWrapper{
|
||||||
Obj: crm_models.Contact{
|
Obj: crm_models.Contact{
|
||||||
AccountID: "",
|
AccountID: "",
|
||||||
AssistantName: "",
|
AssistantName: "",
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
temporal_workflow "go.temporal.io/sdk/workflow"
|
temporal_workflow "go.temporal.io/sdk/workflow"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewLeadWrapper wraps a Lead and a user identifier (app.User)
|
// NewLeadWorkflowWrapper wraps a Lead with auth and saga info
|
||||||
type NewLeadWrapper struct {
|
type NewLeadWorkflowWrapper struct {
|
||||||
// Address *crm_models.Address
|
// Address crm_models.Address
|
||||||
Company string
|
Company string
|
||||||
Description string
|
Description string
|
||||||
Email string
|
Email string
|
||||||
|
@ -40,7 +40,7 @@ type NewLeadWrapper struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewLeadWorkflow is a Temporal workflow
|
// 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{
|
obj := crm_models.Lead{
|
||||||
// Address: w.Address,
|
// Address: w.Address,
|
||||||
Company: w.Company,
|
Company: w.Company,
|
||||||
|
@ -76,7 +76,7 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, w *NewLeadWrapper) error {
|
||||||
ExecuteActivity(
|
ExecuteActivity(
|
||||||
ctx,
|
ctx,
|
||||||
StoreLeadActivity,
|
StoreLeadActivity,
|
||||||
&app.LeadChannelWrapper{
|
app.LeadChannelWrapper{
|
||||||
Obj: obj,
|
Obj: obj,
|
||||||
SagaID: w.SagaID,
|
SagaID: w.SagaID,
|
||||||
SagaType: w.SagaType,
|
SagaType: w.SagaType,
|
||||||
|
@ -89,7 +89,7 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, w *NewLeadWrapper) error {
|
||||||
ExecuteActivity(
|
ExecuteActivity(
|
||||||
ctx,
|
ctx,
|
||||||
NotifyLeadActivity,
|
NotifyLeadActivity,
|
||||||
&app.LeadChannelWrapper{
|
app.LeadChannelWrapper{
|
||||||
Obj: obj,
|
Obj: obj,
|
||||||
APIKey: w.APIKey,
|
APIKey: w.APIKey,
|
||||||
}).Get(ctx, nil)
|
}).Get(ctx, nil)
|
||||||
|
|
Loading…
Reference in New Issue