added 'order' fields to sections, categories and sub_categories. - moved backoffice migrations to front-api
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20150314033704) do
|
||||
ActiveRecord::Schema.define(version: 20150318174814) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -23,12 +23,19 @@ ActiveRecord::Schema.define(version: 20150314033704) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "anonymous_id_string"
|
||||
t.integer "delivery_destination_id"
|
||||
t.boolean "confirmed", default: false
|
||||
t.boolean "packed", default: false
|
||||
t.boolean "canceled_on_check", default: false
|
||||
t.boolean "canceled_on_delivery", default: false
|
||||
t.boolean "delivered", default: false
|
||||
t.text "internal_note"
|
||||
end
|
||||
|
||||
create_table "categories", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.integer "section_id"
|
||||
t.string "image_url"
|
||||
t.integer "order"
|
||||
end
|
||||
|
||||
create_table "delivery_destinations", force: :cascade do |t|
|
||||
@@ -87,6 +94,8 @@ ActiveRecord::Schema.define(version: 20150314033704) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "tags"
|
||||
t.json "traits"
|
||||
t.decimal "weight", precision: 5, scale: 3
|
||||
t.integer "special_offer_id"
|
||||
t.integer "supplier_id"
|
||||
end
|
||||
|
||||
@@ -111,12 +120,30 @@ ActiveRecord::Schema.define(version: 20150314033704) do
|
||||
end
|
||||
|
||||
create_table "sections", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "name"
|
||||
t.integer "order"
|
||||
end
|
||||
|
||||
create_table "special_offers", force: :cascade do |t|
|
||||
t.string "image_url"
|
||||
t.boolean "start_page"
|
||||
t.integer "section_id"
|
||||
t.integer "category_id"
|
||||
t.integer "sub_category_id"
|
||||
t.integer "item_id"
|
||||
t.boolean "thank_you_page"
|
||||
t.boolean "search_result_page"
|
||||
t.boolean "checkout_page"
|
||||
t.date "beginning"
|
||||
t.date "ending"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "sub_categories", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.integer "category_id"
|
||||
t.integer "order"
|
||||
end
|
||||
|
||||
create_table "suppliers", force: :cascade do |t|
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
|
||||
|
||||
get '/category' do
|
||||
Category.order(:name).all.to_json(:include => [:section, :sub_categories, :filter_criterias =>{:include => :filter_criteria_values} ])
|
||||
Category.eager_load(:sub_categories).order('categories.order, sub_categories.order').all.to_json(:include => [:section, :sub_categories, :filter_criterias =>{:include => :filter_criteria_values} ])
|
||||
end
|
||||
|
||||
get '/category/:id' do
|
||||
id = params[:id].to_i
|
||||
Category.find(id).to_json(:include => [:section, :sub_categories, :filter_criterias =>{:include => :filter_criteria_values}])
|
||||
Category.eager_load(:sub_categories).order('sub_categories.order').find(id).to_json(:include => [:section, :sub_categories, :filter_criterias =>{:include => :filter_criteria_values}])
|
||||
end
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
get '/section' do
|
||||
Section.order(:name).all.to_json(:include =>
|
||||
[:categories => { :include => :sub_categories }])
|
||||
Section.eager_load(:categories).order('sections.order, categories.order').to_json(:include => :categories)
|
||||
end
|
||||
|
||||
get '/section/:id' do
|
||||
Section.find(params[:id].to_i).to_json(:include => [
|
||||
:categories => { :include => :sub_categories } ])
|
||||
Section.eager_load(categories: :sub_categories).order('categories.order, sub_categories.order').find(params[:id].to_i).to_json(:include => [:categories => {:include => :sub_categories}])
|
||||
end
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddOrderToSections < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :sections, :order, :integer
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddOrderToCategories < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :categories, :order, :integer
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddOrderToSubcategories < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :sub_categories, :order, :integer
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20150318044933) do
|
||||
ActiveRecord::Schema.define(version: 20150318174814) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -23,11 +23,11 @@ ActiveRecord::Schema.define(version: 20150318044933) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "anonymous_id_string"
|
||||
t.integer "delivery_destination_id"
|
||||
t.boolean "confirmed"
|
||||
t.boolean "packed"
|
||||
t.boolean "canceled_on_check"
|
||||
t.boolean "canceled_on_delivery"
|
||||
t.boolean "delivered"
|
||||
t.boolean "confirmed", default: false
|
||||
t.boolean "packed", default: false
|
||||
t.boolean "canceled_on_check", default: false
|
||||
t.boolean "canceled_on_delivery", default: false
|
||||
t.boolean "delivered", default: false
|
||||
t.text "internal_note"
|
||||
end
|
||||
|
||||
@@ -35,6 +35,7 @@ ActiveRecord::Schema.define(version: 20150318044933) do
|
||||
t.string "name"
|
||||
t.integer "section_id"
|
||||
t.string "image_url"
|
||||
t.integer "order"
|
||||
end
|
||||
|
||||
create_table "delivery_destinations", force: :cascade do |t|
|
||||
@@ -93,7 +94,6 @@ ActiveRecord::Schema.define(version: 20150318044933) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "tags"
|
||||
t.json "traits"
|
||||
t.integer "supplier_id"
|
||||
t.decimal "weight", precision: 5, scale: 3
|
||||
t.integer "special_offer_id"
|
||||
end
|
||||
@@ -119,7 +119,8 @@ ActiveRecord::Schema.define(version: 20150318044933) do
|
||||
end
|
||||
|
||||
create_table "sections", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "name"
|
||||
t.integer "order"
|
||||
end
|
||||
|
||||
create_table "special_offers", force: :cascade do |t|
|
||||
@@ -141,19 +142,7 @@ ActiveRecord::Schema.define(version: 20150318044933) do
|
||||
create_table "sub_categories", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.integer "category_id"
|
||||
end
|
||||
|
||||
create_table "suppliers", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "address"
|
||||
t.string "postal_code"
|
||||
t.string "town"
|
||||
t.string "phone"
|
||||
t.string "contact_person"
|
||||
t.string "email"
|
||||
t.text "note"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "order"
|
||||
end
|
||||
|
||||
create_table "units", force: :cascade do |t|
|
||||
|
||||
Reference in New Issue
Block a user