Main services - IvanAlvarezEnri/dragon-squad-api GitHub Wiki

We separated all the logic from endpoints into services.

  • LocationSearcher
      def self.find_place(location)
        # Predictable location search logic, returns the first 5 results
      end
    
      def self.reverse_geocode(lat, lng)
        # Returns the adress name of the bounds
      end
    
  • RoomSearcher
      def self.search_rooms_by_coordinates(lat, lng, range = 1000)
        # Find all the rooms nerby the bounds using a range
      end
    
      def self.sort_results(rooms, params)
        # Sort that rooms list with diferent optional params
      end
    
      def pagination(rooms, params)
        # Pagination logic to load a few rooms per page
      end