From 2fd2d7012bca8789c5abe6f6e29c55e321d558ab Mon Sep 17 00:00:00 2001 From: artaasadi Date: Thu, 14 Nov 2024 00:10:11 +0100 Subject: [PATCH] fix: add credential_type to credentials --- services/integration/api/integrations/api.go | 1 + services/integration/api/models/credential.go | 1 + services/integration/api/models/integration.go | 1 + services/integration/models/credential.go | 2 ++ 4 files changed, 5 insertions(+) diff --git a/services/integration/api/integrations/api.go b/services/integration/api/integrations/api.go index 689ca57c0..d0fdee2df 100644 --- a/services/integration/api/integrations/api.go +++ b/services/integration/api/integrations/api.go @@ -179,6 +179,7 @@ func (h API) DiscoverIntegrations(c echo.Context) error { err = h.database.CreateCredential(&models2.Credential{ ID: credentialID, IntegrationType: req.IntegrationType, + CredentialType: req.CredentialType, Secret: secret, Metadata: credentialMetadataJsonb, }) diff --git a/services/integration/api/models/credential.go b/services/integration/api/models/credential.go index b08264b63..6798c1dff 100644 --- a/services/integration/api/models/credential.go +++ b/services/integration/api/models/credential.go @@ -9,6 +9,7 @@ type Credential struct { ID string `json:"id"` Secret string `json:"secret"` IntegrationType integration.Type `json:"integration_type"` + CredentialType string `json:"credential_type"` Metadata map[string]string `json:"metadata"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` diff --git a/services/integration/api/models/integration.go b/services/integration/api/models/integration.go index 8f880ba33..ec7803c10 100644 --- a/services/integration/api/models/integration.go +++ b/services/integration/api/models/integration.go @@ -15,6 +15,7 @@ const ( type DiscoverIntegrationRequest struct { IntegrationType integration.Type `json:"integration_type"` + CredentialType string `json:"credential_type"` CredentialID *string `json:"credential_id"` Credentials map[string]any `json:"credentials"` } diff --git a/services/integration/models/credential.go b/services/integration/models/credential.go index 4dec4a6e1..9864f0115 100644 --- a/services/integration/models/credential.go +++ b/services/integration/models/credential.go @@ -14,6 +14,7 @@ import ( type Credential struct { ID uuid.UUID `gorm:"primaryKey;type:uuid;default:uuid_generate_v4()"` IntegrationType integration.Type + CredentialType string Secret string Metadata pgtype.JSONB @@ -33,6 +34,7 @@ func (c *Credential) ToApi(returnSecret bool) (*models.Credential, error) { credential := &models.Credential{ ID: c.ID.String(), IntegrationType: c.IntegrationType, + CredentialType: c.CredentialType, Metadata: metadata, CreatedAt: c.CreatedAt, UpdatedAt: c.UpdatedAt,