feat(targeted_user_link): add targeted user link to wrap expert invitation in order to avoid access issue when the expert is connected with another account
feat(user.merge): ensure to merge user.targeted_user_link Update app/models/targeted_user_link.rb Co-authored-by: LeSim <mail@simon.lehericey.net> Update app/models/targeted_user_link.rb Co-authored-by: LeSim <mail@simon.lehericey.net> Update app/models/targeted_user_link.rb Co-authored-by: LeSim <mail@simon.lehericey.net> feat(db/create_targeted_user_links): ensure not null with fk
This commit is contained in:
parent
bc68b29336
commit
cb890343ff
21 changed files with 241 additions and 22 deletions
10
db/migrate/20220520134041_enable_pgcrypto.rb
Normal file
10
db/migrate/20220520134041_enable_pgcrypto.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class EnablePgcrypto < ActiveRecord::Migration[6.1]
|
||||
# see: https://pawelurbanek.com/uuid-order-rails -> use uuid for id
|
||||
def up
|
||||
enable_extension "pgcrypto"
|
||||
end
|
||||
|
||||
def down
|
||||
disable_extension "pgcrypto"
|
||||
end
|
||||
end
|
13
db/migrate/20220520134042_create_targeted_user_links.rb
Normal file
13
db/migrate/20220520134042_create_targeted_user_links.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
class CreateTargetedUserLinks < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
# avoid target links with pk sequence
|
||||
create_table :targeted_user_links, id: :uuid do |t|
|
||||
t.string :target_context, null: false
|
||||
t.bigint :target_model_id, null: false
|
||||
t.string :target_model_type, null: false
|
||||
t.references :user, foreign_key: true, null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
12
db/schema.rb
12
db/schema.rb
|
@ -13,6 +13,7 @@
|
|||
ActiveRecord::Schema.define(version: 2022_05_20_173939) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
enable_extension "plpgsql"
|
||||
enable_extension "unaccent"
|
||||
|
||||
|
@ -751,6 +752,16 @@ ActiveRecord::Schema.define(version: 2022_05_20_173939) do
|
|||
t.index ["unlock_token"], name: "index_super_admins_on_unlock_token", unique: true
|
||||
end
|
||||
|
||||
create_table "targeted_user_links", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.string "target_context", null: false
|
||||
t.bigint "target_model_id", null: false
|
||||
t.string "target_model_type", null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.bigint "user_id", null: false
|
||||
t.index ["user_id"], name: "index_targeted_user_links_on_user_id"
|
||||
end
|
||||
|
||||
create_table "task_records", id: false, force: :cascade do |t|
|
||||
t.string "version", null: false
|
||||
end
|
||||
|
@ -901,6 +912,7 @@ ActiveRecord::Schema.define(version: 2022_05_20_173939) do
|
|||
add_foreign_key "received_mails", "procedures"
|
||||
add_foreign_key "refused_mails", "procedures"
|
||||
add_foreign_key "services", "administrateurs"
|
||||
add_foreign_key "targeted_user_links", "users"
|
||||
add_foreign_key "traitements", "dossiers"
|
||||
add_foreign_key "trusted_device_tokens", "instructeurs"
|
||||
add_foreign_key "types_de_champ", "procedure_revisions", column: "revision_id"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue