Browse Source

Add website attribute on places table

feature/region-slug-gone
Bèr Kessels 5 months ago
parent
commit
25d663f847

+ 1
- 1
app/models/place.rb View File

@@ -16,7 +16,7 @@ module Hours
PARSER = OpeningHoursConverter::OpeningHoursParser.new

attr_accessor :id, :location, :place_id, :name,
:region_slug, :distance
:region_slug, :distance, :website
attr_writer :address, :opening_hours

def lat

+ 2
- 0
app/projections/places.rb View File

@@ -18,6 +18,7 @@ module Hours
column :place_id, :varchar, null: false, size: 255
column :region_slug, :varchar, null: false, size: 255
column :name, :text
column :website, :varchar, size: 255
column :opening_hours, :text
column :location, 'geography(POINT)'
column :address, :hstore
@@ -40,6 +41,7 @@ module Hours
location: GeoRuby::SimpleFeatures::Point.from_coordinates(
geometry['coordinates']
),
website: properties['contact:website'],
region_slug: properties['region_slug'],
address: Sequel.hstore(
street: properties['addr:street'],

+ 2
- 1
app/serializers/place.rb View File

@@ -9,7 +9,8 @@ module Hours
class Place < JSONAPI::Serializable::Resource
type 'place'

attributes :name, :lat, :lon, :status, :open_this_week, :place_id
attributes :name, :lat, :lon, :status, :open_this_week, :place_id,
:website
id { @object.id }

attribute :raw_opening_hours do

+ 1
- 0
test/fixtures/output/hm_burchtstraat.json View File

@@ -53,6 +53,7 @@
]
},
"raw_opening_hours": "Mo-We 10:00-18:00; Th 10:00-21:00; Fr 10:00-18:00; Sa 09:30-17:30; Su 12:00-17:30",
"website": null,
"address": {
"postcode": "6511RA",
"city": "Nijmegen",

Loading…
Cancel
Save