Commit ea52f739 authored by Ikram Haq's avatar Ikram Haq
Browse files

Fix cardinality check on LocationEventCriteria data model

parent abff4d3f
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -3390,6 +3390,11 @@ func areaSubPUT(w http.ResponseWriter, r *http.Request) {
		return
	}
	// Check if EnteringLeavingCriteria values are valid
	if len(areaCircleSub.LocationEventCriteria) == 0 && areaCircleSub.LocationEventCriteria == nil {
		locationEventType := []LocationEventType{"ENTERING_AREA_EVENT", "LEAVING_AREA_EVENT"}
		//locationEventType := {ENTERING_AREA_EVENT, LEAVING_AREA_EVENT}
		areaCircleSub.LocationEventCriteria = locationEventType
	} else {
		for _, criteria := range areaCircleSub.LocationEventCriteria {
			if criteria != ENTERING_AREA_EVENT && criteria != LEAVING_AREA_EVENT {
				log.Error("Invalid EnteringLeavingCriteria parameter value")
@@ -3397,6 +3402,8 @@ func areaSubPUT(w http.ResponseWriter, r *http.Request) {
				return
			}
		}
	}
	
	if areaCircleSub.TrackingAccuracy == 0 {
		log.Error("Mandatory TrackingAccuracy parameter not present")
		errHandlerProblemDetails(w, "Mandatory TrackingAccuracy parameter not present", http.StatusBadRequest)