introspective_grape 0.3.5 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +5 -52
- data/CHANGELOG.md +40 -0
- data/Gemfile +2 -0
- data/README.md +15 -0
- data/gemfiles/{Gemfile.rails.4.2.7.1 → Gemfile.rails.5.0.0} +5 -4
- data/gemfiles/Gemfile.rails.5.0.1 +1 -0
- data/gemfiles/{Gemfile.rails.4.2.7.1.new.swagger → Gemfile.rails.5.1.0} +5 -3
- data/gemfiles/{Gemfile.rails.3.2.22 → Gemfile.rails.5.2.0} +5 -4
- data/gemfiles/Gemfile.rails.master +1 -0
- data/introspective_grape.gemspec +13 -12
- data/lib/introspective_grape.rb +3 -1
- data/lib/introspective_grape/api.rb +36 -31
- data/lib/introspective_grape/camel_snake.rb +30 -31
- data/lib/introspective_grape/configuration.rb +15 -0
- data/lib/introspective_grape/create_helpers.rb +2 -2
- data/lib/introspective_grape/version.rb +1 -1
- data/spec/dummy/Gemfile +6 -3
- data/spec/dummy/app/api/api_helpers.rb +2 -0
- data/spec/dummy/app/api/dummy/company_api.rb +1 -1
- data/spec/dummy/app/models/role.rb +1 -1
- data/spec/dummy/app/models/user.rb +2 -2
- data/spec/dummy/config.ru +12 -0
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/config/environments/development.rb +3 -3
- data/spec/dummy/config/initializers/paperclip_adapter.rb +1 -1
- data/spec/dummy/db/migrate/20190325231304_add_test_data.rb +5 -0
- data/spec/dummy/db/schema.rb +154 -173
- data/spec/requests/chat_api_spec.rb +26 -26
- data/spec/requests/company_api_spec.rb +15 -15
- data/spec/requests/location_api_spec.rb +18 -18
- data/spec/requests/project_api_spec.rb +21 -21
- data/spec/requests/role_api_spec.rb +4 -4
- data/spec/requests/sessions_api_spec.rb +10 -10
- data/spec/requests/swagger_spec.rb +1 -1
- data/spec/requests/user_api_spec.rb +34 -36
- metadata +49 -51
- data/gemfiles/2.0.0-Gemfile +0 -22
- data/gemfiles/2.2.0-Gemfile +0 -21
- data/gemfiles/Gemfile.rails.4.1.13 +0 -13
- data/gemfiles/Gemfile.rails.4.2.8 +0 -12
@@ -0,0 +1,15 @@
|
|
1
|
+
module IntrospectiveGrape
|
2
|
+
def self.configure
|
3
|
+
self.config ||= Configuration.new
|
4
|
+
yield config
|
5
|
+
end
|
6
|
+
|
7
|
+
class Configuration
|
8
|
+
attr_accessor :camelize_parameters, :skip_object_reload
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@camelize_parameters = true
|
12
|
+
@skip_object_reload = false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -2,7 +2,7 @@ module IntrospectiveGrape
|
|
2
2
|
module CreateHelpers
|
3
3
|
|
4
4
|
def add_new_records_to_root_record(dsl, routes, params, model)
|
5
|
-
dsl.authorize model, :create?
|
5
|
+
dsl.send(:authorize, model, :create?)
|
6
6
|
ActiveRecord::Base.transaction do
|
7
7
|
old = find_leaves(routes, model, params)
|
8
8
|
model.update_attributes( dsl.send(:safe_params,params).permit(whitelist) )
|
@@ -13,7 +13,7 @@ module IntrospectiveGrape
|
|
13
13
|
|
14
14
|
def create_new_record(dsl, routes, params)
|
15
15
|
model = routes.first.model.new( dsl.send(:safe_params,params).permit(whitelist) )
|
16
|
-
dsl.authorize model, :create?
|
16
|
+
dsl.send(:authorize, model, :create?)
|
17
17
|
model.save!
|
18
18
|
|
19
19
|
# reload the model with eager loading
|
data/spec/dummy/Gemfile
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
-
gem 'rails'
|
2
|
+
gem 'rails'
|
3
3
|
|
4
4
|
#gem 'byebug'
|
5
|
-
|
5
|
+
gem 'camel_snake_keys'
|
6
6
|
|
7
|
+
gem 'devise'
|
7
8
|
gem 'delayed_paperclip'
|
8
9
|
#gem 'devise-async'
|
9
10
|
|
@@ -11,8 +12,10 @@ gem 'grape'
|
|
11
12
|
gem 'grape-entity'
|
12
13
|
gem 'grape-kaminari'
|
13
14
|
gem 'grape-swagger'
|
15
|
+
gem 'introspective_grape', git: 'https://github.com/buermann/introspective_grape', branch: 'grape-1.2'
|
14
16
|
|
15
17
|
gem 'paperclip'
|
16
18
|
gem 'pundit'
|
17
19
|
|
18
|
-
gem '
|
20
|
+
gem 'rack-cors'
|
21
|
+
gem 'sqlite3', '< 1.4.0'
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module ApiHelpers
|
2
2
|
def current_user
|
3
3
|
params[:api_key].present? && @user = User.find_by_authentication_token(params[:api_key])
|
4
|
+
# for testing in situ
|
5
|
+
#@user = User.find_or_create_by(email: 'test@test.com', superuser: true, authentication_token: '1234567890', first_name: "First", last_name: "Last")
|
4
6
|
end
|
5
7
|
|
6
8
|
def authenticate!
|
@@ -5,7 +5,7 @@ class Dummy::CompanyAPI < IntrospectiveGrape::API
|
|
5
5
|
|
6
6
|
desc "Test default values in an extra endpoint"
|
7
7
|
params do
|
8
|
-
optional :boolean_default, type: Boolean, default: false
|
8
|
+
optional :boolean_default, type: Virtus::Attribute::Boolean, default: false
|
9
9
|
optional :string_default, type: String, default: "foo"
|
10
10
|
optional :integer_default, type: Integer, default: 123
|
11
11
|
end
|
@@ -2,7 +2,7 @@ class Role < AbstractAdapter
|
|
2
2
|
belongs_to :user
|
3
3
|
belongs_to :ownable, polymorphic: true
|
4
4
|
|
5
|
-
validates_uniqueness_of :user_id, scope: [:ownable_type,:ownable_id], unless:
|
5
|
+
validates_uniqueness_of :user_id, scope: [:ownable_type,:ownable_id], unless: Proc.new {|u| u.user_id.nil? }, message: "user has already been assigned that role"
|
6
6
|
OWNABLE_TYPES = %w(Company Project).freeze
|
7
7
|
validates_inclusion_of :ownable_type, in: OWNABLE_TYPES
|
8
8
|
|
@@ -33,8 +33,8 @@ class User < AbstractAdapter
|
|
33
33
|
|
34
34
|
has_many :roles, dependent: :destroy, inverse_of: :user
|
35
35
|
accepts_nested_attributes_for :roles, allow_destroy: true
|
36
|
-
has_many :admin_companies, through: :roles, source: :ownable, source_type: Company
|
37
|
-
has_many :admin_projects, through: :roles, source: :ownable, source_type: Project
|
36
|
+
has_many :admin_companies, through: :roles, source: :ownable, source_type: 'Company'
|
37
|
+
has_many :admin_projects, through: :roles, source: :ownable, source_type: 'Project'
|
38
38
|
|
39
39
|
def all_admin_projects # aggregate companies' projects with project admin roles
|
40
40
|
(admin_companies.map(&:projects)+admin_projects).flatten
|
data/spec/dummy/config.ru
CHANGED
@@ -2,3 +2,15 @@
|
|
2
2
|
|
3
3
|
require ::File.expand_path('../config/environment', __FILE__)
|
4
4
|
run Rails.application
|
5
|
+
|
6
|
+
require 'rack/cors'
|
7
|
+
|
8
|
+
use Rack::Cors do
|
9
|
+
allow do
|
10
|
+
origins '*'
|
11
|
+
resource '*',
|
12
|
+
:headers => :any,
|
13
|
+
:methods => [:get, :post, :delete, :put, :options],
|
14
|
+
expose: %w(X-Server-Date X-Server-Epoch)
|
15
|
+
end
|
16
|
+
end
|
@@ -5,7 +5,7 @@ require "active_record/railtie"
|
|
5
5
|
require "action_controller/railtie"
|
6
6
|
require "action_mailer/railtie"
|
7
7
|
require "action_view/railtie"
|
8
|
-
|
8
|
+
require "sprockets/railtie"
|
9
9
|
require 'devise'
|
10
10
|
#require 'devise/async'
|
11
11
|
require 'grape-swagger'
|
@@ -26,16 +26,16 @@ Rails.application.configure do
|
|
26
26
|
# Debug mode disables concatenation and preprocessing of assets.
|
27
27
|
# This option may cause significant delays in view rendering with a large
|
28
28
|
# number of complex assets.
|
29
|
-
config.assets.debug = true
|
29
|
+
#config.assets.debug = true
|
30
30
|
|
31
31
|
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
32
32
|
# yet still be able to expire them through the digest params.
|
33
|
-
config.assets.digest = true
|
33
|
+
#config.assets.digest = true
|
34
34
|
|
35
35
|
# Adds additional error checking when serving assets at runtime.
|
36
36
|
# Checks for improperly declared sprockets dependencies.
|
37
37
|
# Raises helpful error messages.
|
38
|
-
config.assets.raise_runtime_errors = true
|
38
|
+
#config.assets.raise_runtime_errors = true
|
39
39
|
|
40
40
|
# Raises error for missing translations
|
41
41
|
# config.action_view.raise_on_missing_translations = true
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
# This file is auto-generated from the current state of the database. Instead
|
3
2
|
# of editing this file, please use the migrations feature of Active Record to
|
4
3
|
# incrementally modify your database, and then regenerate this schema definition.
|
@@ -11,269 +10,251 @@
|
|
11
10
|
#
|
12
11
|
# It's strongly recommended that you check this file into your version control system.
|
13
12
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 2019_03_25_231304) do
|
15
14
|
|
16
15
|
create_table "active_admin_comments", force: :cascade do |t|
|
17
|
-
t.string
|
18
|
-
t.text
|
19
|
-
t.string
|
20
|
-
t.string
|
21
|
-
t.integer
|
22
|
-
t.string
|
23
|
-
t.datetime "created_at",
|
24
|
-
t.datetime "updated_at",
|
16
|
+
t.string "namespace"
|
17
|
+
t.text "body"
|
18
|
+
t.string "resource_id", null: false
|
19
|
+
t.string "resource_type", null: false
|
20
|
+
t.integer "author_id"
|
21
|
+
t.string "author_type"
|
22
|
+
t.datetime "created_at", null: false
|
23
|
+
t.datetime "updated_at", null: false
|
24
|
+
t.index ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id"
|
25
|
+
t.index ["namespace"], name: "index_active_admin_comments_on_namespace"
|
26
|
+
t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id"
|
25
27
|
end
|
26
28
|
|
27
|
-
add_index "active_admin_comments", ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id"
|
28
|
-
add_index "active_admin_comments", ["namespace"], name: "index_active_admin_comments_on_namespace"
|
29
|
-
add_index "active_admin_comments", ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id"
|
30
|
-
|
31
29
|
create_table "admin_users", force: :cascade do |t|
|
32
|
-
t.string
|
33
|
-
t.string
|
34
|
-
t.string
|
30
|
+
t.string "email", default: "", null: false
|
31
|
+
t.string "encrypted_password", default: "", null: false
|
32
|
+
t.string "reset_password_token"
|
35
33
|
t.datetime "reset_password_sent_at"
|
36
34
|
t.datetime "remember_created_at"
|
37
|
-
t.integer
|
35
|
+
t.integer "sign_in_count", default: 0, null: false
|
38
36
|
t.datetime "current_sign_in_at"
|
39
37
|
t.datetime "last_sign_in_at"
|
40
|
-
t.string
|
41
|
-
t.string
|
42
|
-
t.datetime "created_at",
|
43
|
-
t.datetime "updated_at",
|
38
|
+
t.string "current_sign_in_ip"
|
39
|
+
t.string "last_sign_in_ip"
|
40
|
+
t.datetime "created_at", null: false
|
41
|
+
t.datetime "updated_at", null: false
|
42
|
+
t.index ["email"], name: "index_admin_users_on_email", unique: true
|
43
|
+
t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true
|
44
44
|
end
|
45
45
|
|
46
|
-
add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true
|
47
|
-
add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true
|
48
|
-
|
49
46
|
create_table "chat_message_users", force: :cascade do |t|
|
50
|
-
t.integer
|
51
|
-
t.integer
|
47
|
+
t.integer "chat_message_id"
|
48
|
+
t.integer "user_id"
|
52
49
|
t.datetime "read_at"
|
53
|
-
t.datetime "created_at",
|
54
|
-
t.datetime "updated_at",
|
50
|
+
t.datetime "created_at", null: false
|
51
|
+
t.datetime "updated_at", null: false
|
52
|
+
t.index ["chat_message_id"], name: "index_chat_message_users_on_chat_message_id"
|
53
|
+
t.index ["user_id"], name: "index_chat_message_users_on_user_id"
|
55
54
|
end
|
56
55
|
|
57
|
-
add_index "chat_message_users", ["chat_message_id"], name: "index_chat_message_users_on_chat_message_id"
|
58
|
-
add_index "chat_message_users", ["user_id"], name: "index_chat_message_users_on_user_id"
|
59
|
-
|
60
56
|
create_table "chat_messages", force: :cascade do |t|
|
61
|
-
t.integer
|
62
|
-
t.integer
|
63
|
-
t.text
|
57
|
+
t.integer "chat_id"
|
58
|
+
t.integer "author_id"
|
59
|
+
t.text "message"
|
64
60
|
t.datetime "created_at", null: false
|
65
61
|
t.datetime "updated_at", null: false
|
62
|
+
t.index ["author_id"], name: "index_chat_messages_on_author_id"
|
63
|
+
t.index ["chat_id"], name: "index_chat_messages_on_chat_id"
|
66
64
|
end
|
67
65
|
|
68
|
-
add_index "chat_messages", ["author_id"], name: "index_chat_messages_on_author_id"
|
69
|
-
add_index "chat_messages", ["chat_id"], name: "index_chat_messages_on_chat_id"
|
70
|
-
|
71
66
|
create_table "chat_users", force: :cascade do |t|
|
72
|
-
t.integer
|
73
|
-
t.integer
|
67
|
+
t.integer "chat_id"
|
68
|
+
t.integer "user_id"
|
74
69
|
t.datetime "departed_at"
|
75
|
-
t.datetime "created_at",
|
76
|
-
t.datetime "updated_at",
|
70
|
+
t.datetime "created_at", null: false
|
71
|
+
t.datetime "updated_at", null: false
|
72
|
+
t.index ["chat_id"], name: "index_chat_users_on_chat_id"
|
73
|
+
t.index ["user_id"], name: "index_chat_users_on_user_id"
|
77
74
|
end
|
78
75
|
|
79
|
-
add_index "chat_users", ["chat_id"], name: "index_chat_users_on_chat_id"
|
80
|
-
add_index "chat_users", ["user_id"], name: "index_chat_users_on_user_id"
|
81
|
-
|
82
76
|
create_table "chats", force: :cascade do |t|
|
83
|
-
t.integer
|
77
|
+
t.integer "creator_id"
|
84
78
|
t.datetime "created_at", null: false
|
85
79
|
t.datetime "updated_at", null: false
|
86
80
|
end
|
87
81
|
|
88
82
|
create_table "companies", force: :cascade do |t|
|
89
|
-
t.string
|
90
|
-
t.string
|
91
|
-
t.datetime "created_at",
|
92
|
-
t.datetime "updated_at",
|
83
|
+
t.string "name", limit: 256, null: false
|
84
|
+
t.string "short_name", limit: 10, null: false
|
85
|
+
t.datetime "created_at", null: false
|
86
|
+
t.datetime "updated_at", null: false
|
87
|
+
t.index ["name"], name: "index_companies_on_name", unique: true
|
93
88
|
end
|
94
89
|
|
95
|
-
add_index "companies", ["name"], name: "index_companies_on_name", unique: true
|
96
|
-
|
97
90
|
create_table "images", force: :cascade do |t|
|
98
|
-
t.integer
|
99
|
-
t.string
|
100
|
-
t.string
|
101
|
-
t.string
|
102
|
-
t.integer
|
91
|
+
t.integer "imageable_id"
|
92
|
+
t.string "imageable_type"
|
93
|
+
t.string "file_file_name"
|
94
|
+
t.string "file_content_type"
|
95
|
+
t.integer "file_file_size"
|
103
96
|
t.datetime "file_updated_at"
|
104
|
-
t.boolean
|
105
|
-
t.text
|
106
|
-
t.string
|
107
|
-
t.float
|
108
|
-
t.float
|
97
|
+
t.boolean "file_processing", default: false, null: false
|
98
|
+
t.text "meta"
|
99
|
+
t.string "source"
|
100
|
+
t.float "lat"
|
101
|
+
t.float "lng"
|
109
102
|
t.datetime "taken_at"
|
110
|
-
t.datetime "created_at",
|
111
|
-
t.datetime "updated_at",
|
103
|
+
t.datetime "created_at", null: false
|
104
|
+
t.datetime "updated_at", null: false
|
112
105
|
end
|
113
106
|
|
114
107
|
create_table "jobs", force: :cascade do |t|
|
115
|
-
t.string
|
108
|
+
t.string "title", null: false
|
116
109
|
t.datetime "created_at", null: false
|
117
110
|
t.datetime "updated_at", null: false
|
118
111
|
end
|
119
112
|
|
120
113
|
create_table "locatables", force: :cascade do |t|
|
121
|
-
t.integer
|
122
|
-
t.integer
|
123
|
-
t.string
|
124
|
-
t.datetime "created_at",
|
125
|
-
t.datetime "updated_at",
|
114
|
+
t.integer "location_id"
|
115
|
+
t.integer "locatable_id"
|
116
|
+
t.string "locatable_type"
|
117
|
+
t.datetime "created_at", null: false
|
118
|
+
t.datetime "updated_at", null: false
|
119
|
+
t.index ["locatable_type", "locatable_id"], name: "index_locatables_on_locatable_type_and_locatable_id"
|
126
120
|
end
|
127
121
|
|
128
|
-
add_index "locatables", ["locatable_type", "locatable_id"], name: "index_locatables_on_locatable_type_and_locatable_id"
|
129
|
-
|
130
122
|
create_table "location_beacons", force: :cascade do |t|
|
131
|
-
t.integer
|
132
|
-
t.integer
|
133
|
-
t.string
|
134
|
-
t.string
|
135
|
-
t.integer
|
136
|
-
t.integer
|
137
|
-
t.datetime "created_at",
|
138
|
-
t.datetime "updated_at",
|
123
|
+
t.integer "location_id"
|
124
|
+
t.integer "company_id", null: false
|
125
|
+
t.string "mac_address", limit: 12
|
126
|
+
t.string "uuid", limit: 32, null: false
|
127
|
+
t.integer "major", null: false
|
128
|
+
t.integer "minor", null: false
|
129
|
+
t.datetime "created_at", null: false
|
130
|
+
t.datetime "updated_at", null: false
|
131
|
+
t.index ["company_id", "uuid", "major", "minor"], name: "index_location_beacons_unique_company_identifier", unique: true
|
139
132
|
end
|
140
133
|
|
141
|
-
add_index "location_beacons", ["company_id", "uuid", "major", "minor"], name: "index_location_beacons_unique_company_identifier", unique: true
|
142
|
-
|
143
134
|
create_table "location_gps", force: :cascade do |t|
|
144
|
-
t.integer
|
145
|
-
t.float
|
146
|
-
t.float
|
147
|
-
t.float
|
148
|
-
t.datetime "created_at",
|
149
|
-
t.datetime "updated_at",
|
135
|
+
t.integer "location_id"
|
136
|
+
t.float "lat", null: false
|
137
|
+
t.float "lng", null: false
|
138
|
+
t.float "alt", default: 0.0
|
139
|
+
t.datetime "created_at", null: false
|
140
|
+
t.datetime "updated_at", null: false
|
141
|
+
t.index ["location_id"], name: "index_location_gps_on_location_id"
|
150
142
|
end
|
151
143
|
|
152
|
-
add_index "location_gps", ["location_id"], name: "index_location_gps_on_location_id"
|
153
|
-
|
154
144
|
create_table "locations", force: :cascade do |t|
|
155
|
-
t.string
|
156
|
-
t.string
|
157
|
-
t.integer
|
158
|
-
t.datetime "created_at",
|
159
|
-
t.datetime "updated_at",
|
145
|
+
t.string "name", null: false
|
146
|
+
t.string "kind"
|
147
|
+
t.integer "parent_location_id"
|
148
|
+
t.datetime "created_at", null: false
|
149
|
+
t.datetime "updated_at", null: false
|
150
|
+
t.index ["parent_location_id", "kind", "name"], name: "index_locations_on_parent_location_id_and_kind_and_name", unique: true
|
151
|
+
t.index ["parent_location_id"], name: "index_locations_on_parent_location_id"
|
160
152
|
end
|
161
153
|
|
162
|
-
add_index "locations", ["parent_location_id", "kind", "name"], name: "index_locations_on_parent_location_id_and_kind_and_name", unique: true
|
163
|
-
add_index "locations", ["parent_location_id"], name: "index_locations_on_parent_location_id"
|
164
|
-
|
165
154
|
create_table "project_jobs", force: :cascade do |t|
|
166
|
-
t.integer
|
167
|
-
t.integer
|
155
|
+
t.integer "project_id", null: false
|
156
|
+
t.integer "job_id", null: false
|
168
157
|
t.datetime "created_at", null: false
|
169
158
|
t.datetime "updated_at", null: false
|
159
|
+
t.index ["job_id"], name: "index_project_jobs_on_job_id"
|
160
|
+
t.index ["project_id", "job_id"], name: "index_project_jobs_on_project_id_and_job_id", unique: true
|
161
|
+
t.index ["project_id"], name: "index_project_jobs_on_project_id"
|
170
162
|
end
|
171
163
|
|
172
|
-
add_index "project_jobs", ["job_id"], name: "index_project_jobs_on_job_id"
|
173
|
-
add_index "project_jobs", ["project_id", "job_id"], name: "index_project_jobs_on_project_id_and_job_id", unique: true
|
174
|
-
add_index "project_jobs", ["project_id"], name: "index_project_jobs_on_project_id"
|
175
|
-
|
176
164
|
create_table "projects", force: :cascade do |t|
|
177
|
-
t.string
|
178
|
-
t.integer
|
179
|
-
t.datetime "created_at",
|
180
|
-
t.datetime "updated_at",
|
181
|
-
t.string
|
165
|
+
t.string "name", null: false
|
166
|
+
t.integer "owner_id"
|
167
|
+
t.datetime "created_at", null: false
|
168
|
+
t.datetime "updated_at", null: false
|
169
|
+
t.string "default_password"
|
170
|
+
t.index ["owner_id"], name: "index_projects_on_owner_id"
|
182
171
|
end
|
183
172
|
|
184
|
-
add_index "projects", ["owner_id"], name: "index_projects_on_owner_id"
|
185
|
-
|
186
173
|
create_table "roles", force: :cascade do |t|
|
187
|
-
t.integer
|
188
|
-
t.integer
|
189
|
-
t.string
|
190
|
-
t.datetime "created_at",
|
191
|
-
t.datetime "updated_at",
|
174
|
+
t.integer "user_id", null: false
|
175
|
+
t.integer "ownable_id"
|
176
|
+
t.string "ownable_type"
|
177
|
+
t.datetime "created_at", null: false
|
178
|
+
t.datetime "updated_at", null: false
|
179
|
+
t.index ["ownable_type", "ownable_id"], name: "index_roles_on_ownable_type_and_ownable_id"
|
180
|
+
t.index ["user_id", "ownable_type", "ownable_id"], name: "index_roles_on_user_id_and_ownable_type_and_ownable_id", unique: true
|
192
181
|
end
|
193
182
|
|
194
|
-
add_index "roles", ["ownable_type", "ownable_id"], name: "index_roles_on_ownable_type_and_ownable_id"
|
195
|
-
add_index "roles", ["user_id", "ownable_type", "ownable_id"], name: "index_roles_on_user_id_and_ownable_type_and_ownable_id", unique: true
|
196
|
-
|
197
183
|
create_table "team_users", force: :cascade do |t|
|
198
|
-
t.integer
|
199
|
-
t.integer
|
184
|
+
t.integer "user_id"
|
185
|
+
t.integer "team_id"
|
200
186
|
t.datetime "created_at", null: false
|
201
187
|
t.datetime "updated_at", null: false
|
188
|
+
t.index ["team_id"], name: "index_team_users_on_team_id"
|
189
|
+
t.index ["user_id", "team_id"], name: "index_team_users_on_user_id_and_team_id", unique: true
|
190
|
+
t.index ["user_id"], name: "index_team_users_on_user_id"
|
202
191
|
end
|
203
192
|
|
204
|
-
add_index "team_users", ["team_id"], name: "index_team_users_on_team_id"
|
205
|
-
add_index "team_users", ["user_id", "team_id"], name: "index_team_users_on_user_id_and_team_id", unique: true
|
206
|
-
add_index "team_users", ["user_id"], name: "index_team_users_on_user_id"
|
207
|
-
|
208
193
|
create_table "teams", force: :cascade do |t|
|
209
|
-
t.string
|
210
|
-
t.integer
|
211
|
-
t.integer
|
194
|
+
t.string "name"
|
195
|
+
t.integer "project_id"
|
196
|
+
t.integer "creator_id"
|
212
197
|
t.datetime "created_at", null: false
|
213
198
|
t.datetime "updated_at", null: false
|
199
|
+
t.index ["creator_id"], name: "index_teams_on_creator_id"
|
200
|
+
t.index ["project_id"], name: "index_teams_on_project_id"
|
214
201
|
end
|
215
202
|
|
216
|
-
add_index "teams", ["creator_id"], name: "index_teams_on_creator_id"
|
217
|
-
add_index "teams", ["project_id"], name: "index_teams_on_project_id"
|
218
|
-
|
219
203
|
create_table "user_locations", force: :cascade do |t|
|
220
|
-
t.integer
|
221
|
-
t.integer
|
222
|
-
t.integer
|
223
|
-
t.string
|
224
|
-
t.float
|
225
|
-
t.float
|
226
|
-
t.float
|
227
|
-
t.datetime "created_at",
|
228
|
-
t.datetime "updated_at",
|
204
|
+
t.integer "user_id"
|
205
|
+
t.integer "location_id"
|
206
|
+
t.integer "detectable_id"
|
207
|
+
t.string "detectable_type"
|
208
|
+
t.float "lat"
|
209
|
+
t.float "lng"
|
210
|
+
t.float "alt"
|
211
|
+
t.datetime "created_at", null: false
|
212
|
+
t.datetime "updated_at", null: false
|
213
|
+
t.index ["detectable_type", "detectable_id"], name: "index_user_locations_on_detectable_type_and_detectable_id"
|
214
|
+
t.index ["location_id"], name: "index_user_locations_on_location_id"
|
215
|
+
t.index ["user_id"], name: "index_user_locations_on_user_id"
|
229
216
|
end
|
230
217
|
|
231
|
-
add_index "user_locations", ["detectable_type", "detectable_id"], name: "index_user_locations_on_detectable_type_and_detectable_id"
|
232
|
-
add_index "user_locations", ["location_id"], name: "index_user_locations_on_location_id"
|
233
|
-
add_index "user_locations", ["user_id"], name: "index_user_locations_on_user_id"
|
234
|
-
|
235
218
|
create_table "user_project_jobs", force: :cascade do |t|
|
236
|
-
t.integer
|
237
|
-
t.integer
|
238
|
-
t.integer
|
219
|
+
t.integer "user_id", null: false
|
220
|
+
t.integer "project_id", null: false
|
221
|
+
t.integer "job_id", null: false
|
239
222
|
t.datetime "created_at", null: false
|
240
223
|
t.datetime "updated_at", null: false
|
224
|
+
t.index ["job_id"], name: "index_user_project_jobs_on_job_id"
|
225
|
+
t.index ["project_id"], name: "index_user_project_jobs_on_project_id"
|
226
|
+
t.index ["user_id", "project_id", "job_id"], name: "index_user_project_jobs_on_user_id_and_project_id_and_job_id", unique: true
|
227
|
+
t.index ["user_id"], name: "index_user_project_jobs_on_user_id"
|
241
228
|
end
|
242
229
|
|
243
|
-
add_index "user_project_jobs", ["job_id"], name: "index_user_project_jobs_on_job_id"
|
244
|
-
add_index "user_project_jobs", ["project_id"], name: "index_user_project_jobs_on_project_id"
|
245
|
-
add_index "user_project_jobs", ["user_id", "project_id", "job_id"], name: "index_user_project_jobs_on_user_id_and_project_id_and_job_id", unique: true
|
246
|
-
add_index "user_project_jobs", ["user_id"], name: "index_user_project_jobs_on_user_id"
|
247
|
-
|
248
230
|
create_table "users", force: :cascade do |t|
|
249
|
-
t.string
|
250
|
-
t.string
|
251
|
-
t.string
|
231
|
+
t.string "email", default: "", null: false
|
232
|
+
t.string "encrypted_password", default: "", null: false
|
233
|
+
t.string "reset_password_token"
|
252
234
|
t.datetime "reset_password_sent_at"
|
253
235
|
t.datetime "remember_created_at"
|
254
|
-
t.integer
|
236
|
+
t.integer "sign_in_count", default: 0, null: false
|
255
237
|
t.datetime "current_sign_in_at"
|
256
238
|
t.datetime "last_sign_in_at"
|
257
|
-
t.string
|
258
|
-
t.string
|
259
|
-
t.datetime "created_at",
|
260
|
-
t.datetime "updated_at",
|
261
|
-
t.integer
|
262
|
-
t.string
|
239
|
+
t.string "current_sign_in_ip"
|
240
|
+
t.string "last_sign_in_ip"
|
241
|
+
t.datetime "created_at", null: false
|
242
|
+
t.datetime "updated_at", null: false
|
243
|
+
t.integer "failed_attempts", default: 0, null: false
|
244
|
+
t.string "unlock_token"
|
263
245
|
t.datetime "locked_at"
|
264
|
-
t.boolean
|
265
|
-
t.string
|
266
|
-
t.string
|
246
|
+
t.boolean "superuser", default: false, null: false
|
247
|
+
t.string "authentication_token"
|
248
|
+
t.string "confirmation_token"
|
267
249
|
t.datetime "confirmed_at"
|
268
250
|
t.datetime "confirmation_sent_at"
|
269
|
-
t.string
|
270
|
-
t.string
|
271
|
-
t.string
|
251
|
+
t.string "unconfirmed_email"
|
252
|
+
t.string "first_name"
|
253
|
+
t.string "last_name"
|
254
|
+
t.index ["authentication_token"], name: "index_users_on_authentication_token", unique: true
|
255
|
+
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
256
|
+
t.index ["email"], name: "index_users_on_email", unique: true
|
257
|
+
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
272
258
|
end
|
273
259
|
|
274
|
-
add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", unique: true
|
275
|
-
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
276
|
-
add_index "users", ["email"], name: "index_users_on_email", unique: true
|
277
|
-
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
278
|
-
|
279
260
|
end
|