rawlinp commented on a change in pull request #5350:
URL: https://github.com/apache/trafficcontrol/pull/5350#discussion_r544438949



##########
File path: traffic_ops/traffic_ops_golang/dbhelpers/db_helpers.go
##########
@@ -1150,3 +1151,52 @@ func CheckOriginServerInCacheGroupTopology(tx *sql.Tx, 
dsID int, dsTopology stri
        }
        return nil, nil, http.StatusOK
 }
+
+// CheckTopologyOrgServerCGInDSCG checks if ORG server are part of DS. IF they 
are then the user is not allowed to remove the ORG servers from the associated 
DS's topology
+func CheckTopologyOrgServerCGInDSCG(tx *sql.Tx, cdnIds []int, dsTopology 
string, topologyCGNames []string) (error, error, int) {
+       // get servers and respective cachegroup name that have ORG type for 
evert delivery service
+       q := `
+               SELECT ARRAY_AGG(d.xml_id), s.id, c.name
+               FROM server s
+                       INNER JOIN deliveryservice_server ds ON ds.server = s.id
+                       INNER JOIN deliveryservice d ON d.id = 
ds.deliveryservice
+                       INNER JOIN type t ON t.id = s.type
+                       INNER JOIN cachegroup c ON c.id = s.cachegroup
+               WHERE d.cdn_id =ANY($1) AND t.name=$2 AND topology=$3
+               GROUP BY s.id, c.name
+       `
+       serverId := ""
+       cacheGroupName := ""
+       dsNames := []string{}
+       serversCG := make(map[string]string)
+       serversDS := make(map[string]interface{})

Review comment:
       Does `[]string` not work? Generally `interface{}` should only be used 
where necessary.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to