introspective_grape 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +35 -0
- data/Gemfile +15 -0
- data/MIT-LICENSE +20 -0
- data/README.md +103 -0
- data/Rakefile +26 -0
- data/app/assets/images/introspective_grape/.keep +0 -0
- data/app/assets/stylesheets/introspective_grape/.keep +0 -0
- data/app/controllers/.keep +0 -0
- data/app/helpers/.keep +0 -0
- data/app/mailers/.keep +0 -0
- data/app/models/.keep +0 -0
- data/app/views/.keep +0 -0
- data/bin/rails +12 -0
- data/introspective_grape.gemspec +49 -0
- data/lib/introspective_grape/api.rb +445 -0
- data/lib/introspective_grape/camel_snake.rb +71 -0
- data/lib/introspective_grape/version.rb +3 -0
- data/lib/introspective_grape.rb +4 -0
- data/lib/tasks/introspective_grape_tasks.rake +4 -0
- data/spec/dummy/Gemfile +4 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/api/active_record_helpers.rb +17 -0
- data/spec/dummy/app/api/api_helpers.rb +36 -0
- data/spec/dummy/app/api/dummy/chat_api.rb +108 -0
- data/spec/dummy/app/api/dummy/company_api.rb +8 -0
- data/spec/dummy/app/api/dummy/entities.rb +25 -0
- data/spec/dummy/app/api/dummy/location_api.rb +37 -0
- data/spec/dummy/app/api/dummy/project_api.rb +51 -0
- data/spec/dummy/app/api/dummy/role_api.rb +7 -0
- data/spec/dummy/app/api/dummy/sessions.rb +55 -0
- data/spec/dummy/app/api/dummy/user_api.rb +32 -0
- data/spec/dummy/app/api/dummy_api.rb +57 -0
- data/spec/dummy/app/api/error_handlers.rb +28 -0
- data/spec/dummy/app/api/permissions_helper.rb +7 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/abstract_adapter.rb +13 -0
- data/spec/dummy/app/models/admin_user.rb +6 -0
- data/spec/dummy/app/models/chat.rb +18 -0
- data/spec/dummy/app/models/chat_message.rb +34 -0
- data/spec/dummy/app/models/chat_message_user.rb +17 -0
- data/spec/dummy/app/models/chat_user.rb +16 -0
- data/spec/dummy/app/models/company.rb +14 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/image.rb +21 -0
- data/spec/dummy/app/models/job.rb +10 -0
- data/spec/dummy/app/models/locatable.rb +6 -0
- data/spec/dummy/app/models/location.rb +26 -0
- data/spec/dummy/app/models/location_beacon.rb +16 -0
- data/spec/dummy/app/models/location_gps.rb +14 -0
- data/spec/dummy/app/models/project.rb +20 -0
- data/spec/dummy/app/models/project_job.rb +7 -0
- data/spec/dummy/app/models/role.rb +30 -0
- data/spec/dummy/app/models/super_user.rb +11 -0
- data/spec/dummy/app/models/team.rb +9 -0
- data/spec/dummy/app/models/team_user.rb +13 -0
- data/spec/dummy/app/models/user/chatter.rb +79 -0
- data/spec/dummy/app/models/user.rb +84 -0
- data/spec/dummy/app/models/user_location.rb +28 -0
- data/spec/dummy/app/models/user_project_job.rb +16 -0
- data/spec/dummy/app/policies/application_policy.rb +47 -0
- data/spec/dummy/app/policies/chat_policy.rb +22 -0
- data/spec/dummy/app/policies/company_policy.rb +32 -0
- data/spec/dummy/app/policies/location_policy.rb +29 -0
- data/spec/dummy/app/policies/project_policy.rb +42 -0
- data/spec/dummy/app/policies/role_policy.rb +33 -0
- data/spec/dummy/app/policies/user_location_policy.rb +12 -0
- data/spec/dummy/app/policies/user_policy.rb +8 -0
- data/spec/dummy/app/views/layouts/application.html.erb +13 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config/application.rb +38 -0
- data/spec/dummy/config/boot.rb +6 -0
- data/spec/dummy/config/database.yml +23 -0
- data/spec/dummy/config/environment.rb +11 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +43 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/devise.rb +262 -0
- data/spec/dummy/config/initializers/devise_async.rb +2 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/paperclip.rb +13 -0
- data/spec/dummy/config/initializers/paperclip_adapter.rb +13 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/devise.en.yml +60 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +8 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/migrate/20141002205024_devise_create_users.rb +42 -0
- data/spec/dummy/db/migrate/20141002211055_devise_create_admin_users.rb +48 -0
- data/spec/dummy/db/migrate/20141002211057_create_active_admin_comments.rb +19 -0
- data/spec/dummy/db/migrate/20141002220722_add_lockable_to_users.rb +8 -0
- data/spec/dummy/db/migrate/20150406213646_create_companies.rb +11 -0
- data/spec/dummy/db/migrate/20150414213154_add_user_authentication_token.rb +11 -0
- data/spec/dummy/db/migrate/20150415222005_create_roles.rb +12 -0
- data/spec/dummy/db/migrate/20150505181635_create_chats.rb +9 -0
- data/spec/dummy/db/migrate/20150505181636_create_chat_users.rb +11 -0
- data/spec/dummy/db/migrate/20150505181640_create_chat_messages.rb +11 -0
- data/spec/dummy/db/migrate/20150507191529_create_chat_message_users.rb +11 -0
- data/spec/dummy/db/migrate/20150601200526_create_locations.rb +12 -0
- data/spec/dummy/db/migrate/20150601200533_create_locatables.rb +10 -0
- data/spec/dummy/db/migrate/20150601212924_create_location_beacons.rb +15 -0
- data/spec/dummy/db/migrate/20150601213542_create_location_gps.rb +12 -0
- data/spec/dummy/db/migrate/20150609201823_create_user_locations.rb +14 -0
- data/spec/dummy/db/migrate/20150616205336_add_role_user_constraint.rb +9 -0
- data/spec/dummy/db/migrate/20150617232519_create_projects.rb +10 -0
- data/spec/dummy/db/migrate/20150617232521_create_jobs.rb +9 -0
- data/spec/dummy/db/migrate/20150617232522_create_project_jobs.rb +11 -0
- data/spec/dummy/db/migrate/20150623170133_create_user_project_jobs.rb +12 -0
- data/spec/dummy/db/migrate/20150701234929_create_teams.rb +11 -0
- data/spec/dummy/db/migrate/20150701234930_create_team_users.rb +11 -0
- data/spec/dummy/db/migrate/20150727214950_add_confirmable_to_devise.rb +11 -0
- data/spec/dummy/db/migrate/20150820190524_add_user_names.rb +6 -0
- data/spec/dummy/db/migrate/20150824215701_create_images.rb +15 -0
- data/spec/dummy/db/migrate/20150909225019_add_password_to_project.rb +5 -0
- data/spec/dummy/db/schema.rb +278 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/fixtures/images/avatar.jpeg +0 -0
- data/spec/fixtures/images/exif.jpeg +0 -0
- data/spec/models/chat_spec.rb +32 -0
- data/spec/models/image_spec.rb +14 -0
- data/spec/models/locatable_spec.rb +10 -0
- data/spec/models/project_spec.rb +17 -0
- data/spec/models/role_spec.rb +63 -0
- data/spec/models/team_spec.rb +17 -0
- data/spec/models/team_user_spec.rb +20 -0
- data/spec/models/user_location_spec.rb +35 -0
- data/spec/models/user_project_job_spec.rb +30 -0
- data/spec/models/user_spec.rb +125 -0
- data/spec/rails_helper.rb +23 -0
- data/spec/requests/chat_api_spec.rb +174 -0
- data/spec/requests/company_api_spec.rb +61 -0
- data/spec/requests/location_api_spec.rb +96 -0
- data/spec/requests/project_api_spec.rb +151 -0
- data/spec/requests/role_api_spec.rb +37 -0
- data/spec/requests/sessions_api_spec.rb +55 -0
- data/spec/requests/user_api_spec.rb +191 -0
- data/spec/support/blueprints.rb +103 -0
- data/spec/support/location_helper.rb +56 -0
- data/spec/support/pundit_helpers.rb +13 -0
- data/spec/support/request_helpers.rb +22 -0
- metadata +562 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
|
2
|
+
|
3
|
+
en:
|
4
|
+
devise:
|
5
|
+
confirmations:
|
6
|
+
confirmed: "Your email address has been successfully confirmed."
|
7
|
+
send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
|
8
|
+
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
|
9
|
+
failure:
|
10
|
+
already_authenticated: "You are already signed in."
|
11
|
+
inactive: "Your account is not activated yet."
|
12
|
+
invalid: "Invalid %{authentication_keys} or password."
|
13
|
+
locked: "Your account is locked."
|
14
|
+
last_attempt: "You have one more attempt before your account is locked."
|
15
|
+
not_found_in_database: "Invalid %{authentication_keys} or password."
|
16
|
+
timeout: "Your session expired. Please sign in again to continue."
|
17
|
+
unauthenticated: "You need to sign in or sign up before continuing."
|
18
|
+
unconfirmed: "You have to confirm your email address before continuing."
|
19
|
+
mailer:
|
20
|
+
confirmation_instructions:
|
21
|
+
subject: "Confirmation instructions"
|
22
|
+
reset_password_instructions:
|
23
|
+
subject: "Reset password instructions"
|
24
|
+
unlock_instructions:
|
25
|
+
subject: "Unlock instructions"
|
26
|
+
omniauth_callbacks:
|
27
|
+
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
|
28
|
+
success: "Successfully authenticated from %{kind} account."
|
29
|
+
passwords:
|
30
|
+
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
|
31
|
+
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
|
32
|
+
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
33
|
+
updated: "Your password has been changed successfully. You are now signed in."
|
34
|
+
updated_not_active: "Your password has been changed successfully."
|
35
|
+
registrations:
|
36
|
+
destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
|
37
|
+
signed_up: "Welcome! You have signed up successfully."
|
38
|
+
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
|
39
|
+
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
|
40
|
+
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
|
41
|
+
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
|
42
|
+
updated: "Your account has been updated successfully."
|
43
|
+
sessions:
|
44
|
+
signed_in: "Signed in successfully."
|
45
|
+
signed_out: "Signed out successfully."
|
46
|
+
already_signed_out: "Signed out successfully."
|
47
|
+
unlocks:
|
48
|
+
send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
|
49
|
+
send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
|
50
|
+
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
|
51
|
+
errors:
|
52
|
+
messages:
|
53
|
+
already_confirmed: "was already confirmed, please try signing in"
|
54
|
+
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
|
55
|
+
expired: "has expired, please request a new one"
|
56
|
+
not_found: "not found"
|
57
|
+
not_locked: "was not locked"
|
58
|
+
not_saved:
|
59
|
+
one: "1 error prohibited this %{resource} from being saved:"
|
60
|
+
other: "%{count} errors prohibited this %{resource} from being saved:"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
hello: "Hello world"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure the secrets in this file are kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
|
13
|
+
development:
|
14
|
+
secret_key_base: ca9d4587a556cfc28464dcf7f9d73b396e53b814cd339a469bc817011485510d3a9d1d6a7fa08f65cce65bcd55727a7110de0077a952f50ce58a956b255c6903
|
15
|
+
|
16
|
+
test:
|
17
|
+
secret_key_base: ca9d4587a556cfc28464dcf7f9d73b396e53b814cd339a469bc817011485510d3a9d1d6a7fa08f65cce65bcd55727a7110de0077a952f50ce58a956b255c6903
|
18
|
+
|
19
|
+
# Do not keep production secrets in the repository,
|
20
|
+
# instead read values from the environment.
|
21
|
+
production:
|
22
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class DeviseCreateUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table(:users) do |t|
|
4
|
+
## Database authenticatable
|
5
|
+
t.string :email, null: false, default: ""
|
6
|
+
t.string :encrypted_password, null: false, default: ""
|
7
|
+
|
8
|
+
## Recoverable
|
9
|
+
t.string :reset_password_token
|
10
|
+
t.datetime :reset_password_sent_at
|
11
|
+
|
12
|
+
## Rememberable
|
13
|
+
t.datetime :remember_created_at
|
14
|
+
|
15
|
+
## Trackable
|
16
|
+
t.integer :sign_in_count, default: 0, null: false
|
17
|
+
t.datetime :current_sign_in_at
|
18
|
+
t.datetime :last_sign_in_at
|
19
|
+
t.inet :current_sign_in_ip
|
20
|
+
t.inet :last_sign_in_ip
|
21
|
+
|
22
|
+
## Confirmable
|
23
|
+
# t.string :confirmation_token
|
24
|
+
# t.datetime :confirmed_at
|
25
|
+
# t.datetime :confirmation_sent_at
|
26
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
27
|
+
|
28
|
+
## Lockable
|
29
|
+
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
30
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
31
|
+
# t.datetime :locked_at
|
32
|
+
|
33
|
+
|
34
|
+
t.timestamps null: false
|
35
|
+
end
|
36
|
+
|
37
|
+
add_index :users, :email, unique: true
|
38
|
+
add_index :users, :reset_password_token, unique: true
|
39
|
+
# add_index :users, :confirmation_token, unique: true
|
40
|
+
# add_index :users, :unlock_token, unique: true
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class DeviseCreateAdminUsers < ActiveRecord::Migration
|
2
|
+
def migrate(direction)
|
3
|
+
super
|
4
|
+
# Create a default user
|
5
|
+
AdminUser.create!(email: 'admin@example.com', password: 'password', password_confirmation: 'password') if direction == :up
|
6
|
+
end
|
7
|
+
|
8
|
+
def change
|
9
|
+
create_table(:admin_users) do |t|
|
10
|
+
## Database authenticatable
|
11
|
+
t.string :email, null: false, default: ""
|
12
|
+
t.string :encrypted_password, null: false, default: ""
|
13
|
+
|
14
|
+
## Recoverable
|
15
|
+
t.string :reset_password_token
|
16
|
+
t.datetime :reset_password_sent_at
|
17
|
+
|
18
|
+
## Rememberable
|
19
|
+
t.datetime :remember_created_at
|
20
|
+
|
21
|
+
## Trackable
|
22
|
+
t.integer :sign_in_count, default: 0, null: false
|
23
|
+
t.datetime :current_sign_in_at
|
24
|
+
t.datetime :last_sign_in_at
|
25
|
+
t.inet :current_sign_in_ip
|
26
|
+
t.inet :last_sign_in_ip
|
27
|
+
|
28
|
+
## Confirmable
|
29
|
+
# t.string :confirmation_token
|
30
|
+
# t.datetime :confirmed_at
|
31
|
+
# t.datetime :confirmation_sent_at
|
32
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
33
|
+
|
34
|
+
## Lockable
|
35
|
+
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
36
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
37
|
+
# t.datetime :locked_at
|
38
|
+
|
39
|
+
|
40
|
+
t.timestamps null: false
|
41
|
+
end
|
42
|
+
|
43
|
+
add_index :admin_users, :email, unique: true
|
44
|
+
add_index :admin_users, :reset_password_token, unique: true
|
45
|
+
# add_index :admin_users, :confirmation_token, unique: true
|
46
|
+
# add_index :admin_users, :unlock_token, unique: true
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateActiveAdminComments < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :active_admin_comments do |t|
|
4
|
+
t.string :namespace
|
5
|
+
t.text :body
|
6
|
+
t.string :resource_id, null: false, foreign_key: false
|
7
|
+
t.string :resource_type, null: false
|
8
|
+
t.references :author, polymorphic: true
|
9
|
+
t.timestamps null: false
|
10
|
+
end
|
11
|
+
add_index :active_admin_comments, [:namespace]
|
12
|
+
add_index :active_admin_comments, [:author_type, :author_id]
|
13
|
+
add_index :active_admin_comments, [:resource_type, :resource_id]
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
drop_table :active_admin_comments
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateCompanies < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :companies do |t|
|
4
|
+
t.string :name, limit: 256, null: false
|
5
|
+
t.string :short_name, limit: 10, null: false
|
6
|
+
|
7
|
+
t.timestamps null: false
|
8
|
+
end
|
9
|
+
add_index :companies, :name, unique: true
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class AddUserAuthenticationToken < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :users, :authentication_token, :string
|
4
|
+
add_index :users, :authentication_token, :unique => true
|
5
|
+
end
|
6
|
+
|
7
|
+
def down
|
8
|
+
remove_index :users, :authentication_token
|
9
|
+
remove_column :users, :authentication_token
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateRoles < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :roles do |t|
|
4
|
+
t.integer :user_id
|
5
|
+
t.references :ownable, polymorphic: true, index: true
|
6
|
+
|
7
|
+
t.timestamps null: false
|
8
|
+
end
|
9
|
+
add_index :roles, [:user_id,:ownable_type,:ownable_id], unique: true
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateChatUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :chat_users do |t|
|
4
|
+
t.references :chat, chat: true, index: true, foreign_key: true
|
5
|
+
t.references :user, index: true, foreign_key: false
|
6
|
+
t.datetime :departed_at
|
7
|
+
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateChatMessages < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :chat_messages do |t|
|
4
|
+
t.references :chat, chat: true, index: true, foreign_key: true
|
5
|
+
t.integer :author_id, references: :users, index: true, foreign_key: false
|
6
|
+
t.text :message
|
7
|
+
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateChatMessageUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :chat_message_users do |t|
|
4
|
+
t.references :chat_message, index: true, foreign_key: true
|
5
|
+
t.references :user, index: true, foreign_key: false
|
6
|
+
t.timestamp :read_at
|
7
|
+
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateLocations < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :locations do |t|
|
4
|
+
t.string :name, null: false
|
5
|
+
t.string :kind
|
6
|
+
t.integer :parent_location_id, index: true, foreign_key: false
|
7
|
+
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
add_index :locations, [:parent_location_id,:kind,:name], unique: true
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateLocationBeacons < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :location_beacons do |t|
|
4
|
+
t.references :location
|
5
|
+
t.references :company, null: false
|
6
|
+
t.string :mac_address, limit: 12
|
7
|
+
t.string :uuid, null: false, limit: 32
|
8
|
+
t.integer :major, null: false
|
9
|
+
t.integer :minor, null: false
|
10
|
+
|
11
|
+
t.timestamps null: false
|
12
|
+
end
|
13
|
+
add_index :location_beacons, [:company_id,:uuid,:major,:minor], name: "index_location_beacons_unique_company_identifier", unique: true
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateLocationGps < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :location_gps do |t|
|
4
|
+
t.references :location, index: true, foreign_key: true
|
5
|
+
t.float :lat, null: false
|
6
|
+
t.float :lng, null: false
|
7
|
+
t.float :alt, default: 0
|
8
|
+
|
9
|
+
t.timestamps null: false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateUserLocations < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :user_locations do |t|
|
4
|
+
t.references :user, index: true, foreign_key: true
|
5
|
+
t.references :location, index: true, foreign_key: true
|
6
|
+
t.references :detectable, polymorphic: true, index: true
|
7
|
+
t.float :lat
|
8
|
+
t.float :lng
|
9
|
+
t.float :alt
|
10
|
+
|
11
|
+
t.timestamps null: false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateProjectJobs < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :project_jobs do |t|
|
4
|
+
t.references :project, index: true, null: false, foreign_key: true
|
5
|
+
t.references :job, index: true, null: false, foreign_key: true
|
6
|
+
|
7
|
+
t.timestamps null: false
|
8
|
+
end
|
9
|
+
add_index :project_jobs, [:project_id,:job_id], unique: true
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateUserProjectJobs < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :user_project_jobs do |t|
|
4
|
+
t.references :user, index: true, foreign_key: true, null: false
|
5
|
+
t.references :project, index: true, foreign_key: true, null: false
|
6
|
+
t.references :job, index: true, foreign_key: true, null: false
|
7
|
+
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
add_index :user_project_jobs, [:user_id,:project_id,:job_id], unique: true
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateTeams < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :teams do |t|
|
4
|
+
t.string :name
|
5
|
+
t.references :project, index: true, foreign_key: true
|
6
|
+
t.references :creator, references: :users, index: true, foreign_key: true
|
7
|
+
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateTeamUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :team_users do |t|
|
4
|
+
t.references :user, index: true, foreign_key: true
|
5
|
+
t.references :team, index: true, foreign_key: true
|
6
|
+
|
7
|
+
t.timestamps null: false
|
8
|
+
end
|
9
|
+
add_index :team_users, [:user_id,:team_id], unique: true
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class AddConfirmableToDevise < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
change_table(:users) do |t|
|
4
|
+
t.string :confirmation_token
|
5
|
+
t.datetime :confirmed_at
|
6
|
+
t.datetime :confirmation_sent_at
|
7
|
+
t.string :unconfirmed_email
|
8
|
+
end
|
9
|
+
add_index :users, :confirmation_token, unique: true
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateImages < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :images do |t|
|
4
|
+
t.references :imageable, polymorphic: true, index: true
|
5
|
+
t.attachment :file
|
6
|
+
t.boolean :file_processing, null: false, default: false
|
7
|
+
t.json :meta
|
8
|
+
t.string :source
|
9
|
+
t.float :lat
|
10
|
+
t.float :lng
|
11
|
+
t.timestamp :taken_at
|
12
|
+
t.timestamps null: false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|