|  |  | @ -805,7 +805,19 @@ const getLocationsByCityAndZone = async (city, zone) => { | 
			
		
	
		
		
			
				
					
					|  |  |  |     ]); |  |  |  |     ]); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     console.log("Query Result:", result); // Debugging output
 |  |  |  |     console.log("Query Result:", result); // Debugging output
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     return result.length ? result[0] : null; // Return a single object instead of an array
 |  |  |  | 
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (result.length) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       let locations = [...new Set(result[0].locations)]; // Remove duplicates
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       // If zone is "ALL", include "ALL" in the locations list
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       if (zone.trim().toUpperCase() === "ALL") { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         locations.unshift("ALL"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       return { city, locations }; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       return { city, locations: zone.trim().toUpperCase() === "ALL" ? ["ALL"] : [] }; // Return empty if no data
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |   } catch (err) { |  |  |  |   } catch (err) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     console.error(err); |  |  |  |     console.error(err); | 
			
		
	
		
		
			
				
					
					|  |  |  |     throw new Error("Error fetching locations."); |  |  |  |     throw new Error("Error fetching locations."); | 
			
		
	
	
		
		
			
				
					|  |  | @ -834,6 +846,7 @@ exports.getZonebasedLocations = async (req, reply) => { | 
			
		
	
		
		
			
				
					
					|  |  |  | }; |  |  |  | }; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  const getLocationsByZone = async (zone) => { |  |  |  |  const getLocationsByZone = async (zone) => { | 
			
		
	
		
		
			
				
					
					|  |  |  |   try { |  |  |  |   try { | 
			
		
	
		
		
			
				
					
					|  |  |  |     const result = await City.aggregate([ |  |  |  |     const result = await City.aggregate([ | 
			
		
	
	
		
		
			
				
					|  |  | 
 |