Skip to content

Commit

Permalink
fix: add credential_type to credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
artaasadi committed Nov 13, 2024
1 parent 64d387b commit 2fd2d70
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions services/integration/api/integrations/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down
1 change: 1 addition & 0 deletions services/integration/api/models/credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
1 change: 1 addition & 0 deletions services/integration/api/models/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
2 changes: 2 additions & 0 deletions services/integration/models/credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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,
Expand Down

0 comments on commit 2fd2d70

Please sign in to comment.