rimashah25 commented on code in PR #7079:
URL: https://github.com/apache/trafficcontrol/pull/7079#discussion_r983763105


##########
traffic_ops/traffic_ops_golang/server/servers_server_capability.go:
##########
@@ -527,3 +527,70 @@ func AssignMultipleServerCapabilities(w 
http.ResponseWriter, r *http.Request) {
        api.WriteAlertsObj(w, r, http.StatusOK, alerts, msc)
        return
 }
+
+// AssignMultipleServersToCapability helps assign multiple servers to a given 
capability.
+func AssignMultipleServersToCapability(w http.ResponseWriter, r *http.Request) 
{
+       inf, userErr, sysErr, errCode := api.NewInfo(r, nil, nil)
+       tx := inf.Tx.Tx
+       if userErr != nil || sysErr != nil {
+               api.HandleErr(w, r, inf.Tx.Tx, errCode, userErr, sysErr)
+               return
+       }
+       defer inf.Close()
+
+       var mspc tc.MultipleServersToCapability
+       if err := json.NewDecoder(r.Body).Decode(&mspc); err != nil {
+               api.HandleErr(w, r, tx, http.StatusBadRequest, err, nil)
+               return
+       }
+
+       //loop through server list to check if the type is MID and/or EDGE
+       for _, sid := range mspc.ServersIDs {
+               correctType := true
+               if err := tx.QueryRow(scCheckServerTypeQuery(), 
sid).Scan(&correctType); err != nil {

Review Comment:
   I figured it out.



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to