diff --git a/back-office/app/controllers/delivery_time_estimations_controller.rb b/back-office/app/controllers/delivery_time_estimations_controller.rb new file mode 100644 index 0000000..318556c --- /dev/null +++ b/back-office/app/controllers/delivery_time_estimations_controller.rb @@ -0,0 +1,4 @@ +class DeliveryTimeEstimationsController < ApplicationController + active_scaffold :"delivery_time_estimation" do |conf| + end +end diff --git a/back-office/app/helpers/delivery_time_estimations_helper.rb b/back-office/app/helpers/delivery_time_estimations_helper.rb new file mode 100644 index 0000000..a5efaa0 --- /dev/null +++ b/back-office/app/helpers/delivery_time_estimations_helper.rb @@ -0,0 +1,2 @@ +module DeliveryTimeEstimationsHelper +end \ No newline at end of file diff --git a/back-office/app/models/delivery_time_estimation.rb b/back-office/app/models/delivery_time_estimation.rb new file mode 100644 index 0000000..feb6fec --- /dev/null +++ b/back-office/app/models/delivery_time_estimation.rb @@ -0,0 +1,2 @@ +class DeliveryTimeEstimation < ActiveRecord::Base +end diff --git a/back-office/config/routes.rb b/back-office/config/routes.rb index bcef546..42e4898 100644 --- a/back-office/config/routes.rb +++ b/back-office/config/routes.rb @@ -1,5 +1,6 @@ Rails.application.routes.draw do + resources :delivery_time_estimations do as_routes end resources :special_offers do as_routes end resources :suppliers do as_routes end resources :places do as_routes end diff --git a/back-office/test/controllers/delivery_time_estimations_controller_test.rb b/back-office/test/controllers/delivery_time_estimations_controller_test.rb new file mode 100644 index 0000000..70f6736 --- /dev/null +++ b/back-office/test/controllers/delivery_time_estimations_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class DeliveryTimeEstimationsControllerTest < ActionController::TestCase + setup do + @delivery_time_estimation = delivery_time_estimations(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:delivery_time_estimations) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create delivery_time_estimation" do + assert_difference('DeliveryTimeEstimation.count') do + post :create, delivery_time_estimation: { duration_in_days: @delivery_time_estimation.duration_in_days, name: @delivery_time_estimation.name } + end + + assert_redirected_to delivery_time_estimation_path(assigns(:delivery_time_estimation)) + end + + test "should show delivery_time_estimation" do + get :show, id: @delivery_time_estimation + assert_response :success + end + + test "should get edit" do + get :edit, id: @delivery_time_estimation + assert_response :success + end + + test "should update delivery_time_estimation" do + patch :update, id: @delivery_time_estimation, delivery_time_estimation: { duration_in_days: @delivery_time_estimation.duration_in_days, name: @delivery_time_estimation.name } + assert_redirected_to delivery_time_estimation_path(assigns(:delivery_time_estimation)) + end + + test "should destroy delivery_time_estimation" do + assert_difference('DeliveryTimeEstimation.count', -1) do + delete :destroy, id: @delivery_time_estimation + end + + assert_redirected_to delivery_time_estimations_path + end +end diff --git a/back-office/test/fixtures/delivery_time_estimations.yml b/back-office/test/fixtures/delivery_time_estimations.yml new file mode 100644 index 0000000..cf087cb --- /dev/null +++ b/back-office/test/fixtures/delivery_time_estimations.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + duration_in_days: 1 + +two: + name: MyString + duration_in_days: 1 diff --git a/back-office/test/models/delivery_time_estimation_test.rb b/back-office/test/models/delivery_time_estimation_test.rb new file mode 100644 index 0000000..d5b5e69 --- /dev/null +++ b/back-office/test/models/delivery_time_estimation_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class DeliveryTimeEstimationTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/front-api/db/migrate/20150321052318_create_delivery_time_estimations.rb b/front-api/db/migrate/20150321052318_create_delivery_time_estimations.rb new file mode 100644 index 0000000..2f8e6a3 --- /dev/null +++ b/front-api/db/migrate/20150321052318_create_delivery_time_estimations.rb @@ -0,0 +1,10 @@ +class CreateDeliveryTimeEstimations < ActiveRecord::Migration + def change + create_table :delivery_time_estimations do |t| + t.string :name + t.integer :duration_in_days + + t.timestamps null: false + end + end +end diff --git a/front-api/db/migrate/20150321052649_add_delivery_time_estimation_to_item.rb b/front-api/db/migrate/20150321052649_add_delivery_time_estimation_to_item.rb new file mode 100644 index 0000000..14de14a --- /dev/null +++ b/front-api/db/migrate/20150321052649_add_delivery_time_estimation_to_item.rb @@ -0,0 +1,5 @@ +class AddDeliveryTimeEstimationToItem < ActiveRecord::Migration + def change + add_column :items, :delivery_time_estimation_id, :integer + end +end diff --git a/front-api/db/migrate/20150321052740_remove_special_offer_id_from_item.rb b/front-api/db/migrate/20150321052740_remove_special_offer_id_from_item.rb new file mode 100644 index 0000000..d3bf5bf --- /dev/null +++ b/front-api/db/migrate/20150321052740_remove_special_offer_id_from_item.rb @@ -0,0 +1,5 @@ +class RemoveSpecialOfferIdFromItem < ActiveRecord::Migration + def change + remove_column :items, :special_offer_id + end +end diff --git a/front-api/db/schema.rb b/front-api/db/schema.rb index e69de29..fc2c17e 100644 --- a/front-api/db/schema.rb +++ b/front-api/db/schema.rb @@ -0,0 +1,191 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20150321052740) do + + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + + create_table "carts", force: :cascade do |t| + t.integer "user_id" + t.boolean "ordered", default: false + t.datetime "created_at", null: false + 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.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 "children", force: :cascade do |t| + t.string "name" + t.integer "gender" + t.date "date_of_birth" + t.integer "user_id" + t.boolean "on_the_way" + end + + create_table "delivery_destinations", force: :cascade do |t| + t.string "name" + t.string "address" + t.string "place" + t.string "postal_code" + t.string "phone" + t.string "email" + t.text "note" + t.boolean "email_verified" + t.boolean "phone_verified" + t.string "phone_verification_code" + t.string "email_verification_code" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "user_id" + t.string "anonymous_id_string" + end + + create_table "delivery_time_estimations", force: :cascade do |t| + t.string "name" + t.integer "duration_in_days" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "filter_criteria", force: :cascade do |t| + t.string "title" + t.string "field_name" + t.integer "type" + t.string "owner_type" + t.integer "owner_id" + end + + create_table "filter_criteria_values", force: :cascade do |t| + t.string "filter_text" + t.string "filter_value" + t.integer "filter_criteria_id" + end + + create_table "item_in_carts", force: :cascade do |t| + t.integer "cart_id" + t.integer "item_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "count" + t.decimal "price" + end + + create_table "items", force: :cascade do |t| + t.string "name" + t.string "code", limit: 10 + t.decimal "current_input_price", precision: 5, scale: 2 + t.decimal "list_price", precision: 5, scale: 2 + t.integer "unit_id" + t.decimal "units_in_pack", precision: 5, scale: 3 + t.text "description" + t.integer "sub_category_id" + t.integer "stock" + t.boolean "on_display" + t.datetime "created_at", null: false + 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 "delivery_time_estimation_id" + end + + create_table "media_types", force: :cascade do |t| + t.string "name" + end + + create_table "multi_media_descriptions", force: :cascade do |t| + t.string "url" + t.integer "item_id" + t.integer "media_type_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "places", force: :cascade do |t| + t.string "postal_code" + t.decimal "delivery_price" + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "sections", force: :cascade do |t| + 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| + 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 + end + + create_table "units", force: :cascade do |t| + t.string "name" + t.string "short_name", limit: 4 + t.string "description_suffix" + t.string "number_of_pieces_suffix" + end + + create_table "users", force: :cascade do |t| + t.string "first_name" + t.string "last_name" + t.string "email" + t.string "password_digest" + end + +end