package rules import ( "time" "code.tnxs.net/taxnexus/lib/api/devops/devops_models" "code.tnxs.net/taxnexus/lib/app" "go.temporal.io/sdk/workflow" ) // NewUserActivityWrapper wraps a contact, account, payment method and a user identifier (app.User) type NewUserActivityWrapper struct { User devops_models.User Principal app.User SagaID string SagaType string } // NewUserWorkflow is a Temporal workflow func NewUserWorkflow(ctx workflow.Context, payload *NewUserActivityWrapper) error { ctx = workflow.WithActivityOptions( ctx, workflow.ActivityOptions{ StartToCloseTimeout: time.Minute, }) err := workflow.ExecuteActivity(ctx, StoreUserActivity, &app.UserActivityWrapper{ Obj: payload.User, APIKey: payload.Principal.APIKey, SagaID: payload.SagaID, SagaType: payload.SagaType, }).Get(ctx, nil) if err != nil { return err } err = workflow.ExecuteActivity( ctx, NotifyLeadActivity, payload, ).Get(ctx, nil) if err != nil { return err } return nil }