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.
Files changed (41) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +5 -52
  3. data/CHANGELOG.md +40 -0
  4. data/Gemfile +2 -0
  5. data/README.md +15 -0
  6. data/gemfiles/{Gemfile.rails.4.2.7.1 → Gemfile.rails.5.0.0} +5 -4
  7. data/gemfiles/Gemfile.rails.5.0.1 +1 -0
  8. data/gemfiles/{Gemfile.rails.4.2.7.1.new.swagger → Gemfile.rails.5.1.0} +5 -3
  9. data/gemfiles/{Gemfile.rails.3.2.22 → Gemfile.rails.5.2.0} +5 -4
  10. data/gemfiles/Gemfile.rails.master +1 -0
  11. data/introspective_grape.gemspec +13 -12
  12. data/lib/introspective_grape.rb +3 -1
  13. data/lib/introspective_grape/api.rb +36 -31
  14. data/lib/introspective_grape/camel_snake.rb +30 -31
  15. data/lib/introspective_grape/configuration.rb +15 -0
  16. data/lib/introspective_grape/create_helpers.rb +2 -2
  17. data/lib/introspective_grape/version.rb +1 -1
  18. data/spec/dummy/Gemfile +6 -3
  19. data/spec/dummy/app/api/api_helpers.rb +2 -0
  20. data/spec/dummy/app/api/dummy/company_api.rb +1 -1
  21. data/spec/dummy/app/models/role.rb +1 -1
  22. data/spec/dummy/app/models/user.rb +2 -2
  23. data/spec/dummy/config.ru +12 -0
  24. data/spec/dummy/config/application.rb +1 -1
  25. data/spec/dummy/config/environments/development.rb +3 -3
  26. data/spec/dummy/config/initializers/paperclip_adapter.rb +1 -1
  27. data/spec/dummy/db/migrate/20190325231304_add_test_data.rb +5 -0
  28. data/spec/dummy/db/schema.rb +154 -173
  29. data/spec/requests/chat_api_spec.rb +26 -26
  30. data/spec/requests/company_api_spec.rb +15 -15
  31. data/spec/requests/location_api_spec.rb +18 -18
  32. data/spec/requests/project_api_spec.rb +21 -21
  33. data/spec/requests/role_api_spec.rb +4 -4
  34. data/spec/requests/sessions_api_spec.rb +10 -10
  35. data/spec/requests/swagger_spec.rb +1 -1
  36. data/spec/requests/user_api_spec.rb +34 -36
  37. metadata +49 -51
  38. data/gemfiles/2.0.0-Gemfile +0 -22
  39. data/gemfiles/2.2.0-Gemfile +0 -21
  40. data/gemfiles/Gemfile.rails.4.1.13 +0 -13
  41. 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
@@ -1,3 +1,3 @@
1
1
  module IntrospectiveGrape
2
- VERSION = "0.3.5".freeze
2
+ VERSION = "0.4.1".freeze
3
3
  end
@@ -1,9 +1,10 @@
1
1
  source 'https://rubygems.org'
2
- gem 'rails', '<5.0'
2
+ gem 'rails'
3
3
 
4
4
  #gem 'byebug'
5
- #gem 'camel_snake_keys'
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 'sqlite3'
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: "user_id.nil?", message: "user has already been assigned that role"
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
@@ -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
- #require "sprockets/railtie"
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
@@ -1,6 +1,6 @@
1
1
  module Paperclip
2
2
  class HashUploadedFileAdapter < AbstractAdapter
3
- def initialize(target)
3
+ def initialize(target, args)
4
4
  @tempfile, @content_type, @size = target['tempfile'], target['type'], target['tempfile'].size
5
5
  @original_filename = target['filename']
6
6
  end
