diff --git a/app/controllers/api/v1/cities_controller.rb b/app/controllers/api/v1/cities_controller.rb new file mode 100644 index 0000000..9fd7f66 --- /dev/null +++ b/app/controllers/api/v1/cities_controller.rb @@ -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 \ No newline at end of file diff --git a/app/models/review.rb b/app/models/review.rb index 57fb73e..208ec62 100644 --- a/app/models/review.rb +++ b/app/models/review.rb @@ -1,4 +1,4 @@ class Review < ApplicationRecord belongs_to :patient_profile belongs_to :doctor_profile -end +end \ No newline at end of file diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc index 4baedbb..56e5146 100644 --- a/config/credentials.yml.enc +++ b/config/credentials.yml.enc @@ -1 +1 @@ -LspezHxBXYYDjpJT6leazJwF4EBpyRhnCx7dMpAFB1/Zs/gxpLSkWJLwUXqix1VSfvGf0MQ2mdlhlSpL/eawUhSaB08jEcnk1QZVb8FrOXhdL/0YzxAxSwkOfaVQUh+cbFjPWnLkjCVVzb1rJ7U8hJ1F127ELhAz7z0vdpV07aNyc3QEjujZSL412DGe0mJDttEqMvv7OKXEkLtmlZX3/LDtM8W8M/6BjJmTFHUs/2TuarmFv9InJTtVamgI1Owhp52suRDKNw7BAInBbcCZheC0vKvptUCfxUFd2a2yWqD5W3RATzKmy5v03O8vLRCmzbq8fiq87K2bYQVnw0DLja80TDt/U5Q4lLVvMUnVBRpqeW+hZKSlI2R4aVZysPBIdttsetWvwBfGtVKrHN29w/d+9lfq--qC55RquQklVlF31K--DbXL0CO115WRkLbEhR5tSQ== \ No newline at end of file +Zl4B34n6udhcvb6gaFCQS3ZHG7dShpog/OROmcAtpMzDhpMko/+z4qNsFMLjTHEzDgBKXbSGqY+ZZszMO51OYU9DM4gFcECsB9McwNwMJ5g7q4rCK6Afp5DkMO84ol/EnJuMmm4VjFTNznbXii2n/fvgYXcNPExrhe87HQF6uXdcwEK+7rPhcWUwdwSOa1P7edKuJtP3fTvoYVFVXGLw3EnGK+9F0FE1h59Dlr31Ai7WVxSEFvbREFkw9VOeBXh1+iBB5V36O8CHefldz8Y7wHrjUQOqUlulTsBFmA5ssnf75Uq9XsLurmapCB3AFLT3MCdEYTQOb1sBUcVosJtzptNdkmbyPAkTGnr98Yk1l2iZxlOdTx5re59fFyDed7swGrsEfF8IWAhwQ17yDNp8qIlM288u--cKH1tXoTkwsxmmQE--BrEytZsW8K/4LznSy0luLw== \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 7703399..7b37a17 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 50b2b64..dab1c68 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_10_25_084443) do +ActiveRecord::Schema[7.1].define(version: 2024_10_29_230329) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -118,6 +118,8 @@ t.bigint "doctor_profile_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.integer "rating" + t.string "comment", limit: 500 t.index ["doctor_profile_id"], name: "index_reviews_on_doctor_profile_id" t.index ["patient_profile_id"], name: "index_reviews_on_patient_profile_id" end @@ -177,6 +179,7 @@ add_foreign_key "doctor_profiles", "specializations" add_foreign_key "establishments", "addresses" add_foreign_key "patient_profiles", "addresses" + add_foreign_key "payments", "appointments" add_foreign_key "reviews", "doctor_profiles" add_foreign_key "reviews", "patient_profiles" add_foreign_key "services", "doctor_profiles" diff --git a/db/seeds.rb b/db/seeds.rb index 36e97af..1a30719 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -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) } @@ -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(' ', '-')}" @@ -163,4 +181,4 @@ doctor_profile: doctor_profile, jti: SecureRandom.uuid ) -end +end \ No newline at end of file