jobshop 0.0.107 → 0.0.109
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/jobshop/places_controller.rb +13 -0
- data/app/controllers/jobshop/session_activations_controller.rb +13 -0
- data/app/models/jobshop/session_activation.rb +30 -0
- data/app/models/jobshop/user.rb +4 -4
- data/app/views/jobshop/places/show.html.haml +22 -0
- data/app/views/jobshop/session_activations/destroy.js.erb +1 -0
- data/app/views/jobshop/setups/show.html.haml +12 -42
- data/config/routes.rb +4 -2
- data/db/migrate/20170311194758_initialize_jobshop.rb +84 -0
- data/lib/jobshop/engine.rb +5 -4
- data/lib/jobshop/version.rb +1 -1
- metadata +12 -18
- data/app/models/jobshop/active_session.rb +0 -30
- data/db/migrate/20160314122952_devise_create_jobshop_users.rb +0 -44
- data/db/migrate/20160314190424_create_jobshop_sites.rb +0 -13
- data/db/migrate/20160321212058_add_site_id_to_users.rb +0 -5
- data/db/migrate/20160321213638_add_foreign_key_for_site.rb +0 -6
- data/db/migrate/20160322040604_add_owner_id_to_sites.rb +0 -7
- data/db/migrate/20160323132658_rename_configuration_token_to_registration_token.rb +0 -9
- data/db/migrate/20160417210218_create_jobshop_dashboards.rb +0 -15
- data/db/migrate/20160425062447_rename_site_to_team.rb +0 -30
- data/db/migrate/20160718130211_reindex_jobshop_users_by_email_and_team_id.rb +0 -6
- data/db/migrate/20160720201947_add_authentication_token_to_jobshop_users.rb +0 -6
- data/db/migrate/20170309001357_create_jobshop_active_sessions.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96900cedcbdfb9e09aae0067c308a82f31fc6e4a
|
4
|
+
data.tar.gz: c6a7cd552d51c9925c8d4590c97a326290232862
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 612ada9d81256c782decccdc72065ac59ef4811c7f3864d06dd0ce206270205d339ef86fd19733a46cbc8533012e2c19e38873beecb5ba35054b9da7145f99fb
|
7
|
+
data.tar.gz: 68570e717e4e1fa8c152836213a62e6471b9b2ea2ef5390e5db1a18e05608add3812c7c776cf5d9528762fd7b8a55d5276ca253c13e5b5b7c07aed5f360f9a20
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_dependency "jobshop/application_controller"
|
2
|
+
|
3
|
+
module Jobshop
|
4
|
+
class PlacesController < ApplicationController
|
5
|
+
def show
|
6
|
+
console
|
7
|
+
end
|
8
|
+
|
9
|
+
private def session_activations
|
10
|
+
current_user.session_activations
|
11
|
+
end; helper_method :session_activations
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_dependency "jobshop/application_controller"
|
2
|
+
|
3
|
+
module Jobshop
|
4
|
+
class SessionActivationsController < ApplicationController
|
5
|
+
def destroy
|
6
|
+
revoked_session.destroy
|
7
|
+
end
|
8
|
+
|
9
|
+
private def revoked_session
|
10
|
+
@revoked_session ||= current_user.session_activations.find(params[:id])
|
11
|
+
end; helper_method :revoked_session
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Jobshop
|
2
|
+
class SessionActivation < ApplicationRecord
|
3
|
+
LIMIT = 20
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def active?(token)
|
7
|
+
token && where(activation_token: token).exists?
|
8
|
+
end
|
9
|
+
|
10
|
+
def activate(token)
|
11
|
+
activation = create!(activation_token: token)
|
12
|
+
enforce_active_session_quota
|
13
|
+
activation
|
14
|
+
end
|
15
|
+
|
16
|
+
def deactivate(token)
|
17
|
+
return unless token
|
18
|
+
where(activation_token: token).delete_all
|
19
|
+
end
|
20
|
+
|
21
|
+
def enforce_active_session_quota
|
22
|
+
order("created_at desc").offset(LIMIT).destroy_all
|
23
|
+
end
|
24
|
+
|
25
|
+
def exclusive(token)
|
26
|
+
where("activation_token != ?", id).delete_all
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/app/models/jobshop/user.rb
CHANGED
@@ -6,7 +6,7 @@ module Jobshop
|
|
6
6
|
|
7
7
|
belongs_to :team, optional: true
|
8
8
|
has_one :default_dashboard, class_name: "Jobshop::Dashboard", through: :team
|
9
|
-
has_many :
|
9
|
+
has_many :session_activations, dependent: :destroy
|
10
10
|
|
11
11
|
validates :email,
|
12
12
|
presence: { if: :email_required? },
|
@@ -28,15 +28,15 @@ module Jobshop
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def activate_session
|
31
|
-
|
31
|
+
session_activations.activate(SecureRandom.hex).activation_token
|
32
32
|
end
|
33
33
|
|
34
34
|
def exclusive_session(id)
|
35
|
-
|
35
|
+
session_activations.exclusive(id)
|
36
36
|
end
|
37
37
|
|
38
38
|
def session_active?(id)
|
39
|
-
|
39
|
+
session_activations.active?(id)
|
40
40
|
end
|
41
41
|
|
42
42
|
private
|
@@ -0,0 +1,22 @@
|
|
1
|
+
%div.mdl-layout.mdl-js-layout.mdl-layout--fixed-header
|
2
|
+
%header.mdl-layout__header.mdl-layout__header--waterfall
|
3
|
+
%div.mdl-layout__header-row
|
4
|
+
%a.mdl-layout-title(href="#{jobshop.root_path}") Jobshop
|
5
|
+
%div.mdl-layout-spacer
|
6
|
+
%div.static-navigation-container
|
7
|
+
%nav.mdl-navigation
|
8
|
+
%a.mdl-navigation__link{ href: jobshop.about_path }
|
9
|
+
About
|
10
|
+
%a.mdl-navigation__link.mdl-color-text--pink{ href: jobshop.teams_lookup_path }
|
11
|
+
Sign In
|
12
|
+
|
13
|
+
%main
|
14
|
+
%div
|
15
|
+
You are currently logged in at these stations:
|
16
|
+
%ul
|
17
|
+
- session_activations.each do |s|
|
18
|
+
%li{ id: s.id }
|
19
|
+
%p
|
20
|
+
= s.id
|
21
|
+
= "(current)" if s.activation_token == session[:activation_token]
|
22
|
+
%p= link_to "log this out", revoke_session_path(s), remote: true, method: :delete, data: { confirm: "Are you sure you want to log out of the selected session?" }
|
@@ -0,0 +1 @@
|
|
1
|
+
$("li#<%= revoked_session.id %>").remove();
|
@@ -1,45 +1,15 @@
|
|
1
|
-
%div
|
2
|
-
%header
|
3
|
-
%div
|
4
|
-
%
|
5
|
-
%div
|
6
|
-
%div
|
7
|
-
%
|
8
|
-
%
|
9
|
-
|
10
|
-
%
|
11
|
-
|
12
|
-
%button(class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon" id="hdrbtn")
|
13
|
-
%i(class="material-icons") more_vert
|
14
|
-
%ul(class="mdl-menu mdl-js-menu mdl-js-ripple-effect mdl-menu--bottom-right" for="hdrbtn")
|
15
|
-
%li(class="mdl-menu__item")= link_to("About", about_path)
|
16
|
-
%li(class="mdl-menu__item") Contact
|
17
|
-
%li(class="mdl-menu__item") Legal information
|
18
|
-
%div(class="demo-drawer mdl-layout__drawer mdl-color--blue-grey-900 mdl-color-text--indigo-50")
|
19
|
-
%header(class="demo-drawer-header")
|
20
|
-
%i(class="material-icons" style="font-size: 48px;") person
|
21
|
-
//%img(class="demo-avatar" src="images/user.jpg")
|
22
|
-
%div(class="demo-avatar-dropdown")
|
23
|
-
%span= current_user.email
|
24
|
-
%div(class="mdl-layout-spacer")
|
25
|
-
%button(id="accbtn" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon")
|
26
|
-
%i(class="material-icons" role="presentation") arrow_drop_down
|
27
|
-
%span(class="visuallyhidden") User Actions
|
28
|
-
%ul(class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="accbtn")
|
29
|
-
%li(class="mdl-menu__item")
|
30
|
-
%a(href="#{destroy_user_session_path}" data-method="delete") Sign out
|
31
|
-
%nav(class="demo-navigation mdl-navigation mdl-color--blue-grey-800")
|
32
|
-
%a(class="mdl-navigation__link" href="#{root_path}")
|
33
|
-
%i(class="mdl-color-text--blue-grey-400 material-icons" role="presentation") home
|
34
|
-
Home
|
35
|
-
%a(class="mdl-navigation__link" href="")
|
36
|
-
%i(class="mdl-color-text--blue-grey-400 material-icons" role="presentation") flag
|
37
|
-
Updates
|
38
|
-
%div(class="mdl-layout-spacer")
|
39
|
-
%a(class="mdl-navigation__link" href="")
|
40
|
-
%i(class="mdl-color-text--blue-grey-400 material-icons" role="presentation") help_outline
|
41
|
-
Help
|
1
|
+
%div.mdl-layout.mdl-js-layout.mdl-layout--fixed-header
|
2
|
+
%header.mdl-layout__header.mdl-layout__header--waterfall
|
3
|
+
%div.mdl-layout__header-row
|
4
|
+
%a.mdl-layout-title(href="#{jobshop.root_path}") Jobshop
|
5
|
+
%div.mdl-layout-spacer
|
6
|
+
%div.static-navigation-container
|
7
|
+
%nav.mdl-navigation
|
8
|
+
%a.mdl-navigation__link{ href: jobshop.about_path }
|
9
|
+
About
|
10
|
+
%a.mdl-navigation__link.mdl-color-text--pink{ href: jobshop.teams_lookup_path }
|
11
|
+
Sign In
|
42
12
|
|
43
|
-
%main
|
13
|
+
%main
|
44
14
|
%div(class="mdl-grid demo-content")
|
45
15
|
Welcome Aboard
|
data/config/routes.rb
CHANGED
@@ -5,6 +5,7 @@ Jobshop::Engine.routes.draw do
|
|
5
5
|
get "teams/:team_id/sign_in" => "sessions#new", as: :new_user_session
|
6
6
|
post "teams/:team_id/sign_in" => "sessions#create", as: :user_session
|
7
7
|
delete "/sign_out" => "sessions#destroy", as: :destroy_user_session
|
8
|
+
delete "/revoke(/:id)" => "session_activations#destroy", as: :revoke_session
|
8
9
|
end
|
9
10
|
|
10
11
|
resources :teams, only: [ ] do
|
@@ -17,9 +18,10 @@ Jobshop::Engine.routes.draw do
|
|
17
18
|
controller: "teams/registrations"
|
18
19
|
end
|
19
20
|
|
20
|
-
get "/setup"
|
21
|
+
get "/setup" => "setups#show", as: :team_setup
|
22
|
+
get "/places" => "places#show"
|
21
23
|
|
22
|
-
get "/about" => redirect("https://jobshop
|
24
|
+
get "/about" => redirect("https://github.com/jobshop/jobshop"), as: :about
|
23
25
|
|
24
26
|
root to: "dashboards#show"
|
25
27
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
class InitializeJobshop < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
enable_extension "pgcrypto" unless extension_enabled?("pgcrypto")
|
4
|
+
|
5
|
+
create_table :jobshop_users,
|
6
|
+
id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
7
|
+
## Database authenticatable
|
8
|
+
t.string :email, null: false, default: ""
|
9
|
+
t.string :encrypted_password, null: false, default: ""
|
10
|
+
|
11
|
+
## Recoverable
|
12
|
+
t.string :reset_password_token
|
13
|
+
t.datetime :reset_password_sent_at
|
14
|
+
|
15
|
+
## Rememberable
|
16
|
+
t.datetime :remember_created_at
|
17
|
+
|
18
|
+
## Trackable
|
19
|
+
# t.integer :sign_in_count, default: 0, null: false
|
20
|
+
# t.datetime :current_sign_in_at
|
21
|
+
# t.datetime :last_sign_in_at
|
22
|
+
# t.string :current_sign_in_ip
|
23
|
+
# t.string :last_sign_in_ip
|
24
|
+
|
25
|
+
## Confirmable
|
26
|
+
# t.string :confirmation_token
|
27
|
+
# t.datetime :confirmed_at
|
28
|
+
# t.datetime :confirmation_sent_at
|
29
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
30
|
+
|
31
|
+
## Lockable
|
32
|
+
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
33
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
34
|
+
# t.datetime :locked_at
|
35
|
+
|
36
|
+
t.uuid :team_id
|
37
|
+
t.string :email_authentication_token
|
38
|
+
t.datetime :email_authentication_token_sent_at, :datetime
|
39
|
+
t.timestamps null: false
|
40
|
+
end
|
41
|
+
|
42
|
+
add_index :jobshop_users, [ :email, :team_id ], unique: true
|
43
|
+
add_index :jobshop_users, :reset_password_token, unique: true
|
44
|
+
# add_index :jobshop_users, :confirmation_token, unique: true
|
45
|
+
# add_index :jobshop_users, :unlock_token, unique: true
|
46
|
+
|
47
|
+
create_table :jobshop_teams,
|
48
|
+
id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
49
|
+
t.string :name
|
50
|
+
t.uuid :owner_id
|
51
|
+
t.string :registration_token
|
52
|
+
t.datetime :registration_token_sent_at
|
53
|
+
t.timestamps
|
54
|
+
end
|
55
|
+
|
56
|
+
add_index :jobshop_teams, [ "registration_token" ], unique: true
|
57
|
+
|
58
|
+
add_foreign_key :jobshop_users,
|
59
|
+
:jobshop_teams, column: "team_id", on_delete: :cascade
|
60
|
+
|
61
|
+
add_foreign_key :jobshop_teams,
|
62
|
+
:jobshop_users, column: "owner_id", on_delete: :restrict
|
63
|
+
|
64
|
+
create_table :jobshop_dashboards,
|
65
|
+
id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
66
|
+
t.uuid :team_id
|
67
|
+
t.timestamps
|
68
|
+
end
|
69
|
+
|
70
|
+
add_foreign_key :jobshop_dashboards,
|
71
|
+
:jobshop_teams, column: "team_id", on_delete: :cascade
|
72
|
+
|
73
|
+
create_table :jobshop_session_activations,
|
74
|
+
id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
75
|
+
t.uuid :user_id, null: false
|
76
|
+
t.string :activation_token
|
77
|
+
|
78
|
+
t.timestamps
|
79
|
+
end
|
80
|
+
|
81
|
+
add_index :jobshop_session_activations, :user_id
|
82
|
+
add_index :jobshop_session_activations, :activation_token, unique: true
|
83
|
+
end
|
84
|
+
end
|
data/lib/jobshop/engine.rb
CHANGED
@@ -40,19 +40,20 @@ module Jobshop
|
|
40
40
|
|
41
41
|
initializer "jobshop.active_sessions", after: :load_config_initializers do
|
42
42
|
Warden::Manager.after_set_user except: :fetch do |user, warden, opts|
|
43
|
-
|
44
|
-
warden.raw_session["
|
43
|
+
SessionActivation.deactivate(warden.raw_session["activation_token"])
|
44
|
+
warden.raw_session["activation_token"] = user.activate_session
|
45
|
+
#warden.cookies.permanent.encrypted[:_jobshop_place_id]
|
45
46
|
end
|
46
47
|
|
47
48
|
Warden::Manager.after_fetch do |user, warden, opts|
|
48
|
-
unless user.session_active?(warden.raw_session["
|
49
|
+
unless user.session_active?(warden.raw_session["activation_token"])
|
49
50
|
warden.logout
|
50
51
|
throw :warden, message: :unauthenticated
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
54
55
|
Warden::Manager.before_logout do |user, warden, opts|
|
55
|
-
|
56
|
+
SessionActivation.deactivate warden.raw_session["activation_token"]
|
56
57
|
end
|
57
58
|
end
|
58
59
|
end
|
data/lib/jobshop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jobshop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.109
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank J. Mattia
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-rails
|
@@ -112,16 +112,16 @@ dependencies:
|
|
112
112
|
name: redis-rails
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 5.0.1
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 5.0.1
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rolify
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -340,6 +340,8 @@ files:
|
|
340
340
|
- app/controllers/concerns/registration_token_validation.rb
|
341
341
|
- app/controllers/jobshop/application_controller.rb
|
342
342
|
- app/controllers/jobshop/dashboards_controller.rb
|
343
|
+
- app/controllers/jobshop/places_controller.rb
|
344
|
+
- app/controllers/jobshop/session_activations_controller.rb
|
343
345
|
- app/controllers/jobshop/sessions_controller.rb
|
344
346
|
- app/controllers/jobshop/setups_controller.rb
|
345
347
|
- app/controllers/jobshop/teams/lookups_controller.rb
|
@@ -349,10 +351,10 @@ files:
|
|
349
351
|
- app/jobs/jobshop/application_job.rb
|
350
352
|
- app/mailers/jobshop/application_mailer.rb
|
351
353
|
- app/mailers/jobshop/teams_mailer.rb
|
352
|
-
- app/models/jobshop/active_session.rb
|
353
354
|
- app/models/jobshop/application_record.rb
|
354
355
|
- app/models/jobshop/dashboard.rb
|
355
356
|
- app/models/jobshop/registration.rb
|
357
|
+
- app/models/jobshop/session_activation.rb
|
356
358
|
- app/models/jobshop/team.rb
|
357
359
|
- app/models/jobshop/user.rb
|
358
360
|
- app/models/jobshop/virtual_record.rb
|
@@ -370,6 +372,8 @@ files:
|
|
370
372
|
- app/views/devise/shared/_links.html.haml
|
371
373
|
- app/views/devise/unlocks/new.html.haml
|
372
374
|
- app/views/jobshop/dashboards/show.html.haml
|
375
|
+
- app/views/jobshop/places/show.html.haml
|
376
|
+
- app/views/jobshop/session_activations/destroy.js.erb
|
373
377
|
- app/views/jobshop/setups/show.html.haml
|
374
378
|
- app/views/jobshop/teams/lookups/show.html.haml
|
375
379
|
- app/views/jobshop/teams/registrations/new.html.haml
|
@@ -385,17 +389,7 @@ files:
|
|
385
389
|
- config/locales/devise.en.yml
|
386
390
|
- config/locales/simple_form.en.yml
|
387
391
|
- config/routes.rb
|
388
|
-
- db/migrate/
|
389
|
-
- db/migrate/20160314190424_create_jobshop_sites.rb
|
390
|
-
- db/migrate/20160321212058_add_site_id_to_users.rb
|
391
|
-
- db/migrate/20160321213638_add_foreign_key_for_site.rb
|
392
|
-
- db/migrate/20160322040604_add_owner_id_to_sites.rb
|
393
|
-
- db/migrate/20160323132658_rename_configuration_token_to_registration_token.rb
|
394
|
-
- db/migrate/20160417210218_create_jobshop_dashboards.rb
|
395
|
-
- db/migrate/20160425062447_rename_site_to_team.rb
|
396
|
-
- db/migrate/20160718130211_reindex_jobshop_users_by_email_and_team_id.rb
|
397
|
-
- db/migrate/20160720201947_add_authentication_token_to_jobshop_users.rb
|
398
|
-
- db/migrate/20170309001357_create_jobshop_active_sessions.rb
|
392
|
+
- db/migrate/20170311194758_initialize_jobshop.rb
|
399
393
|
- db/migrate/keep
|
400
394
|
- exe/jobshop
|
401
395
|
- lib/generators/jobshop/app/USAGE
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module Jobshop
|
2
|
-
class ActiveSession < ApplicationRecord
|
3
|
-
LIMIT = 20
|
4
|
-
|
5
|
-
class << self
|
6
|
-
def active?(id)
|
7
|
-
id && where(activation_id: id).exists?
|
8
|
-
end
|
9
|
-
|
10
|
-
def activate(id)
|
11
|
-
activation = create!(activation_id: id)
|
12
|
-
enforce_active_session_quota
|
13
|
-
activation
|
14
|
-
end
|
15
|
-
|
16
|
-
def deactivate(id)
|
17
|
-
return unless id
|
18
|
-
where(activation_id: id).delete_all
|
19
|
-
end
|
20
|
-
|
21
|
-
def enforce_active_session_quota
|
22
|
-
order("created_at desc").offset(LIMIT).destroy_all
|
23
|
-
end
|
24
|
-
|
25
|
-
def exclusive(id)
|
26
|
-
where("activation_id != ?", id).delete_all
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
class DeviseCreateJobshopUsers < ActiveRecord::Migration[5.0]
|
2
|
-
def change
|
3
|
-
enable_extension "pgcrypto" unless extension_enabled?("pgcrypto")
|
4
|
-
|
5
|
-
create_table :jobshop_users, id: :uuid, default: "gen_random_uuid()" do |t|
|
6
|
-
## Database authenticatable
|
7
|
-
t.string :email, null: false, default: ""
|
8
|
-
t.string :encrypted_password, null: false, default: ""
|
9
|
-
|
10
|
-
## Recoverable
|
11
|
-
t.string :reset_password_token
|
12
|
-
t.datetime :reset_password_sent_at
|
13
|
-
|
14
|
-
## Rememberable
|
15
|
-
t.datetime :remember_created_at
|
16
|
-
|
17
|
-
## Trackable
|
18
|
-
# t.integer :sign_in_count, default: 0, null: false
|
19
|
-
# t.datetime :current_sign_in_at
|
20
|
-
# t.datetime :last_sign_in_at
|
21
|
-
# t.string :current_sign_in_ip
|
22
|
-
# t.string :last_sign_in_ip
|
23
|
-
|
24
|
-
## Confirmable
|
25
|
-
# t.string :confirmation_token
|
26
|
-
# t.datetime :confirmed_at
|
27
|
-
# t.datetime :confirmation_sent_at
|
28
|
-
# t.string :unconfirmed_email # Only if using reconfirmable
|
29
|
-
|
30
|
-
## Lockable
|
31
|
-
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
32
|
-
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
33
|
-
# t.datetime :locked_at
|
34
|
-
|
35
|
-
|
36
|
-
t.timestamps null: false
|
37
|
-
end
|
38
|
-
|
39
|
-
add_index :jobshop_users, :email, unique: true
|
40
|
-
add_index :jobshop_users, :reset_password_token, unique: true
|
41
|
-
# add_index :jobshop_users, :confirmation_token, unique: true
|
42
|
-
# add_index :jobshop_users, :unlock_token, unique: true
|
43
|
-
end
|
44
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class CreateJobshopSites < ActiveRecord::Migration[5.0]
|
2
|
-
def change
|
3
|
-
enable_extension "pgcrypto" unless extension_enabled?("pgcrypto")
|
4
|
-
|
5
|
-
create_table :jobshop_sites, id: :uuid, default: "gen_random_uuid()" do |t|
|
6
|
-
t.string :name
|
7
|
-
t.string :configuration_token
|
8
|
-
t.datetime :configuration_token_sent_at
|
9
|
-
|
10
|
-
t.timestamps
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
class RenameConfigurationTokenToRegistrationToken < ActiveRecord::Migration[5.0]
|
2
|
-
def change
|
3
|
-
rename_column :jobshop_sites, :configuration_token, :registration_token
|
4
|
-
rename_column :jobshop_sites, :configuration_token_sent_at,
|
5
|
-
:registration_token_sent_at
|
6
|
-
|
7
|
-
add_index :jobshop_sites, [ "registration_token" ], unique: true
|
8
|
-
end
|
9
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class CreateJobshopDashboards < ActiveRecord::Migration[5.0]
|
2
|
-
def change
|
3
|
-
enable_extension "pgcrypto" unless extension_enabled?("pgcrypto")
|
4
|
-
|
5
|
-
create_table(:jobshop_dashboards, id: :uuid,
|
6
|
-
default: "gen_random_uuid()")do |t|
|
7
|
-
t.uuid :site_id
|
8
|
-
|
9
|
-
t.timestamps
|
10
|
-
end
|
11
|
-
|
12
|
-
add_foreign_key(:jobshop_dashboards, :jobshop_sites, column: "site_id",
|
13
|
-
on_delete: :cascade)
|
14
|
-
end
|
15
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
class RenameSiteToTeam < ActiveRecord::Migration[5.0]
|
2
|
-
def change
|
3
|
-
reversible do |dir|
|
4
|
-
dir.up do
|
5
|
-
remove_foreign_key :jobshop_users, column: "site_id"
|
6
|
-
remove_foreign_key :jobshop_dashboards, column: "site_id"
|
7
|
-
remove_foreign_key :jobshop_sites, column: "owner_id"
|
8
|
-
end
|
9
|
-
dir.down do
|
10
|
-
add_foreign_key :jobshop_users, :jobshop_sites, column: "site_id",
|
11
|
-
on_delete: :cascade
|
12
|
-
add_foreign_key :jobshop_dashboards, :jobshop_sites, column: "site_id",
|
13
|
-
on_delete: :cascade
|
14
|
-
add_foreign_key :jobshop_sites, :jobshop_users, column: "owner_id",
|
15
|
-
on_delete: :restrict
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
rename_table :jobshop_sites, :jobshop_teams
|
20
|
-
rename_column :jobshop_users, :site_id, :team_id
|
21
|
-
rename_column :jobshop_dashboards, :site_id, :team_id
|
22
|
-
|
23
|
-
add_foreign_key :jobshop_users, :jobshop_teams, column: "team_id",
|
24
|
-
on_delete: :cascade
|
25
|
-
add_foreign_key :jobshop_dashboards, :jobshop_teams, column: "team_id",
|
26
|
-
on_delete: :cascade
|
27
|
-
add_foreign_key :jobshop_teams, :jobshop_users, column: "owner_id",
|
28
|
-
on_delete: :restrict
|
29
|
-
end
|
30
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class CreateJobshopActiveSessions < ActiveRecord::Migration[5.0]
|
2
|
-
def change
|
3
|
-
create_table :jobshop_active_sessions, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
4
|
-
t.uuid :user_id, null: false
|
5
|
-
t.string :activation_id
|
6
|
-
|
7
|
-
t.timestamps
|
8
|
-
end
|
9
|
-
|
10
|
-
add_index :jobshop_active_sessions, :user_id
|
11
|
-
add_index :jobshop_active_sessions, :activation_id, unique: true
|
12
|
-
end
|
13
|
-
end
|