Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/controllers/api/v1/cities_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Api
module V1
class CitiesController < ApplicationController

def index
cities = Establishment.select(:city).distinct.where.not(city: nil).pluck(:city)
render json: cities.map { |city| { city_name: city } }
end

end
end
end
2 changes: 1 addition & 1 deletion app/models/review.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Review < ApplicationRecord
belongs_to :patient_profile
belongs_to :doctor_profile
end
end
2 changes: 1 addition & 1 deletion config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
LspezHxBXYYDjpJT6leazJwF4EBpyRhnCx7dMpAFB1/Zs/gxpLSkWJLwUXqix1VSfvGf0MQ2mdlhlSpL/eawUhSaB08jEcnk1QZVb8FrOXhdL/0YzxAxSwkOfaVQUh+cbFjPWnLkjCVVzb1rJ7U8hJ1F127ELhAz7z0vdpV07aNyc3QEjujZSL412DGe0mJDttEqMvv7OKXEkLtmlZX3/LDtM8W8M/6BjJmTFHUs/2TuarmFv9InJTtVamgI1Owhp52suRDKNw7BAInBbcCZheC0vKvptUCfxUFd2a2yWqD5W3RATzKmy5v03O8vLRCmzbq8fiq87K2bYQVnw0DLja80TDt/U5Q4lLVvMUnVBRpqeW+hZKSlI2R4aVZysPBIdttsetWvwBfGtVKrHN29w/d+9lfq--qC55RquQklVlF31K--DbXL0CO115WRkLbEhR5tSQ==
Zl4B34n6udhcvb6gaFCQS3ZHG7dShpog/OROmcAtpMzDhpMko/+z4qNsFMLjTHEzDgBKXbSGqY+ZZszMO51OYU9DM4gFcECsB9McwNwMJ5g7q4rCK6Afp5DkMO84ol/EnJuMmm4VjFTNznbXii2n/fvgYXcNPExrhe87HQF6uXdcwEK+7rPhcWUwdwSOa1P7edKuJtP3fTvoYVFVXGLw3EnGK+9F0FE1h59Dlr31Ai7WVxSEFvbREFkw9VOeBXh1+iBB5V36O8CHefldz8Y7wHrjUQOqUlulTsBFmA5ssnf75Uq9XsLurmapCB3AFLT3MCdEYTQOb1sBUcVosJtzptNdkmbyPAkTGnr98Yk1l2iZxlOdTx5re59fFyDed7swGrsEfF8IWAhwQ17yDNp8qIlM288u--cKH1tXoTkwsxmmQE--BrEytZsW8K/4LznSy0luLw==
8 changes: 7 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@
registration: 'signup'
}
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html

# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
# Can be used by load balancers and uptime monitors to verify that the app is live.
get "up" => "rails/health#show", as: :rails_health_check

# Defines the root path route ("/")
# root "posts#index"

namespace :api do
namespace :v1 do
resources :cities, only: [:index]
end
end
end
5 changes: 4 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 20 additions & 2 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,23 @@
'West Bengal Medical Council'
]

cities = [
"Mumbai", "Delhi", "Bangalore", "Hyderabad", "Ahmedabad", "Chennai",
"Kolkata", "Surat", "Pune", "Jaipur", "Lucknow", "Kanpur", "Nagpur",
"Indore", "Thane", "Bhopal", "Visakhapatnam", "Patna", "Vadodara",
"Ghaziabad", "Ludhiana", "Agra", "Nashik", "Faridabad", "Meerut",
"Rajkot", "Kalyan-Dombivli", "Vasai-Virar", "Varanasi", "Srinagar",
"Aurangabad", "Dhanbad", "Amritsar", "Navi Mumbai", "Allahabad",
"Howrah", "Ranchi", "Gwalior", "Jabalpur", "Coimbatore", "Vijayawada",
"Jodhpur", "Madurai", "Raipur", "Kota", "Guwahati", "Chandigarh",
"Solapur", "Hubli–Dharwad", "Mysore", "Tiruchirappalli", "Bareilly",
"Aligarh", "Tiruppur", "Moradabad", "Jalandhar", "Bhubaneswar",
"Salem", "Warangal", "Guntur", "Bhiwandi", "Saharanpur", "Gorakhpur",
"Bikaner", "Amravati", "Noida", "Jamshedpur", "Bhilai", "Cuttack",
"Firozabad", "Kochi", "Nellore", "Bhavnagar", "Dehradun", "Durgapur",
"Asansol", "Rourkela", "Nanded", "Kolhapur", "Ajmer", "Akola"
]

degrees.each { |name| Degree.find_or_create_by!(name: name) }

specializations.each { |name| Specialization.find_or_create_by!(name: name) }
Expand All @@ -85,7 +102,8 @@
establishments = Array.new(20) do |index|
Establishment.create!(
name: Faker::Company.name,
address: addresses[index],
address_id: addresses[index].id,
city: cities.sample,
latitude: Faker::Address.latitude,
longitude: Faker::Address.longitude,
maps_location: "https://goo.gl/maps/#{Faker::Address.street_address.gsub(' ', '-')}"
Expand Down Expand Up @@ -163,4 +181,4 @@
doctor_profile: doctor_profile,
jti: SecureRandom.uuid
)
end
end