From: Tom Clegg Date: Tue, 22 Jan 2013 20:33:32 +0000 (-0800) Subject: add Log resource X-Git-Tag: 1.1.0~3487 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/57a515aba70596e82fb475812ead9c5c9766d5d5 add Log resource --- diff --git a/app/assets/javascripts/logs.js.coffee b/app/assets/javascripts/logs.js.coffee new file mode 100644 index 0000000000..761567942f --- /dev/null +++ b/app/assets/javascripts/logs.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/logs.css.scss b/app/assets/stylesheets/logs.css.scss new file mode 100644 index 0000000000..4aaccac1b8 --- /dev/null +++ b/app/assets/stylesheets/logs.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Logs controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/orvos/v1/logs_controller.rb b/app/controllers/orvos/v1/logs_controller.rb new file mode 100644 index 0000000000..1860e5de36 --- /dev/null +++ b/app/controllers/orvos/v1/logs_controller.rb @@ -0,0 +1,2 @@ +class Orvos::V1::LogsController < ApplicationController +end diff --git a/app/helpers/logs_helper.rb b/app/helpers/logs_helper.rb new file mode 100644 index 0000000000..99736f0c6d --- /dev/null +++ b/app/helpers/logs_helper.rb @@ -0,0 +1,2 @@ +module LogsHelper +end diff --git a/app/models/log.rb b/app/models/log.rb new file mode 100644 index 0000000000..3b2af893cb --- /dev/null +++ b/app/models/log.rb @@ -0,0 +1,15 @@ +class Log < ActiveRecord::Base + include AssignUuid + include KindAndEtag + include CommonApiTemplate + serialize :info, Hash + + api_accessible :superuser, :extend => :common do |t| + t.add :object_kind + t.add :object_uuid + t.add :event_at + t.add :event_type + t.add :summary + t.add :info + end +end diff --git a/config/routes.rb b/config/routes.rb index 9f313b9d5a..d0e014b940 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,6 @@ Server::Application.routes.draw do + resources :logs + resources :projects resources :specimens diff --git a/db/migrate/20130122201442_create_logs.rb b/db/migrate/20130122201442_create_logs.rb new file mode 100644 index 0000000000..b3122bd924 --- /dev/null +++ b/db/migrate/20130122201442_create_logs.rb @@ -0,0 +1,28 @@ +class CreateLogs < ActiveRecord::Migration + def up + create_table :logs do |t| + t.string :uuid + t.string :created_by_client + t.string :created_by_user + t.string :modified_by_client + t.string :modified_by_user + t.string :object_kind + t.string :object_uuid + t.datetime :event_at + t.string :event_type + t.text :summary + t.text :info + + t.timestamps + end + add_index :logs, :uuid, :unique => true + add_index :logs, :object_kind + add_index :logs, :object_uuid + add_index :logs, :event_type + add_index :logs, :event_at + add_index :logs, :summary + end + + def down + drop_table :logs end +end diff --git a/db/schema.rb b/db/schema.rb index 996ac18644..71a06b2f0b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130118002239) do +ActiveRecord::Schema.define(:version => 20130122201442) do create_table "collections", :force => true do |t| t.string "locator" @@ -33,6 +33,29 @@ ActiveRecord::Schema.define(:version => 20130118002239) do add_index "collections", ["uuid"], :name => "index_collections_on_uuid", :unique => true + create_table "logs", :force => true do |t| + t.string "uuid" + t.string "created_by_client" + t.string "created_by_user" + t.string "modified_by_client" + t.string "modified_by_user" + t.string "object_kind" + t.string "object_uuid" + t.datetime "event_at" + t.string "event_type" + t.text "summary" + t.text "info" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "logs", ["event_at"], :name => "index_logs_on_event_at" + add_index "logs", ["event_type"], :name => "index_logs_on_event_type" + add_index "logs", ["object_kind"], :name => "index_logs_on_object_kind" + add_index "logs", ["object_uuid"], :name => "index_logs_on_object_uuid" + add_index "logs", ["summary"], :name => "index_logs_on_summary" + add_index "logs", ["uuid"], :name => "index_logs_on_uuid", :unique => true + create_table "metadata", :force => true do |t| t.string "uuid" t.string "created_by_client" diff --git a/test/fixtures/logs.yml b/test/fixtures/logs.yml new file mode 100644 index 0000000000..c892854a9f --- /dev/null +++ b/test/fixtures/logs.yml @@ -0,0 +1,27 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + uuid: MyString + created_by_client: MyString + created_by_user: MyString + modified_by_client: MyString + modified_by_user: MyString + object_kind: MyString + object_uuid: MyString + event_at: 2013-01-22 12:14:42 + event_type: MyString + summary: MyText + info: MyText + +two: + uuid: MyString + created_by_client: MyString + created_by_user: MyString + modified_by_client: MyString + modified_by_user: MyString + object_kind: MyString + object_uuid: MyString + event_at: 2013-01-22 12:14:42 + event_type: MyString + summary: MyText + info: MyText diff --git a/test/functional/logs_controller_test.rb b/test/functional/logs_controller_test.rb new file mode 100644 index 0000000000..bab4469bb9 --- /dev/null +++ b/test/functional/logs_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class LogsControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/helpers/logs_helper_test.rb b/test/unit/helpers/logs_helper_test.rb new file mode 100644 index 0000000000..c165554d08 --- /dev/null +++ b/test/unit/helpers/logs_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class LogsHelperTest < ActionView::TestCase +end diff --git a/test/unit/log_test.rb b/test/unit/log_test.rb new file mode 100644 index 0000000000..f2afee2dc9 --- /dev/null +++ b/test/unit/log_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class LogTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end