@@ -0,0 +1,5 @@
1
+ class AddTestData < ActiveRecord::Migration[5.2]
2
+ def change
3
+ User.create(email: 'test@test.com', superuser: true, authentication_token: '1234567890', first_name: "First", last_name: "Last")
4
+ end
5
+ end
@@ -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: 20150909225019) do
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 "namespace"
18
- t.text "body"
19
- t.string "resource_id", null: false
20
- t.string "resource_type", null: false
21
- t.integer "author_id"
22
- t.string "author_type"
23
- t.datetime "created_at", null: false
24
- t.datetime "updated_at", null: false
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 "email", default: "", null: false
33
- t.string "encrypted_password", default: "", null: false
34
- t.string "reset_password_token"
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 "sign_in_count", default: 0, null: false
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 "current_sign_in_ip"
41
- t.string "last_sign_in_ip"
42
- t.datetime "created_at", null: false
43
- t.datetime "updated_at", null: false
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 "chat_message_id"
51
- t.integer "user_id"
47
+ t.integer "chat_message_id"
48
+ t.integer "user_id"
52
49
  t.datetime "read_at"
53
- t.datetime "created_at", null: false
54
- t.datetime "updated_at", null: false
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 "chat_id"
62
- t.integer "author_id"
63
- t.text "message"
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 "chat_id"
73
- t.integer "user_id"
67
+ t.integer "chat_id"
68
+ t.integer "user_id"
74
69
  t.datetime "departed_at"
75
- t.datetime "created_at", null: false
76
- t.datetime "updated_at", null: false
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 "creator_id"
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 "name", limit: 256, null: false
90
- t.string "short_name", limit: 10, null: false
91
- t.datetime "created_at", null: false
92
- t.datetime "updated_at", null: false
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 "imageable_id"
99
- t.string "imageable_type"
100
- t.string "file_file_name"
101
- t.string "file_content_type"
102
- t.integer "file_file_size"
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 "file_processing", default: false, null: false
105
- t.text "meta"
106
- t.string "source"
107
- t.float "lat"
108
- t.float "lng"
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", null: false
111
- t.datetime "updated_at", null: false
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 "title", null: false
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 "location_id"
122
- t.integer "locatable_id"
123
- t.string "locatable_type"
124
- t.datetime "created_at", null: false
125
- t.datetime "updated_at", null: false
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 "location_id"
132
- t.integer "company_id", null: false
133
- t.string "mac_address", limit: 12
134
- t.string "uuid", limit: 32, null: false
135
- t.integer "major", null: false
136
- t.integer "minor", null: false
137
- t.datetime "created_at", null: false
138
- t.datetime "updated_at", null: false
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 "location_id"
145
- t.float "lat", null: false
146
- t.float "lng", null: false
147
- t.float "alt", default: 0.0
148
- t.datetime "created_at", null: false
149
- t.datetime "updated_at", null: false
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 "name", null: false
156
- t.string "kind"
157
- t.integer "parent_location_id"
158
- t.datetime "created_at", null: false
159
- t.datetime "updated_at", null: false
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 "project_id", null: false
167
- t.integer "job_id", null: false
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 "name", null: false
178
- t.integer "owner_id"
179
- t.datetime "created_at", null: false
180
- t.datetime "updated_at", null: false
181
- t.string "default_password"
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 "user_id", null: false
188
- t.integer "ownable_id"
189
- t.string "ownable_type"
190
- t.datetime "created_at", null: false
191
- t.datetime "updated_at", null: false
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 "user_id"
199
- t.integer "team_id"
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 "name"
210
- t.integer "project_id"
211
- t.integer "creator_id"
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 "user_id"
221
- t.integer "location_id"
222
- t.integer "detectable_id"
223
- t.string "detectable_type"
224
- t.float "lat"
225
- t.float "lng"
226
- t.float "alt"
227
- t.datetime "created_at", null: false
228
- t.datetime "updated_at", null: false
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 "user_id", null: false
237
- t.integer "project_id", null: false
238
- t.integer "job_id", null: false
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 "email", default: "", null: false
250
- t.string "encrypted_password", default: "", null: false
251
- t.string "reset_password_token"
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 "sign_in_count", default: 0, null: false
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 "current_sign_in_ip"
258
- t.string "last_sign_in_ip"
259
- t.datetime "created_at", null: false
260
- t.datetime "updated_at", null: false
261
- t.integer "failed_attempts", default: 0, null: false
262
- t.string "unlock_token"
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 "superuser", default: false, null: false
265
- t.string "authentication_token"
266
- t.string "confirmation_token"
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 "unconfirmed_email"
270
- t.string "first_name"
271
- t.string "last_name"
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