diff --git a/.dredd/hooks/capabilities.go b/.dredd/hooks/capabilities.go index 5a0918e7..07a2d6ca 100644 --- a/.dredd/hooks/capabilities.go +++ b/.dredd/hooks/capabilities.go @@ -29,7 +29,6 @@ var inventoryID int var environmentID int var templateID int var integrationID int -var integrationExtractorID int var integrationExtractValueID int var integrationMatchID int diff --git a/.dredd/hooks/helpers.go b/.dredd/hooks/helpers.go index b1d37083..9571d6d3 100644 --- a/.dredd/hooks/helpers.go +++ b/.dredd/hooks/helpers.go @@ -245,7 +245,7 @@ func addIntegration() *db.Integration { func addIntegrationExtractValue() *db.IntegrationExtractValue { integrationextractvalue, err := store.CreateIntegrationExtractValue(userProject.ID, db.IntegrationExtractValue{ Name: "Value", - IntegrationID: integrationExtractorID, + IntegrationID: integrationID, ValueSource: db.IntegrationExtractBodyValue, BodyDataType: db.IntegrationBodyDataJSON, Key: "key", @@ -262,7 +262,7 @@ func addIntegrationExtractValue() *db.IntegrationExtractValue { func addIntegrationMatcher() *db.IntegrationMatcher { integrationmatch, err := store.CreateIntegrationMatcher(userProject.ID, db.IntegrationMatcher{ Name: "matcher", - IntegrationID: integrationExtractorID, + IntegrationID: integrationID, MatchType: "body", Method: "equals", BodyDataType: "json", diff --git a/db/Event.go b/db/Event.go index 248aa0ff..e4914458 100644 --- a/db/Event.go +++ b/db/Event.go @@ -35,7 +35,6 @@ const ( EventUser EventObjectType = "user" EventView EventObjectType = "view" EventIntegration EventObjectType = "integration" - EventIntegrationExtractor EventObjectType = "integrationextractor" EventIntegrationExtractValue EventObjectType = "integrationextractvalue" EventIntegrationMatcher EventObjectType = "integrationmatcher" ) diff --git a/db/bolt/BoltDb.go b/db/bolt/BoltDb.go index 8303dfde..91690b21 100644 --- a/db/bolt/BoltDb.go +++ b/db/bolt/BoltDb.go @@ -554,8 +554,8 @@ func (d *BoltDb) getIntegrationRefs(projectID int, objectProps db.ObjectProps, o return } -func (d *BoltDb) getIntegrationExtractorChildrenRefs(extractorID int, objectProps db.ObjectProps, objectID int) (refs db.IntegrationExtractorChildReferrers, err error) { - //refs.IntegrationExtractors, err = d.getReferringObjectByParentID(objectID, objectProps, extractorID, db.IntegrationExtractorProps) +func (d *BoltDb) getIntegrationExtractorChildrenRefs(integrationID int, objectProps db.ObjectProps, objectID int) (refs db.IntegrationExtractorChildReferrers, err error) { + //refs.IntegrationExtractors, err = d.getReferringObjectByParentID(objectID, objectProps, integrationID, db.IntegrationExtractorProps) //if err != nil { // return //} diff --git a/db/bolt/webhook.go b/db/bolt/webhook.go index 7b067fdb..c6f56b60 100644 --- a/db/bolt/webhook.go +++ b/db/bolt/webhook.go @@ -55,17 +55,17 @@ Integration Extractors /* Integration ExtractValue */ -func (d *BoltDb) GetIntegrationExtractValuesByExtractorID(extractorID int) (values []db.IntegrationExtractValue, err error) { - err = d.getObjects(extractorID, db.IntegrationExtractValueProps, db.RetrieveQueryParams{}, nil, &values) +func (d *BoltDb) GetIntegrationExtractValuesByExtractorID(integrationID int) (values []db.IntegrationExtractValue, err error) { + err = d.getObjects(integrationID, db.IntegrationExtractValueProps, db.RetrieveQueryParams{}, nil, &values) return values, err } -func (d *BoltDb) DeleteIntegrationExtractValue(projectID int, valueID int, extractorID int) error { +func (d *BoltDb) DeleteIntegrationExtractValue(projectID int, valueID int, integrationID int) error { return d.deleteObject(projectID, db.IntegrationExtractValueProps, intObjectID(valueID), nil) } -func (d *BoltDb) GetIntegrationMatchersByExtractorID(extractorID int) (matchers []db.IntegrationMatcher, err error) { - err = d.getObjects(extractorID, db.IntegrationMatcherProps, db.RetrieveQueryParams{}, nil, &matchers) +func (d *BoltDb) GetIntegrationMatchersByExtractorID(integrationID int) (matchers []db.IntegrationMatcher, err error) { + err = d.getObjects(integrationID, db.IntegrationMatcherProps, db.RetrieveQueryParams{}, nil, &matchers) return matchers, err } @@ -82,7 +82,7 @@ func (d *BoltDb) CreateIntegrationExtractValue(projectId int, value db.Integrati } -func (d *BoltDb) GetIntegrationExtractValues(projectID int, params db.RetrieveQueryParams, extractorID int) (values []db.IntegrationExtractValue, err error) { +func (d *BoltDb) GetIntegrationExtractValues(projectID int, params db.RetrieveQueryParams, integrationID int) (values []db.IntegrationExtractValue, err error) { values = make([]db.IntegrationExtractValue, 0) var allValues []db.IntegrationExtractValue @@ -93,7 +93,7 @@ func (d *BoltDb) GetIntegrationExtractValues(projectID int, params db.RetrieveQu } for _, v := range allValues { - if v.IntegrationID == extractorID { + if v.IntegrationID == integrationID { values = append(values, v) } } @@ -101,7 +101,7 @@ func (d *BoltDb) GetIntegrationExtractValues(projectID int, params db.RetrieveQu return } -func (d *BoltDb) GetIntegrationExtractValue(projectID int, valueID int, extractorID int) (value db.IntegrationExtractValue, err error) { +func (d *BoltDb) GetIntegrationExtractValue(projectID int, valueID int, integrationID int) (value db.IntegrationExtractValue, err error) { err = d.getObject(projectID, db.IntegrationExtractValueProps, intObjectID(valueID), &value) return value, err } @@ -116,7 +116,7 @@ func (d *BoltDb) UpdateIntegrationExtractValue(projectID int, integrationExtract return d.updateObject(projectID, db.IntegrationExtractValueProps, integrationExtractValue) } -func (d *BoltDb) GetIntegrationExtractValueRefs(projectID int, valueID int, extractorID int) (db.IntegrationExtractorChildReferrers, error) { +func (d *BoltDb) GetIntegrationExtractValueRefs(projectID int, valueID int, integrationID int) (db.IntegrationExtractorChildReferrers, error) { return d.getIntegrationExtractorChildrenRefs(projectID, db.IntegrationExtractValueProps, valueID) } @@ -133,7 +133,7 @@ func (d *BoltDb) CreateIntegrationMatcher(projectID int, matcher db.IntegrationM return newMatcher.(db.IntegrationMatcher), err } -func (d *BoltDb) GetIntegrationMatchers(projectID int, params db.RetrieveQueryParams, extractorID int) (matchers []db.IntegrationMatcher, err error) { +func (d *BoltDb) GetIntegrationMatchers(projectID int, params db.RetrieveQueryParams, integrationID int) (matchers []db.IntegrationMatcher, err error) { matchers = make([]db.IntegrationMatcher, 0) var allMatchers []db.IntegrationMatcher @@ -144,7 +144,7 @@ func (d *BoltDb) GetIntegrationMatchers(projectID int, params db.RetrieveQueryPa } for _, v := range allMatchers { - if v.IntegrationID == extractorID { + if v.IntegrationID == integrationID { matchers = append(matchers, v) } } @@ -152,9 +152,9 @@ func (d *BoltDb) GetIntegrationMatchers(projectID int, params db.RetrieveQueryPa return } -func (d *BoltDb) GetIntegrationMatcher(projectID int, matcherID int, extractorID int) (matcher db.IntegrationMatcher, err error) { +func (d *BoltDb) GetIntegrationMatcher(projectID int, matcherID int, integrationID int) (matcher db.IntegrationMatcher, err error) { var matchers []db.IntegrationMatcher - matchers, err = d.GetIntegrationMatchers(projectID, db.RetrieveQueryParams{}, extractorID) + matchers, err = d.GetIntegrationMatchers(projectID, db.RetrieveQueryParams{}, integrationID) for _, v := range matchers { if v.ID == matcherID { @@ -175,23 +175,23 @@ func (d *BoltDb) UpdateIntegrationMatcher(projectID int, integrationMatcher db.I return d.updateObject(projectID, db.IntegrationMatcherProps, integrationMatcher) } -func (d *BoltDb) DeleteIntegrationMatcher(projectID int, matcherID int, extractorID int) error { +func (d *BoltDb) DeleteIntegrationMatcher(projectID int, matcherID int, integrationID int) error { return d.deleteObject(projectID, db.IntegrationMatcherProps, intObjectID(matcherID), nil) } func (d *BoltDb) DeleteIntegration(projectID int, integrationID int) error { - extractors, err := d.GetIntegrationMatchers(projectID, db.RetrieveQueryParams{}, integrationID) + matchers, err := d.GetIntegrationMatchers(projectID, db.RetrieveQueryParams{}, integrationID) if err != nil { return err } - for extractor := range extractors { - d.DeleteIntegrationMatcher(projectID, extractors[extractor].ID, integrationID) + for m := range matchers { + d.DeleteIntegrationMatcher(projectID, matchers[m].ID, integrationID) } return d.deleteObject(projectID, db.IntegrationProps, intObjectID(integrationID), nil) } -func (d *BoltDb) GetIntegrationMatcherRefs(projectID int, matcherID int, extractorID int) (db.IntegrationExtractorChildReferrers, error) { +func (d *BoltDb) GetIntegrationMatcherRefs(projectID int, matcherID int, integrationID int) (db.IntegrationExtractorChildReferrers, error) { return d.getIntegrationExtractorChildrenRefs(projectID, db.IntegrationMatcherProps, matcherID) } diff --git a/db/sql/SqlDb.go b/db/sql/SqlDb.go index 507a14ac..15276434 100644 --- a/db/sql/SqlDb.go +++ b/db/sql/SqlDb.go @@ -733,7 +733,7 @@ func (d *SqlDb) GetReferencesForForeignKey(objectProps db.ObjectProps, objectID // Find Object Referrers for objectID based on referring column taken from referringObjectProps // Example: -// GetObjectReferences(db.WebhookMatchers, db.WebhookExtractorProps, extractorID) +// GetObjectReferences(db.WebhookMatchers, db.WebhookExtractorProps, integrationID) func (d *SqlDb) GetObjectReferences(objectProps db.ObjectProps, referringObjectProps db.ObjectProps, objectID int) (referringObjs []db.ObjectReferrer, err error) { referringObjs = make([]db.ObjectReferrer, 0) diff --git a/db/sql/integration.go b/db/sql/integration.go index dd436357..a6b6eeff 100644 --- a/db/sql/integration.go +++ b/db/sql/integration.go @@ -92,11 +92,11 @@ func (d *SqlDb) UpdateIntegration(integration db.Integration) error { return err } -func (d *SqlDb) GetIntegrationExtractValuesByExtractorID(extractorID int) (values []db.IntegrationExtractValue, err error) { +func (d *SqlDb) GetIntegrationExtractValuesByExtractorID(integrationID int) (values []db.IntegrationExtractValue, err error) { var sqlError error query, args, sqlError := squirrel.Select("v.*"). From("project__integration_extract_value as v"). - Where(squirrel.Eq{"integration_id": extractorID}). + Where(squirrel.Eq{"integration_id": integrationID}). OrderBy("v.id"). ToSql() @@ -109,11 +109,11 @@ func (d *SqlDb) GetIntegrationExtractValuesByExtractorID(extractorID int) (value return values, err } -func (d *SqlDb) GetIntegrationMatchersByExtractorID(extractorID int) (matchers []db.IntegrationMatcher, err error) { +func (d *SqlDb) GetIntegrationMatchersByExtractorID(integrationID int) (matchers []db.IntegrationMatcher, err error) { var sqlError error query, args, sqlError := squirrel.Select("m.*"). From("project__integration_matcher as m"). - Where(squirrel.Eq{"integration_id": extractorID}). + Where(squirrel.Eq{"integration_id": integrationID}). OrderBy("m.id"). ToSql() @@ -126,36 +126,36 @@ func (d *SqlDb) GetIntegrationMatchersByExtractorID(extractorID int) (matchers [ return matchers, err } -//func (d *SqlDb) DeleteIntegrationExtractor(projectID int, extractorID int, integrationID int) error { -// values, err := d.GetIntegrationExtractValuesByExtractorID(extractorID) +//func (d *SqlDb) DeleteIntegrationExtractor(projectID int, integrationID int, integrationID int) error { +// values, err := d.GetIntegrationExtractValuesByExtractorID(integrationID) // if err != nil && !strings.Contains(err.Error(), "no rows in result set") { // return err // } // // for value := range values { // -// err = d.DeleteIntegrationExtractValue(0, values[value].ID, extractorID) +// err = d.DeleteIntegrationExtractValue(0, values[value].ID, integrationID) // if err != nil && !strings.Contains(err.Error(), "no rows in result set") { // log.Error(err) // return err // } // } // -// matchers, errExtractor := d.GetIntegrationMatchersByExtractorID(extractorID) +// matchers, errExtractor := d.GetIntegrationMatchersByExtractorID(integrationID) // if errExtractor != nil && !strings.Contains(errExtractor.Error(), "no rows in result set") { // log.Error(errExtractor) // return errExtractor // } // // for matcher := range matchers { -// err = d.DeleteIntegrationMatcher(0, matchers[matcher].ID, extractorID) +// err = d.DeleteIntegrationMatcher(0, matchers[matcher].ID, integrationID) // if err != nil && !strings.Contains(err.Error(), "no rows in result set") { // log.Error(err) // return err // } // } // -// return d.deleteObjectByReferencedID(integrationID, db.IntegrationProps, db.IntegrationExtractorProps, extractorID) +// return d.deleteObjectByReferencedID(integrationID, db.IntegrationProps, db.IntegrationExtractorProps, integrationID) //} // //func (d *SqlDb) UpdateIntegrationExtractor(projectID int, integrationExtractor db.IntegrationExtractor) error { @@ -201,9 +201,9 @@ func (d *SqlDb) CreateIntegrationExtractValue(projectId int, value db.Integratio return } -func (d *SqlDb) GetIntegrationExtractValues(projectID int, params db.RetrieveQueryParams, extractorID int) ([]db.IntegrationExtractValue, error) { +func (d *SqlDb) GetIntegrationExtractValues(projectID int, params db.RetrieveQueryParams, integrationID int) ([]db.IntegrationExtractValue, error) { var values []db.IntegrationExtractValue - err := d.getObjectsByReferrer(extractorID, db.IntegrationProps, db.IntegrationExtractValueProps, params, &values) + err := d.getObjectsByReferrer(integrationID, db.IntegrationProps, db.IntegrationExtractValueProps, params, &values) return values, err } @@ -214,7 +214,7 @@ func (d *SqlDb) GetAllIntegrationExtractValues() (values []db.IntegrationExtract return } -func (d *SqlDb) GetIntegrationExtractValue(projectID int, valueID int, extractorID int) (value db.IntegrationExtractValue, err error) { +func (d *SqlDb) GetIntegrationExtractValue(projectID int, valueID int, integrationID int) (value db.IntegrationExtractValue, err error) { query, args, err := squirrel.Select("v.*"). From("project__integration_extract_value as v"). Where(squirrel.Eq{"id": valueID}). @@ -230,13 +230,13 @@ func (d *SqlDb) GetIntegrationExtractValue(projectID int, valueID int, extractor return value, err } -func (d *SqlDb) GetIntegrationExtractValueRefs(projectID int, valueID int, extractorID int) (refs db.IntegrationExtractorChildReferrers, err error) { - refs.Integrations, err = d.GetObjectReferences(db.IntegrationProps, db.IntegrationExtractValueProps, extractorID) +func (d *SqlDb) GetIntegrationExtractValueRefs(projectID int, valueID int, integrationID int) (refs db.IntegrationExtractorChildReferrers, err error) { + refs.Integrations, err = d.GetObjectReferences(db.IntegrationProps, db.IntegrationExtractValueProps, integrationID) return } -func (d *SqlDb) DeleteIntegrationExtractValue(projectID int, valueID int, extractorID int) error { - return d.deleteObjectByReferencedID(extractorID, db.IntegrationProps, db.IntegrationExtractValueProps, valueID) +func (d *SqlDb) DeleteIntegrationExtractValue(projectID int, valueID int, integrationID int) error { + return d.deleteObjectByReferencedID(integrationID, db.IntegrationProps, db.IntegrationExtractValueProps, valueID) } func (d *SqlDb) UpdateIntegrationExtractValue(projectID int, integrationExtractValue db.IntegrationExtractValue) error { @@ -288,10 +288,10 @@ func (d *SqlDb) CreateIntegrationMatcher(projectID int, matcher db.IntegrationMa return } -func (d *SqlDb) GetIntegrationMatchers(projectID int, params db.RetrieveQueryParams, extractorID int) (matchers []db.IntegrationMatcher, err error) { +func (d *SqlDb) GetIntegrationMatchers(projectID int, params db.RetrieveQueryParams, integrationID int) (matchers []db.IntegrationMatcher, err error) { query, args, err := squirrel.Select("m.*"). From("project__integration_matcher as m"). - Where(squirrel.Eq{"integration_id": extractorID}). + Where(squirrel.Eq{"integration_id": integrationID}). OrderBy("m.id"). ToSql() @@ -312,7 +312,7 @@ func (d *SqlDb) GetAllIntegrationMatchers() (matchers []db.IntegrationMatcher, e return } -func (d *SqlDb) GetIntegrationMatcher(projectID int, matcherID int, extractorID int) (matcher db.IntegrationMatcher, err error) { +func (d *SqlDb) GetIntegrationMatcher(projectID int, matcherID int, integrationID int) (matcher db.IntegrationMatcher, err error) { query, args, err := squirrel.Select("m.*"). From("project__integration_matcher as m"). Where(squirrel.Eq{"id": matcherID}). @@ -328,14 +328,14 @@ func (d *SqlDb) GetIntegrationMatcher(projectID int, matcherID int, extractorID return matcher, err } -func (d *SqlDb) GetIntegrationMatcherRefs(projectID int, matcherID int, extractorID int) (refs db.IntegrationExtractorChildReferrers, err error) { +func (d *SqlDb) GetIntegrationMatcherRefs(projectID int, matcherID int, integrationID int) (refs db.IntegrationExtractorChildReferrers, err error) { refs.Integrations, err = d.GetObjectReferences(db.IntegrationProps, db.IntegrationMatcherProps, matcherID) return } -func (d *SqlDb) DeleteIntegrationMatcher(projectID int, matcherID int, extractorID int) error { - return d.deleteObjectByReferencedID(extractorID, db.IntegrationProps, db.IntegrationMatcherProps, matcherID) +func (d *SqlDb) DeleteIntegrationMatcher(projectID int, matcherID int, integrationID int) error { + return d.deleteObjectByReferencedID(integrationID, db.IntegrationProps, db.IntegrationMatcherProps, matcherID) } func (d *SqlDb) UpdateIntegrationMatcher(projectID int, integrationMatcher db.IntegrationMatcher) error { diff --git a/web/src/views/project/IntegrationExtractorCrumb.vue b/web/src/views/project/IntegrationExtractorCrumb.vue index 85d7d83f..1b8ba340 100644 --- a/web/src/views/project/IntegrationExtractorCrumb.vue +++ b/web/src/views/project/IntegrationExtractorCrumb.vue @@ -1,5 +1,5 @@