diff --git a/app/account.go b/app/account.go index 60ed664..90175bd 100644 --- a/app/account.go +++ b/app/account.go @@ -8,10 +8,10 @@ import ( // AccountChannelWrapper wraps the object with workflow params type AccountChannelWrapper struct { - Obj crm_models.Account - Principal User - SagaID string - SagaType string + Obj crm_models.Account + APIKey string + SagaID string + SagaType string } // Account is a DB struct diff --git a/app/accountingrule.go b/app/accountingrule.go index 1d95b15..0103539 100644 --- a/app/accountingrule.go +++ b/app/accountingrule.go @@ -8,10 +8,10 @@ import ( // AccountingRuleChannelWrapper wraps the object with workflow params type AccountingRuleChannelWrapper struct { - Obj ledger_models.AccountingRule - Principal User - SagaID string - SagaType string + Obj ledger_models.AccountingRule + APIKey string + SagaID string + SagaType string } // AccountingRule is a first class object type diff --git a/app/accountingruleset.go b/app/accountingruleset.go index 7847e00..00c77e1 100644 --- a/app/accountingruleset.go +++ b/app/accountingruleset.go @@ -8,10 +8,10 @@ import ( // AccountingRulesetChannelWrapper wraps the object with workflow params type AccountingRulesetChannelWrapper struct { - Obj ledger_models.AccountingRuleset - Principal User - SagaID string - SagaType string + Obj ledger_models.AccountingRuleset + APIKey string + SagaID string + SagaType string } // AccountingRuleset is exported diff --git a/app/accountingrulesetitem.go b/app/accountingrulesetitem.go index 752e206..b6d3782 100644 --- a/app/accountingrulesetitem.go +++ b/app/accountingrulesetitem.go @@ -8,10 +8,10 @@ import ( // AccountingRulesetItemChannelWrapper wraps the object with workflow params type AccountingRulesetItemChannelWrapper struct { - Obj ledger_models.AccountingRulesetItem - Principal User - SagaID string - SagaType string + Obj ledger_models.AccountingRulesetItem + APIKey string + SagaID string + SagaType string } // AccountingRulesetItem is a first class object type diff --git a/app/auth.go b/app/auth.go new file mode 100644 index 0000000..2f2a9ed --- /dev/null +++ b/app/auth.go @@ -0,0 +1,27 @@ +package app + +import ( + "code.tnxs.net/taxnexus/lib/api/auth/auth_client" + "code.tnxs.net/taxnexus/lib/api/auth/auth_client/user" + "code.tnxs.net/taxnexus/lib/api/auth/auth_models" +) + +var authClient = auth_client.Default + +// CheckAPIUser is exported +func CheckAPIUser(token *string) (*User, error) { + sugar.Debug("app.CheckAPIUser: 📥") + params := user.NewGetUsersParams() + params.Apikey = token + response, err := authClient.User.GetUsers(params, apiUsers["auth"].Auth) + if err != nil { + sugar.Warnf("app.CheckAPIUser: ❗ Access attempt with invalid API key: %s", *token) + return nil, err + } + var obj *auth_models.User + for _, itm := range response.Payload.Data { // single iteration execution + obj = itm + } + sugar.Debugf("app.CheckAPIUser: 📤 👍 ID = %s, Name = %s", obj.ID, obj.Name) + return MarshalAuthUserToSwagger(obj), nil +} diff --git a/app/backend.go b/app/backend.go index 1b77a9b..36ad405 100644 --- a/app/backend.go +++ b/app/backend.go @@ -8,10 +8,10 @@ import ( // BackendChannelWrapper wraps the object with workflow params type BackendChannelWrapper struct { - Obj regs_models.Backend - Principal User - SagaID string - SagaType string + Obj regs_models.Backend + APIKey string + SagaID string + SagaType string } // Backend is a first class object type diff --git a/app/cashreceipt.go b/app/cashreceipt.go index 62cfb20..5461366 100644 --- a/app/cashreceipt.go +++ b/app/cashreceipt.go @@ -8,10 +8,10 @@ import ( // CashReceiptChannelWrapper wraps the object with workflow params type CashReceiptChannelWrapper struct { - Obj ops_models.CashReceipt - Principal User - SagaID string - SagaType string + Obj ops_models.CashReceipt + APIKey string + SagaID string + SagaType string } // CashReceipt is a first class object type diff --git a/app/charge.go b/app/charge.go index 297e9b4..b6df56f 100644 --- a/app/charge.go +++ b/app/charge.go @@ -8,10 +8,10 @@ import ( // ChargeChannelWrapper wraps the object with workflow params type ChargeChannelWrapper struct { - Obj ops_models.Charge - Principal User - SagaID string - SagaType string + Obj ops_models.Charge + APIKey string + SagaID string + SagaType string } // Charge is a first class object type diff --git a/app/cluster.go b/app/cluster.go index 35ebd6b..8e492a6 100644 --- a/app/cluster.go +++ b/app/cluster.go @@ -8,10 +8,10 @@ import ( // ClusterChannelWrapper wraps the object with workflow params type ClusterChannelWrapper struct { - Obj devops_models.Cluster - Principal User - SagaID string - SagaType string + Obj devops_models.Cluster + APIKey string + SagaID string + SagaType string } // Cluster is a first class object type diff --git a/app/company.go b/app/company.go index 9ff5090..887dd0e 100644 --- a/app/company.go +++ b/app/company.go @@ -8,10 +8,10 @@ import ( // CompanyChannelWrapper wraps the object with workflow params type CompanyChannelWrapper struct { - Obj crm_models.Company - Principal User - SagaID string - SagaType string + Obj crm_models.Company + APIKey string + SagaID string + SagaType string } // Company is a DB struct diff --git a/app/contact.go b/app/contact.go index 72225d0..206fb10 100644 --- a/app/contact.go +++ b/app/contact.go @@ -11,10 +11,10 @@ const NewContactActivity = "NEW_CONTACT_ACTIVITY" // ContactChannelWrapper wraps the object with workflow params type ContactChannelWrapper struct { - Obj crm_models.Contact - Principal User - SagaID string - SagaType string + Obj crm_models.Contact + APIKey string + SagaID string + SagaType string } // Contact is a first-class object diff --git a/app/coordinate.go b/app/coordinate.go index dab67dc..027dac8 100644 --- a/app/coordinate.go +++ b/app/coordinate.go @@ -8,10 +8,10 @@ import ( // CoordinateBasicChannelWrapper wraps the object with workflow params type CoordinateBasicChannelWrapper struct { - Obj geo_models.CoordinateBasic - Principal User - SagaID string - SagaType string + Obj geo_models.CoordinateBasic + APIKey string + SagaID string + SagaType string } // CoordinateBasic is a first class object type @@ -31,10 +31,10 @@ type CoordinateBasic struct { // CoordinateChannelWrapper wraps the object with workflow params type CoordinateChannelWrapper struct { - Obj geo_models.Coordinate - Principal User - SagaID string - SagaType string + Obj geo_models.Coordinate + APIKey string + SagaID string + SagaType string } // Coordinate is a first class object type diff --git a/app/country.go b/app/country.go index 3bfc23a..2fa6de4 100644 --- a/app/country.go +++ b/app/country.go @@ -8,10 +8,10 @@ import ( // CountryChannelWrapper wraps the object with workflow params type CountryChannelWrapper struct { - Obj geo_models.Country - Principal User - SagaID string - SagaType string + Obj geo_models.Country + APIKey string + SagaID string + SagaType string } // Country is a first class object type diff --git a/app/county.go b/app/county.go index b6e3667..3672336 100644 --- a/app/county.go +++ b/app/county.go @@ -8,10 +8,10 @@ import ( // CountyChannelWrapper wraps the object with workflow params type CountyChannelWrapper struct { - Obj geo_models.County - Principal User - SagaID string - SagaType string + Obj geo_models.County + APIKey string + SagaID string + SagaType string } // County is a first class object type diff --git a/app/database.go b/app/database.go index c1a2a2a..4274071 100644 --- a/app/database.go +++ b/app/database.go @@ -8,10 +8,10 @@ import ( // DatabaseChannelWrapper wraps the object with workflow params type DatabaseChannelWrapper struct { - Obj devops_models.Database - Principal User - SagaID string - SagaType string + Obj devops_models.Database + APIKey string + SagaID string + SagaType string } // Database is a first-class object type diff --git a/app/domain.go b/app/domain.go index b2934db..1c9aa5b 100644 --- a/app/domain.go +++ b/app/domain.go @@ -4,10 +4,10 @@ import "code.tnxs.net/taxnexus/lib/api/geo/geo_models" // DomainChannelWrapper wraps the object with workflow params type DomainChannelWrapper struct { - Obj geo_models.Domain - Principal User - SagaID string - SagaType string + Obj geo_models.Domain + APIKey string + SagaID string + SagaType string } // Domain is a first class object type diff --git a/app/eft.go b/app/eft.go index c660f77..1342d9e 100644 --- a/app/eft.go +++ b/app/eft.go @@ -8,10 +8,10 @@ import ( // EftChannelWrapper wraps the object with workflow params type EftChannelWrapper struct { - Obj ops_models.Eft - Principal User - SagaID string - SagaType string + Obj ops_models.Eft + APIKey string + SagaID string + SagaType string } // Eft is a first class object type diff --git a/app/eftitem.go b/app/eftitem.go index a316228..52ee5a5 100644 --- a/app/eftitem.go +++ b/app/eftitem.go @@ -8,10 +8,10 @@ import ( // EftItemChannelWrapper wraps the object with workflow params type EftItemChannelWrapper struct { - Obj ops_models.EftItem - Principal User - SagaID string - SagaType string + Obj ops_models.EftItem + APIKey string + SagaID string + SagaType string } // EftItem is a first class object type diff --git a/app/emailmessage.go b/app/emailmessage.go index 5f13129..fd1f4c7 100644 --- a/app/emailmessage.go +++ b/app/emailmessage.go @@ -8,10 +8,10 @@ import ( // EmailMessageChannelWrapper wraps the object with workflow params type EmailMessageChannelWrapper struct { - Obj workflow_models.EmailMessage - Principal User - SagaID string - SagaType string + Obj workflow_models.EmailMessage + APIKey string + SagaID string + SagaType string } // EmailMessage is a first class object type diff --git a/app/emaitemplate.go b/app/emaitemplate.go index b533854..88361b8 100644 --- a/app/emaitemplate.go +++ b/app/emaitemplate.go @@ -7,9 +7,9 @@ import ( // EmailTemplateChannelWrapper wraps the object with workflow params type EmailTemplateChannelWrapper struct { // Obj workflow_models.EmailTemplate - Principal User - SagaID string - SagaType string + APIKey string + SagaID string + SagaType string } // EmailTemplate is a first class object type diff --git a/app/filing.go b/app/filing.go index d0a9ba1..a82f6eb 100644 --- a/app/filing.go +++ b/app/filing.go @@ -8,10 +8,10 @@ import ( // FilingChannelWrapper wraps the object with workflow params type FilingChannelWrapper struct { - Obj regs_models.Filing - Principal User - SagaID string - SagaType string + Obj regs_models.Filing + APIKey string + SagaID string + SagaType string } // Filing is a first class object type diff --git a/app/filingscheduleitem.go b/app/filingscheduleitem.go index ef9ab78..35b5bbc 100644 --- a/app/filingscheduleitem.go +++ b/app/filingscheduleitem.go @@ -8,10 +8,10 @@ import ( // FilingScheduleItemChannelWrapper wraps the object with workflow params type FilingScheduleItemChannelWrapper struct { - Obj regs_models.FilingScheduleItem - Principal User - SagaID string - SagaType string + Obj regs_models.FilingScheduleItem + APIKey string + SagaID string + SagaType string } // FilingScheduleItem is a first class object type diff --git a/app/filingtype.go b/app/filingtype.go index fb79fb2..0f526b5 100644 --- a/app/filingtype.go +++ b/app/filingtype.go @@ -8,10 +8,10 @@ import ( // FilingTypeChannelWrapper wraps the object with workflow params type FilingTypeChannelWrapper struct { - Obj regs_models.FilingType - Principal User - SagaID string - SagaType string + Obj regs_models.FilingType + APIKey string + SagaID string + SagaType string } // FilingType is a first class object type diff --git a/app/filingtypeinstance.go b/app/filingtypeinstance.go index 11565ea..b8fe2c6 100644 --- a/app/filingtypeinstance.go +++ b/app/filingtypeinstance.go @@ -8,10 +8,10 @@ import ( // FilingTypeInstanceChannelWrapper wraps the object with workflow params type FilingTypeInstanceChannelWrapper struct { - Obj regs_models.FilingTypeInstance - Principal User - SagaID string - SagaType string + Obj regs_models.FilingTypeInstance + APIKey string + SagaID string + SagaType string } // FilingTypeInstance is a first class object type diff --git a/app/folder.go b/app/folder.go index b5d68a0..088836b 100644 --- a/app/folder.go +++ b/app/folder.go @@ -7,9 +7,9 @@ import ( // FolderChannelWrapper wraps the object with workflow params type FolderChannelWrapper struct { // Obj workflow_models.Folder - Principal User - SagaID string - SagaType string + APIKey string + SagaID string + SagaType string } // Folder is a first class object type diff --git a/app/glaccount.go b/app/glaccount.go index 6fd824f..4ca41df 100644 --- a/app/glaccount.go +++ b/app/glaccount.go @@ -8,10 +8,10 @@ import ( // GlAccountChannelWrapper wraps the object with workflow params type GlAccountChannelWrapper struct { - Obj ledger_models.GlAccount - Principal User - SagaID string - SagaType string + Obj ledger_models.GlAccount + APIKey string + SagaID string + SagaType string } // GlAccount is a first class object type diff --git a/app/glbalance.go b/app/glbalance.go index 7d14c0c..127c208 100644 --- a/app/glbalance.go +++ b/app/glbalance.go @@ -8,10 +8,10 @@ import ( // GlBalanceChannelWrapper wraps the object with workflow params type GlBalanceChannelWrapper struct { - Obj ledger_models.GlBalance - Principal User - SagaID string - SagaType string + Obj ledger_models.GlBalance + APIKey string + SagaID string + SagaType string } // GlBalance is a first class object type diff --git a/app/ingest.go b/app/ingest.go index 13d4684..1fbcb66 100644 --- a/app/ingest.go +++ b/app/ingest.go @@ -8,10 +8,10 @@ import ( // IngestChannelWrapper wraps the object with workflow params type IngestChannelWrapper struct { - Obj devops_models.Ingest - Principal User - SagaID string - SagaType string + Obj devops_models.Ingest + APIKey string + SagaID string + SagaType string } // Ingest is a first class object type diff --git a/app/invoice.go b/app/invoice.go index 7d8aac6..2f71d25 100644 --- a/app/invoice.go +++ b/app/invoice.go @@ -8,10 +8,10 @@ import ( // InvoiceChannelWrapper wraps the object with workflow params type InvoiceChannelWrapper struct { - Obj ops_models.Invoice - Principal User - SagaID string - SagaType string + Obj ops_models.Invoice + APIKey string + SagaID string + SagaType string } // Invoice is the in-memory struct for invoices diff --git a/app/invoiceitem.go b/app/invoiceitem.go index 873223e..97f754d 100644 --- a/app/invoiceitem.go +++ b/app/invoiceitem.go @@ -8,10 +8,10 @@ import ( // InvoiceItemChannelWrapper wraps the object with workflow params type InvoiceItemChannelWrapper struct { - Obj ops_models.InvoiceItem - Principal User - SagaID string - SagaType string + Obj ops_models.InvoiceItem + APIKey string + SagaID string + SagaType string } // InvoiceItem is a large struct diff --git a/app/job.go b/app/job.go index 9888e3f..9d00299 100644 --- a/app/job.go +++ b/app/job.go @@ -8,10 +8,10 @@ import ( // JobChannelWrapper wraps the object with workflow params type JobChannelWrapper struct { - Obj devops_models.Job - Principal User - SagaID string - SagaType string + Obj devops_models.Job + APIKey string + SagaID string + SagaType string } // Job is a first class object type diff --git a/app/journalentry.go b/app/journalentry.go index 2bd4a82..f6f9f2b 100644 --- a/app/journalentry.go +++ b/app/journalentry.go @@ -8,10 +8,10 @@ import ( // JournalEntryChannelWrapper wraps the object with workflow params type JournalEntryChannelWrapper struct { - Obj ledger_models.JournalEntry - Principal User - SagaID string - SagaType string + Obj ledger_models.JournalEntry + APIKey string + SagaID string + SagaType string } // JournalEntry is a first class object type diff --git a/app/journalitem.go b/app/journalitem.go index 0cb773a..e2537bd 100644 --- a/app/journalitem.go +++ b/app/journalitem.go @@ -8,10 +8,10 @@ import ( // JournalItemChannelWrapper wraps the object with workflow params type JournalItemChannelWrapper struct { - Obj ledger_models.JournalItem - Principal User - SagaID string - SagaType string + Obj ledger_models.JournalItem + APIKey string + SagaID string + SagaType string } // JournalItem is a first class object type diff --git a/app/lead.go b/app/lead.go index c4141d0..b3a1b33 100644 --- a/app/lead.go +++ b/app/lead.go @@ -8,10 +8,10 @@ import ( // LeadChannelWrapper wraps the object with workflow params type LeadChannelWrapper struct { - Obj crm_models.Lead - Principal User - SagaID string - SagaType string + Obj crm_models.Lead + APIKey string + SagaID string + SagaType string } // Lead is a first-class object type diff --git a/app/license.go b/app/license.go index 467c71a..efd25b8 100644 --- a/app/license.go +++ b/app/license.go @@ -8,10 +8,10 @@ import ( // LicenseChannelWrapper wraps the object with workflow params type LicenseChannelWrapper struct { - Obj regs_models.License - Principal User - SagaID string - SagaType string + Obj regs_models.License + APIKey string + SagaID string + SagaType string } // License is a first class object type diff --git a/app/licensetype.go b/app/licensetype.go index 8a66ecf..fbb9c80 100644 --- a/app/licensetype.go +++ b/app/licensetype.go @@ -8,10 +8,10 @@ import ( // LicenseTypeChannelWrapper wraps the object with workflow params type LicenseTypeChannelWrapper struct { - Obj regs_models.LicenseType - Principal User - SagaID string - SagaType string + Obj regs_models.LicenseType + APIKey string + SagaID string + SagaType string } // LicenseType is a first class object type @@ -41,10 +41,10 @@ type LicenseType struct { // GeoLicenseTypeInstanceChannelWrapper wraps the object with workflow params type GeoLicenseTypeInstanceChannelWrapper struct { - Obj regs_models.GeoLicenseTypeInstance - Principal User - SagaID string - SagaType string + Obj regs_models.GeoLicenseTypeInstance + APIKey string + SagaID string + SagaType string } // GeoLicenseTypeInstance is a first class object type @@ -67,9 +67,9 @@ type GeoLicenseTypeInstance struct { // DomainLicenseTypeInstanceChannelWrapper wraps the object with workflow params type DomainLicenseTypeInstanceChannelWrapper struct { // Obj regs_models.DomainLicenseTypeInstance - Principal User - SagaID string - SagaType string + APIKey string + SagaID string + SagaType string } // DomainLicenseTypeInstance is a first class object type diff --git a/app/log.go b/app/log.go index 1702de1..e356dfc 100644 --- a/app/log.go +++ b/app/log.go @@ -5,9 +5,9 @@ import "database/sql" // LogChannelWrapper wraps the object with workflow params type LogChannelWrapper struct { // Obj devops_models.AppLog - Principal User - SagaID string - SagaType string + APIKey string + SagaID string + SagaType string } // Log is a first class object type diff --git a/app/notebook.go b/app/notebook.go index 63e28f8..88572f7 100644 --- a/app/notebook.go +++ b/app/notebook.go @@ -8,10 +8,10 @@ import ( // NotebookChannelWrapper wraps the object with workflow params type NotebookChannelWrapper struct { - Obj regs_models.Notebook - Principal User - SagaID string - SagaType string + Obj regs_models.Notebook + APIKey string + SagaID string + SagaType string } // Notebook is a first class object type diff --git a/app/notebookitem.go b/app/notebookitem.go index d3c43e9..2b8dcb1 100644 --- a/app/notebookitem.go +++ b/app/notebookitem.go @@ -8,10 +8,10 @@ import ( // NotebookItemChannelWrapper wraps the object with workflow params type NotebookItemChannelWrapper struct { - Obj regs_models.NotebookItem - Principal User - SagaID string - SagaType string + Obj regs_models.NotebookItem + APIKey string + SagaID string + SagaType string } // NotebookItem is a first class object type diff --git a/app/order.go b/app/order.go index c2d5722..e98e4e5 100644 --- a/app/order.go +++ b/app/order.go @@ -8,10 +8,10 @@ import ( // OrderChannelWrapper wraps the object with workflow params type OrderChannelWrapper struct { - Obj ops_models.Order - Principal User - SagaID string - SagaType string + Obj ops_models.Order + APIKey string + SagaID string + SagaType string } // Order is a first class object type diff --git a/app/orderitem.go b/app/orderitem.go index 24d07d3..aeb5d9f 100644 --- a/app/orderitem.go +++ b/app/orderitem.go @@ -8,10 +8,10 @@ import ( // OrderItemChannelWrapper wraps the object with workflow params type OrderItemChannelWrapper struct { - Obj ops_models.OrderItem - Principal User - SagaID string - SagaType string + Obj ops_models.OrderItem + APIKey string + SagaID string + SagaType string } // OrderItem is a first class object type diff --git a/app/outgoingemail.go b/app/outgoingemail.go index 26248b5..3b40003 100644 --- a/app/outgoingemail.go +++ b/app/outgoingemail.go @@ -4,10 +4,10 @@ import "code.tnxs.net/taxnexus/lib/api/workflow/workflow_models" // OutgoingEmailMessageChannelWrapper wraps the object with workflow params type OutgoingEmailMessageChannelWrapper struct { - Obj workflow_models.OutgoingEmailMessage - Principal User - SagaID string - SagaType string + Obj workflow_models.OutgoingEmailMessage + APIKey string + SagaID string + SagaType string } // OutgoingEmailMessage is a first class object type diff --git a/app/outgoingemailreceipt.go b/app/outgoingemailreceipt.go index af39a5f..4e07280 100644 --- a/app/outgoingemailreceipt.go +++ b/app/outgoingemailreceipt.go @@ -3,9 +3,9 @@ package app // OutgoingEmailMessageReceiptChannelWrapper wraps the object with workflow params type OutgoingEmailMessageReceiptChannelWrapper struct { // Obj workflow_models.OutgoingEmailMessageReceipt - Principal User - SagaID string - SagaType string + APIKey string + SagaID string + SagaType string } // OutgoingEmailMessageReceipt is a first class object type diff --git a/app/paymentmethod.go b/app/paymentmethod.go index 4f69cde..fd0275a 100644 --- a/app/paymentmethod.go +++ b/app/paymentmethod.go @@ -8,10 +8,10 @@ import ( // PaymentMethodChannelWrapper wraps the object with workflow params type PaymentMethodChannelWrapper struct { - Obj ops_models.PaymentMethod - Principal User - SagaID string - SagaType string + Obj ops_models.PaymentMethod + APIKey string + SagaID string + SagaType string } // PaymentMethod is a first class object type diff --git a/app/pdf.go b/app/pdf.go index 48d9932..7d55cef 100644 --- a/app/pdf.go +++ b/app/pdf.go @@ -5,9 +5,9 @@ import "database/sql" // PDFChannelWrapper wraps the object with workflow params type PDFChannelWrapper struct { // Obj stash_models.Pdf - Principal User - SagaID string - SagaType string + APIKey string + SagaID string + SagaType string } // PDF is a first class object type diff --git a/app/period.go b/app/period.go index 2eeb883..676d95a 100644 --- a/app/period.go +++ b/app/period.go @@ -8,10 +8,10 @@ import ( // PeriodChannelWrapper wraps the object with workflow params type PeriodChannelWrapper struct { - Obj ledger_models.Period - Principal User - SagaID string - SagaType string + Obj ledger_models.Period + APIKey string + SagaID string + SagaType string } // Period is a first class object type diff --git a/app/place.go b/app/place.go index 106d54e..8362e98 100644 --- a/app/place.go +++ b/app/place.go @@ -8,10 +8,10 @@ import ( // PlaceChannelWrapper wraps the object with workflow params type PlaceChannelWrapper struct { - Obj geo_models.Place - Principal User - SagaID string - SagaType string + Obj geo_models.Place + APIKey string + SagaID string + SagaType string } // Place is a first class object type diff --git a/app/po.go b/app/po.go index afa7164..59b078f 100644 --- a/app/po.go +++ b/app/po.go @@ -8,10 +8,10 @@ import ( // PurchaseOrderChannelWrapper wraps the object with workflow params type PurchaseOrderChannelWrapper struct { - Obj ops_models.PurchaseOrder - Principal User - SagaID string - SagaType string + Obj ops_models.PurchaseOrder + APIKey string + SagaID string + SagaType string } // PurchaseOrder is a first class object type diff --git a/app/poitem.go b/app/poitem.go index 4411dd9..9866382 100644 --- a/app/poitem.go +++ b/app/poitem.go @@ -8,10 +8,10 @@ import ( // PurchaseOrderItemChannelWrapper wraps the object with workflow params type PurchaseOrderItemChannelWrapper struct { - Obj ops_models.PurchaseOrderItem - Principal User - SagaID string - SagaType string + Obj ops_models.PurchaseOrderItem + APIKey string + SagaID string + SagaType string } // PurchaseOrderItem is a first class object type diff --git a/app/product.go b/app/product.go index 7552c99..a4d2f0f 100644 --- a/app/product.go +++ b/app/product.go @@ -8,10 +8,10 @@ import ( // ProductChannelWrapper wraps the object with workflow params type ProductChannelWrapper struct { - Obj ops_models.Product - Principal User - SagaID string - SagaType string + Obj ops_models.Product + APIKey string + SagaID string + SagaType string } // Product is a first class object type diff --git a/app/quote.go b/app/quote.go index 1dc14fb..70d88ef 100644 --- a/app/quote.go +++ b/app/quote.go @@ -8,10 +8,10 @@ import ( // QuoteChannelWrapper wraps the object with workflow params type QuoteChannelWrapper struct { - Obj ops_models.Quote - Principal User - SagaID string - SagaType string + Obj ops_models.Quote + APIKey string + SagaID string + SagaType string } // Quote is a first class object type diff --git a/app/quoteitem.go b/app/quoteitem.go index 60c9533..e5dfd7f 100644 --- a/app/quoteitem.go +++ b/app/quoteitem.go @@ -8,10 +8,10 @@ import ( // QuoteItemChannelWrapper wraps the object with workflow params type QuoteItemChannelWrapper struct { - Obj ops_models.QuoteItem - Principal User - SagaID string - SagaType string + Obj ops_models.QuoteItem + APIKey string + SagaID string + SagaType string } // QuoteItem is a first class object type diff --git a/app/ratingengine.go b/app/ratingengine.go index 8726231..7ea4b6c 100644 --- a/app/ratingengine.go +++ b/app/ratingengine.go @@ -7,10 +7,10 @@ import ( // RatingengineChannelWrapper wraps the object with workflow params type RatingengineChannelWrapper struct { - Obj regs_models.RatingEngine - Principal User - SagaID string - SagaType string + Obj regs_models.RatingEngine + APIKey string + SagaID string + SagaType string } // RatingEngine is a first class object type diff --git a/app/ratingengineitem.go b/app/ratingengineitem.go index 97555c2..ce4c39c 100644 --- a/app/ratingengineitem.go +++ b/app/ratingengineitem.go @@ -7,10 +7,10 @@ import ( // RatingEngineItemChannelWrapper wraps the object with workflow params type RatingEngineItemChannelWrapper struct { - Obj regs_models.RatingEngineItem - Principal User - SagaID string - SagaType string + Obj regs_models.RatingEngineItem + APIKey string + SagaID string + SagaType string } // RatingEngineItem is a first class object type diff --git a/app/role.go b/app/role.go index 70c2ef8..88581c8 100644 --- a/app/role.go +++ b/app/role.go @@ -8,10 +8,10 @@ import ( // RoleChannelWrapper wraps the object with workflow params type RoleChannelWrapper struct { - Obj devops_models.Role - Principal User - SagaID string - SagaType string + Obj devops_models.Role + APIKey string + SagaID string + SagaType string } // Role is a first class object type diff --git a/app/root.go b/app/root.go index 5ee852b..b97b9ba 100644 --- a/app/root.go +++ b/app/root.go @@ -7,6 +7,7 @@ import ( "code.tnxs.net/taxnexus/lib/api/auth0/auth0_client" "code.tnxs.net/taxnexus/lib/app/logger" + httptransport "github.com/go-openapi/runtime/client" "github.com/spf13/viper" "go.uber.org/zap" "go.uber.org/zap/zapcore" @@ -17,6 +18,7 @@ var config = Configuration{} var appViper = viper.New() var auth0Client = auth0_client.Default var configured = false +var apiUsers map[string]User const getTimeout = 6 * time.Minute const postTimeout = 6 * time.Minute @@ -48,12 +50,30 @@ func InitConfig(systemName string) { sugar.Fatalf("app.InitConfig: 💣 ⛔ can't unmarshal system config: %w", err) } sugar = logger.New(GetLogLevel()) + apiUsers = initAPIUsers() sugar.Debugf("app.InitConfig: 👍 📤 serviceAccounts: %d", len(config.ServiceAccounts)) configured = true } -// FirstClassObject is a struct -type FirstClassObject interface { - Marshal() interface{} - UnMarshal() interface{} +func initAPIUsers() map[string]User { + sugar.Info("board.initAPIUsers: 📥") + users := map[string]User{ + "auth": { + APIKey: GetServiceAccount("auth").APIKey, + Auth: httptransport.APIKeyAuth( + "X-API-Key", + "header", + GetServiceAccount("auth").APIKey, + ), + }, + "test-service-account": { + APIKey: GetServiceAccount("test-service-account").APIKey, + Auth: httptransport.APIKeyAuth( + "X-API-Key", + "header", + GetServiceAccount("test-service-account").APIKey), + }, + } + sugar.Debugf("board.initAPIUsers: 👍 📤") + return users } diff --git a/app/service.go b/app/service.go index 550a6a8..b97a325 100644 --- a/app/service.go +++ b/app/service.go @@ -8,10 +8,10 @@ import ( // ServiceChannelWrapper wraps the object with workflow params type ServiceChannelWrapper struct { - Obj devops_models.Service - Principal User - SagaID string - SagaType string + Obj devops_models.Service + APIKey string + SagaID string + SagaType string } // Service is a first class object type diff --git a/app/state.go b/app/state.go index e832f25..ff19794 100644 --- a/app/state.go +++ b/app/state.go @@ -8,10 +8,10 @@ import ( // StateChannelWrapper wraps the object with workflow params type StateChannelWrapper struct { - Obj geo_models.State - Principal User - SagaID string - SagaType string + Obj geo_models.State + APIKey string + SagaID string + SagaType string } // State is a first class object type diff --git a/app/submission.go b/app/submission.go index 2a08b5f..f4e1bd9 100644 --- a/app/submission.go +++ b/app/submission.go @@ -8,10 +8,10 @@ import ( // SubmissionChannelWrapper wraps the object with workflow params type SubmissionChannelWrapper struct { - Obj regs_models.Submission - Principal User - SagaID string - SagaType string + Obj regs_models.Submission + APIKey string + SagaID string + SagaType string } // Submission is a first class object type diff --git a/app/task.go b/app/task.go index 5be81e1..0ec067f 100644 --- a/app/task.go +++ b/app/task.go @@ -7,9 +7,9 @@ import ( // TaskChannelWrapper wraps the object with workflow params type TaskChannelWrapper struct { // Obj workflow_models.Task - Principal User - SagaID string - SagaType string + APIKey string + SagaID string + SagaType string } // Task is a first class object type diff --git a/app/taskrelation.go b/app/taskrelation.go index e6ee134..00dfb2a 100644 --- a/app/taskrelation.go +++ b/app/taskrelation.go @@ -7,9 +7,9 @@ import ( // TaskRelationChannelWrapper wraps the object with workflow params type TaskRelationChannelWrapper struct { // Obj workflow_models.TaskRelation - Principal User - SagaID string - SagaType string + APIKey string + SagaID string + SagaType string } // TaskRelation is a first class object type diff --git a/app/taskwhorelation.go b/app/taskwhorelation.go index 451ff21..9b74461 100644 --- a/app/taskwhorelation.go +++ b/app/taskwhorelation.go @@ -7,9 +7,9 @@ import ( // TaskWhoRelationChannelWrapper wraps the object with workflow params type TaskWhoRelationChannelWrapper struct { // Obj workflow_models.TaskWhoRelation - Principal User - SagaID string - SagaType string + APIKey string + SagaID string + SagaType string } // TaskWhoRelation is a first class object type diff --git a/app/taxinstance.go b/app/taxinstance.go index d14aa78..e3baa78 100644 --- a/app/taxinstance.go +++ b/app/taxinstance.go @@ -8,10 +8,10 @@ import ( // TaxInstanceChannelWrapper wraps the object with workflow params type TaxInstanceChannelWrapper struct { - Obj geo_models.TaxInstance - Principal User - SagaID string - SagaType string + Obj geo_models.TaxInstance + APIKey string + SagaID string + SagaType string } // TaxInstance is a first class object type diff --git a/app/taxnexuscode.go b/app/taxnexuscode.go index 2199303..648ae56 100644 --- a/app/taxnexuscode.go +++ b/app/taxnexuscode.go @@ -8,10 +8,10 @@ import ( // TaxnexusCodeChannelWrapper wraps the object with workflow params type TaxnexusCodeChannelWrapper struct { - Obj geo_models.TaxnexusCode - Principal User - SagaID string - SagaType string + Obj geo_models.TaxnexusCode + APIKey string + SagaID string + SagaType string } // TaxnexusCode is a first class object type diff --git a/app/taxrate.go b/app/taxrate.go index f04bb69..10cf37f 100644 --- a/app/taxrate.go +++ b/app/taxrate.go @@ -4,10 +4,10 @@ import "code.tnxs.net/taxnexus/lib/api/geo/geo_models" // TaxRateChannelWrapper wraps the object with workflow params type TaxRateChannelWrapper struct { - Obj geo_models.TaxRate - Principal User - SagaID string - SagaType string + Obj geo_models.TaxRate + APIKey string + SagaID string + SagaType string } // TaxRate is a principal object type diff --git a/app/taxtransaction.go b/app/taxtransaction.go index ca52801..5416705 100644 --- a/app/taxtransaction.go +++ b/app/taxtransaction.go @@ -8,10 +8,10 @@ import ( // TaxTransactionChannelWrapper wraps the object with workflow params type TaxTransactionChannelWrapper struct { - Obj ops_models.TaxTransaction - Principal User - SagaID string - SagaType string + Obj ops_models.TaxTransaction + APIKey string + SagaID string + SagaType string } // TaxTransaction is the in-memory struct for a Taxnexus Tax Transaction diff --git a/app/taxtype.go b/app/taxtype.go index 9e19de3..e5b559d 100644 --- a/app/taxtype.go +++ b/app/taxtype.go @@ -8,10 +8,10 @@ import ( // TaxTypeChannelWrapper wraps the object with workflow params type TaxTypeChannelWrapper struct { - Obj geo_models.TaxType - Principal User - SagaID string - SagaType string + Obj geo_models.TaxType + APIKey string + SagaID string + SagaType string } // TaxType is a first class object type diff --git a/app/taxtypeaccount.go b/app/taxtypeaccount.go index c147c0f..18e1f90 100644 --- a/app/taxtypeaccount.go +++ b/app/taxtypeaccount.go @@ -8,10 +8,10 @@ import ( // TaxTypeAccountChannelWrapper wraps the object with workflow params type TaxTypeAccountChannelWrapper struct { - Obj regs_models.TaxTypeAccount - Principal User - SagaID string - SagaType string + Obj regs_models.TaxTypeAccount + APIKey string + SagaID string + SagaType string } // TaxTypeAccount is a first class object type diff --git a/app/template.go b/app/template.go index 3146291..959b638 100644 --- a/app/template.go +++ b/app/template.go @@ -8,10 +8,10 @@ import ( // TemplateChannelWrapper wraps the object with workflow params type TemplateChannelWrapper struct { - Obj devops_models.Template - Principal User - SagaID string - SagaType string + Obj devops_models.Template + APIKey string + SagaID string + SagaType string } // Template is a first class object type diff --git a/app/tenant.go b/app/tenant.go index 8c3f9b3..d8ce4df 100644 --- a/app/tenant.go +++ b/app/tenant.go @@ -8,10 +8,10 @@ import ( // TenantChannelWrapper wraps the object with workflow params type TenantChannelWrapper struct { - Obj devops_models.Tenant - Principal User - SagaID string - SagaType string + Obj devops_models.Tenant + APIKey string + SagaID string + SagaType string } // Tenant is a first class object type diff --git a/app/tenantuser.go b/app/tenantuser.go index 14897db..90f8ab4 100644 --- a/app/tenantuser.go +++ b/app/tenantuser.go @@ -4,10 +4,10 @@ import "code.tnxs.net/taxnexus/lib/api/devops/devops_models" // TenantUserChannelWrapper wraps the object with workflow params type TenantUserChannelWrapper struct { - Obj devops_models.TenantUser - Principal User - SagaID string - SagaType string + Obj devops_models.TenantUser + APIKey string + SagaID string + SagaType string } // TenantUser is a first class object type diff --git a/app/total.go b/app/total.go index c1c5933..84fa1ab 100644 --- a/app/total.go +++ b/app/total.go @@ -4,10 +4,10 @@ import "code.tnxs.net/taxnexus/lib/api/ops/ops_models" // TotalChannelWrapper wraps the object with workflow params type TotalChannelWrapper struct { - Obj ops_models.Total - Principal User - SagaID string - SagaType string + Obj ops_models.Total + APIKey string + SagaID string + SagaType string } // Total is a DB object diff --git a/app/totalitem.go b/app/totalitem.go index b5c824f..0891cbd 100644 --- a/app/totalitem.go +++ b/app/totalitem.go @@ -4,10 +4,10 @@ import "code.tnxs.net/taxnexus/lib/api/ops/ops_models" // TotalItemChannelWrapper wraps the object with workflow params type TotalItemChannelWrapper struct { - Obj ops_models.TotalItem - Principal User - SagaID string - SagaType string + Obj ops_models.TotalItem + APIKey string + SagaID string + SagaType string } // TotalItem is a DB struct diff --git a/app/totaltaxitem.go b/app/totaltaxitem.go index 2cc749f..b6f706f 100644 --- a/app/totaltaxitem.go +++ b/app/totaltaxitem.go @@ -4,10 +4,10 @@ import "code.tnxs.net/taxnexus/lib/api/ops/ops_models" // TotalTaxItemChannelWrapper wraps the object with workflow params type TotalTaxItemChannelWrapper struct { - Obj ops_models.TotalTaxItem - Principal User - SagaID string - SagaType string + Obj ops_models.TotalTaxItem + APIKey string + SagaID string + SagaType string } // TotalTaxItem is a DB struct diff --git a/app/transaction.go b/app/transaction.go index 1f12c02..6237612 100644 --- a/app/transaction.go +++ b/app/transaction.go @@ -8,10 +8,10 @@ import ( // TransactionItemChannelWrapper wraps the object with workflow params type TransactionItemChannelWrapper struct { - Obj regs_models.Transaction - Principal User - SagaID string - SagaType string + Obj regs_models.Transaction + APIKey string + SagaID string + SagaType string } // Transaction is a first class object type diff --git a/app/user.go b/app/user.go index 291ffec..4e0408f 100644 --- a/app/user.go +++ b/app/user.go @@ -7,10 +7,10 @@ import ( // UserChannelWrapper wraps the object with workflow params type UserChannelWrapper struct { - Obj devops_models.User - Principal User - SagaID string - SagaType string + Obj devops_models.User + APIKey string + SagaID string + SagaType string } // User is a first class object type diff --git a/app/userrole.go b/app/userrole.go index 3dd40b8..bc1b889 100644 --- a/app/userrole.go +++ b/app/userrole.go @@ -4,10 +4,10 @@ import "code.tnxs.net/taxnexus/lib/api/devops/devops_models" // UserRoleChannelWrapper wraps the object with workflow params type UserRoleChannelWrapper struct { - Obj devops_models.UserRole - Principal User - SagaID string - SagaType string + Obj devops_models.UserRole + APIKey string + SagaID string + SagaType string } // UserRole is a first class object type diff --git a/rules/account.go b/rules/account.go index a731e03..4043d5d 100644 --- a/rules/account.go +++ b/rules/account.go @@ -4,6 +4,7 @@ import ( "code.tnxs.net/taxnexus/lib/api/crm/crm_client/accounts" "code.tnxs.net/taxnexus/lib/api/crm/crm_models" "code.tnxs.net/taxnexus/lib/app" + httptransport "github.com/go-openapi/runtime/client" "go.temporal.io/sdk/workflow" ) @@ -16,7 +17,13 @@ func StoreAccountActivity(ctx workflow.Context, w app.AccountChannelWrapper) err postAccountParams.AccountRequest = &crm_models.AccountRequest{ Data: []*crm_models.Account{&w.Obj}, } - _, err := crmClient.Accounts.PostAccounts(postAccountParams, w.Principal.Auth) + _, err := crmClient.Accounts.PostAccounts( + postAccountParams, + httptransport.APIKeyAuth( + "X-API-Key", + "header", + w.APIKey, + )) if err != nil { return err } diff --git a/rules/auth0.go b/rules/auth0.go index 0113829..ddf6eca 100644 --- a/rules/auth0.go +++ b/rules/auth0.go @@ -8,6 +8,7 @@ import ( "code.tnxs.net/taxnexus/lib/api/workflow/workflow_client/outgoing_email_message" "code.tnxs.net/taxnexus/lib/api/workflow/workflow_models" "code.tnxs.net/taxnexus/lib/app" + httptransport "github.com/go-openapi/runtime/client" "go.temporal.io/sdk/workflow" ) @@ -33,7 +34,12 @@ func StoreAuth0UserActivity(ctx workflow.Context, w app.UserChannelWrapper) erro putUserParams.UserRequest = &devops_models.UserRequest{ Data: []*devops_models.User{&putUser}, } - _, err = devopsClient.User.PutUsers(putUserParams, w.Principal.Auth) + _, err = devopsClient.User.PutUsers(putUserParams, + httptransport.APIKeyAuth( + "X-API-Key", + "header", + w.APIKey, + )) if err != nil { return err } @@ -52,7 +58,11 @@ func StoreAuth0UserActivity(ctx workflow.Context, w app.UserChannelWrapper) erro OutgoingEmailMessage. PostOutgoingEmailMessages( emailParams, - w.Principal.Auth, + httptransport.APIKeyAuth( + "X-API-Key", + "header", + w.APIKey, + ), ) if err != nil { return err diff --git a/rules/contact.go b/rules/contact.go index 82bab23..75b38e9 100644 --- a/rules/contact.go +++ b/rules/contact.go @@ -10,6 +10,7 @@ import ( "code.tnxs.net/taxnexus/lib/api/workflow/workflow_client/outgoing_email_message" "code.tnxs.net/taxnexus/lib/api/workflow/workflow_models" "code.tnxs.net/taxnexus/lib/app" + httptransport "github.com/go-openapi/runtime/client" "go.temporal.io/sdk/workflow" ) @@ -22,7 +23,12 @@ func StoreContactActivity(ctx workflow.Context, w app.ContactChannelWrapper) err postContactParams.ContactsRequest = &crm_models.ContactRequest{ Data: []*crm_models.Contact{&w.Obj}, } - _, err := crmClient.Contacts.PostContacts(postContactParams, w.Principal.Auth) + _, err := crmClient.Contacts.PostContacts(postContactParams, + httptransport.APIKeyAuth( + "X-API-Key", + "header", + w.APIKey, + )) if err != nil { return err } @@ -64,7 +70,12 @@ Alert! New Contact Inquiry from Taxnexus.io website. }, }, } - _, err = workflowClient.OutgoingEmailMessage.PostOutgoingEmailMessages(emailParams, w.Principal.Auth) + _, err = workflowClient.OutgoingEmailMessage.PostOutgoingEmailMessages(emailParams, + httptransport.APIKeyAuth( + "X-API-Key", + "header", + w.APIKey, + )) if err != nil { return err } diff --git a/rules/lead.go b/rules/lead.go index 4406048..2ab28f9 100644 --- a/rules/lead.go +++ b/rules/lead.go @@ -10,6 +10,7 @@ import ( "code.tnxs.net/taxnexus/lib/api/workflow/workflow_client/outgoing_email_message" "code.tnxs.net/taxnexus/lib/api/workflow/workflow_models" "code.tnxs.net/taxnexus/lib/app" + httptransport "github.com/go-openapi/runtime/client" "go.temporal.io/sdk/workflow" ) @@ -22,7 +23,12 @@ func StoreLeadActivity(ctx workflow.Context, w app.LeadChannelWrapper) error { / postLeadParams.LeadRequest = &crm_models.LeadRequest{ Data: []*crm_models.Lead{&w.Obj}, } - _, err := crmClient.Leads.PostLeads(postLeadParams, w.Principal.Auth) + _, err := crmClient.Leads.PostLeads(postLeadParams, + httptransport.APIKeyAuth( + "X-API-Key", + "header", + w.APIKey, + )) if err != nil { return err } @@ -64,7 +70,12 @@ Alert! New Lead Inquiry from Taxnexus.io website. }, }, } - _, err = workflowClient.OutgoingEmailMessage.PostOutgoingEmailMessages(emailParams, w.Principal.Auth) + _, err = workflowClient.OutgoingEmailMessage.PostOutgoingEmailMessages(emailParams, + httptransport.APIKeyAuth( + "X-API-Key", + "header", + w.APIKey, + )) if err != nil { return err } diff --git a/rules/new-developer.go b/rules/new-developer.go index b429bcd..477b4eb 100644 --- a/rules/new-developer.go +++ b/rules/new-developer.go @@ -30,10 +30,10 @@ func NewDeveloperWorkflow( err := workflow.ExecuteActivity(ctx, StoreContactActivity, &app.ContactChannelWrapper{ - Obj: payload.Contact, - Principal: payload.Principal, - SagaID: payload.SagaID, - SagaType: payload.SagaType, + Obj: payload.Contact, + APIKey: payload.Principal.APIKey, + SagaID: payload.SagaID, + SagaType: payload.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, - Principal: payload.Principal, - SagaID: payload.SagaID, - SagaType: payload.SagaType, + Obj: payload.Account, + APIKey: payload.Principal.APIKey, + SagaID: payload.SagaID, + SagaType: payload.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, - Principal: payload.Principal, - SagaID: payload.SagaID, - SagaType: payload.SagaType, + Obj: payload.PaymentMethod, + APIKey: payload.Principal.APIKey, + SagaID: payload.SagaID, + SagaType: payload.SagaType, }).Get(ctx, nil) if err != nil { return err @@ -63,10 +63,10 @@ func NewDeveloperWorkflow( err = workflow.ExecuteActivity(ctx, NotifyContactActivity, &app.ContactChannelWrapper{ - Obj: payload.Contact, - Principal: payload.Principal, - SagaID: payload.SagaID, - SagaType: payload.SagaType, + Obj: payload.Contact, + APIKey: payload.Principal.APIKey, + SagaID: payload.SagaID, + SagaType: payload.SagaType, }).Get(ctx, nil) if err != nil { return err diff --git a/rules/new-lead.go b/rules/new-lead.go index 9b07850..fac391b 100644 --- a/rules/new-lead.go +++ b/rules/new-lead.go @@ -29,8 +29,8 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, payload *NewLeadWrapper) err ctx, StoreLeadActivity, &app.LeadChannelWrapper{ - Obj: payload.Lead, - Principal: payload.Principal, + Obj: payload.Lead, + APIKey: payload.Principal.APIKey, }).Get(ctx, nil) if err != nil { return err @@ -40,8 +40,8 @@ func NewLeadWorkflow(ctx temporal_workflow.Context, payload *NewLeadWrapper) err ctx, NotifyLeadActivity, &app.LeadChannelWrapper{ - Obj: payload.Lead, - Principal: payload.Principal, + Obj: payload.Lead, + APIKey: payload.Principal.APIKey, }).Get(ctx, nil) if err != nil { return err diff --git a/rules/new-user.go b/rules/new-user.go index 200628b..b7e9fe6 100644 --- a/rules/new-user.go +++ b/rules/new-user.go @@ -26,10 +26,10 @@ func NewUserWorkflow(ctx workflow.Context, payload *NewUserChannelWrapper) error err := workflow.ExecuteActivity(ctx, StoreUserActivity, &app.UserChannelWrapper{ - Obj: payload.User, - Principal: payload.Principal, - SagaID: payload.SagaID, - SagaType: payload.SagaType, + Obj: payload.User, + APIKey: payload.Principal.APIKey, + SagaID: payload.SagaID, + SagaType: payload.SagaType, }).Get(ctx, nil) if err != nil { return err diff --git a/rules/paymentmethod.go b/rules/paymentmethod.go index 94f6de9..afe1b1c 100644 --- a/rules/paymentmethod.go +++ b/rules/paymentmethod.go @@ -4,6 +4,7 @@ import ( "code.tnxs.net/taxnexus/lib/api/ops/ops_client/payment_method" "code.tnxs.net/taxnexus/lib/api/ops/ops_models" "code.tnxs.net/taxnexus/lib/app" + httptransport "github.com/go-openapi/runtime/client" "go.temporal.io/sdk/workflow" ) @@ -16,7 +17,12 @@ func StorePaymentMethodActivity( postPaymentMethodParams.PaymentMethodRequest = &ops_models.PaymentMethodRequest{ Data: []*ops_models.PaymentMethod{&w.Obj}, } - _, err := opsClient.PaymentMethod.PostPaymentMethods(postPaymentMethodParams, w.Principal.Auth) + _, err := opsClient.PaymentMethod.PostPaymentMethods(postPaymentMethodParams, + httptransport.APIKeyAuth( + "X-API-Key", + "header", + w.APIKey, + )) if err != nil { return err } diff --git a/rules/user.go b/rules/user.go index c2c74a3..c8a118d 100644 --- a/rules/user.go +++ b/rules/user.go @@ -9,6 +9,7 @@ import ( "code.tnxs.net/taxnexus/lib/api/auth0/auth0_models" "code.tnxs.net/taxnexus/lib/api/devops/devops_client/user" "code.tnxs.net/taxnexus/lib/api/devops/devops_models" + httptransport "github.com/go-openapi/runtime/client" "code.tnxs.net/taxnexus/lib/api/workflow/workflow_client/outgoing_email_message" "code.tnxs.net/taxnexus/lib/api/workflow/workflow_models" @@ -25,7 +26,12 @@ func StoreUserActivity(ctx workflow.Context, w app.UserChannelWrapper) error { / postUserParams.UserRequest = &devops_models.UserRequest{ Data: []*devops_models.User{&w.Obj}, } - devopsResponse, err := devopsClient.User.PostUsers(postUserParams, w.Principal.Auth) + devopsResponse, err := devopsClient.User.PostUsers(postUserParams, + httptransport.APIKeyAuth( + "X-API-Key", + "header", + w.APIKey, + )) if err != nil { return err } @@ -63,7 +69,12 @@ func StoreUserActivity(ctx workflow.Context, w app.UserChannelWrapper) error { / putUserParams.UserRequest = &devops_models.UserRequest{ Data: []*devops_models.User{newUser}, } - _, err = devopsClient.User.PutUsers(putUserParams, w.Principal.Auth) + _, err = devopsClient.User.PutUsers(putUserParams, + httptransport.APIKeyAuth( + "X-API-Key", + "header", + w.APIKey, + )) if err != nil { return err } @@ -108,7 +119,12 @@ Alert! New User Inquiry from Taxnexus.io website. }, }, } - _, err = workflowClient.OutgoingEmailMessage.PostOutgoingEmailMessages(emailParams, w.Principal.Auth) + _, err = workflowClient.OutgoingEmailMessage.PostOutgoingEmailMessages(emailParams, + httptransport.APIKeyAuth( + "X-API-Key", + "header", + w.APIKey, + )) if err != nil { return err }