Commit 2cac76d9 authored by Mubeena Ishaq's avatar Mubeena Ishaq
Browse files

fix logic of individual subscription PUT method in meep-vis

parent 3887c4b2
Loading
Loading
Loading
Loading
+12 −12
Original line number Original line Diff line number Diff line
@@ -1301,6 +1301,18 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) {
		return
		return
	}
	}


	if subscriptionCommon.CallbackReference == "" && subscriptionCommon.WebsockNotifConfig.WebsocketUri == "" {
		log.Error("At least one of callbackReference and websockNotifConfig parameters should be present")
		errHandlerProblemDetails(w, "At least one of callbackReference and websockNotifConfig parameters should be present.", http.StatusBadRequest)
		return
	}

	if subscriptionCommon.FilterCriteria == nil {
		log.Error("Mandatory attribute FilterCriteria is missing for this subscription type")
		errHandlerProblemDetails(w, "Mandatory attribute FilterCriteria is missing for this subscription type", http.StatusBadRequest)
		return
	}

	link := subscriptionCommon.Links
	link := subscriptionCommon.Links
	if link == nil || link.Self == nil {
	if link == nil || link.Self == nil {
		log.Error("Mandatory Link parameter not present")
		log.Error("Mandatory Link parameter not present")
@@ -1330,18 +1342,6 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) {
			return
			return
		}
		}


		if subscription.CallbackReference == "" && subscription.WebsockNotifConfig.WebsocketUri == "" {
			log.Error("At least one of callbackReference and websockNotifConfig parameters should be present")
			errHandlerProblemDetails(w, "At least one of callbackReference and websockNotifConfig parameters should be present.", http.StatusBadRequest)
			return
		}

		if subscription.FilterCriteria == nil {
			log.Error("Mandatory attribute FilterCriteria is missing for this subscription type")
			errHandlerProblemDetails(w, "Mandatory attribute FilterCriteria is missing for this subscription type", http.StatusBadRequest)
			return
		}

		if subscription.FilterCriteria.StdOrganization == "" {
		if subscription.FilterCriteria.StdOrganization == "" {
			log.Error("Mandatory StdOrganization parameter should be present")
			log.Error("Mandatory StdOrganization parameter should be present")
			errHandlerProblemDetails(w, "Mandatory attribute StdOrganization is missing in the request body.", http.StatusBadRequest)
			errHandlerProblemDetails(w, "Mandatory attribute StdOrganization is missing in the request body.", http.StatusBadRequest)