diff --git a/db/Store.go b/db/Store.go index 662afd7e..ca85f59e 100644 --- a/db/Store.go +++ b/db/Store.go @@ -54,6 +54,8 @@ type ObjectReferrers struct { Templates []ObjectReferrer `json:"templates"` Inventories []ObjectReferrer `json:"inventories"` Repositories []ObjectReferrer `json:"repositories"` + Integrations []ObjectReferrer `json:"integrations"` + Schedules []ObjectReferrer `json:"schedules"` } type IntegrationReferrers struct { diff --git a/db/bolt/BoltDb.go b/db/bolt/BoltDb.go index 2d8c8b97..5040d5aa 100644 --- a/db/bolt/BoltDb.go +++ b/db/bolt/BoltDb.go @@ -4,14 +4,15 @@ import ( "bytes" "encoding/json" "fmt" - "github.com/semaphoreui/semaphore/db" - "github.com/semaphoreui/semaphore/util" - "go.etcd.io/bbolt" "reflect" "sort" "strings" "sync" "time" + + "github.com/semaphoreui/semaphore/db" + "github.com/semaphoreui/semaphore/util" + "go.etcd.io/bbolt" ) const MaxID = 2147483647 @@ -689,20 +690,25 @@ func (d *BoltDb) getObjectRefs(projectID int, objectProps db.ObjectProps, object return } - templates, err := d.getObjectRefsFrom(projectID, objectProps, intObjectID(objectID), db.ScheduleProps) + // templates, err := d.getObjectRefsFrom(projectID, objectProps, intObjectID(objectID), db.ScheduleProps) - for _, st := range templates { - exists := false - for _, tpl := range refs.Templates { - if tpl.ID == st.ID { - exists = true - break - } - } - if exists { - continue - } - refs.Templates = append(refs.Templates, st) + // for _, st := range templates { + // exists := false + // for _, tpl := range refs.Templates { + // if tpl.ID == st.ID { + // exists = true + // break + // } + // } + // if exists { + // continue + // } + // refs.Templates = append(refs.Templates, st) + // } + + refs.Integrations, err = d.getObjectRefsFrom(projectID, objectProps, intObjectID(objectID), db.IntegrationProps) + if err != nil { + return } return