mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 05:25:24 +02:00
Family invites (#1397)
* Initial pass at household invites * Invitee setup * Clean up add member form * Lint and other tweaks * Security cleanup * Lint * i18n fixes * More i18n cleanup * Show pending invites * Don't use turbo on the form * Improved email design * Basic tests * Lint * Update onboardings_controller.rb * Registration + invite cleanup * Lint * Update brakeman.ignore * Update brakeman.ignore * Self host invite links * Test tweaks * Address missing param error
This commit is contained in:
parent
09b269273a
commit
793bd852a0
26 changed files with 502 additions and 45 deletions
18
db/migrate/20241030222235_create_invitations.rb
Normal file
18
db/migrate/20241030222235_create_invitations.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
class CreateInvitations < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :invitations, id: :uuid do |t|
|
||||
t.string :email
|
||||
t.string :role
|
||||
t.string :token
|
||||
t.references :family, null: false, foreign_key: true, type: :uuid
|
||||
t.references :inviter, null: false, foreign_key: { to_table: :users }, type: :uuid
|
||||
t.datetime :accepted_at
|
||||
t.datetime :expires_at
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :invitations, :token, unique: true
|
||||
add_index :invitations, :email
|
||||
end
|
||||
end
|
22
db/schema.rb
generated
22
db/schema.rb
generated
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_10_30_121302) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_10_30_222235) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
enable_extension "plpgsql"
|
||||
|
@ -119,7 +119,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_10_30_121302) do
|
|||
t.boolean "is_active", default: true, null: false
|
||||
t.date "last_sync_date"
|
||||
t.uuid "institution_id"
|
||||
t.virtual "classification", type: :string, as: "\nCASE\n WHEN ((accountable_type)::text = ANY ((ARRAY['Loan'::character varying, 'CreditCard'::character varying, 'OtherLiability'::character varying])::text[])) THEN 'liability'::text\n ELSE 'asset'::text\nEND", stored: true
|
||||
t.virtual "classification", type: :string, as: "\nCASE\n WHEN ((accountable_type)::text = ANY (ARRAY[('Loan'::character varying)::text, ('CreditCard'::character varying)::text, ('OtherLiability'::character varying)::text])) THEN 'liability'::text\n ELSE 'asset'::text\nEND", stored: true
|
||||
t.uuid "import_id"
|
||||
t.string "mode"
|
||||
t.index ["accountable_id", "accountable_type"], name: "index_accounts_on_accountable_id_and_accountable_type"
|
||||
|
@ -418,6 +418,22 @@ ActiveRecord::Schema[7.2].define(version: 2024_10_30_121302) do
|
|||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "invitations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.string "email"
|
||||
t.string "role"
|
||||
t.string "token"
|
||||
t.uuid "family_id", null: false
|
||||
t.uuid "inviter_id", null: false
|
||||
t.datetime "accepted_at"
|
||||
t.datetime "expires_at"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["email"], name: "index_invitations_on_email"
|
||||
t.index ["family_id"], name: "index_invitations_on_family_id"
|
||||
t.index ["inviter_id"], name: "index_invitations_on_inviter_id"
|
||||
t.index ["token"], name: "index_invitations_on_token", unique: true
|
||||
end
|
||||
|
||||
create_table "invite_codes", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.string "token", null: false
|
||||
t.datetime "created_at", null: false
|
||||
|
@ -605,6 +621,8 @@ ActiveRecord::Schema[7.2].define(version: 2024_10_30_121302) do
|
|||
add_foreign_key "import_rows", "imports"
|
||||
add_foreign_key "imports", "families"
|
||||
add_foreign_key "institutions", "families"
|
||||
add_foreign_key "invitations", "families"
|
||||
add_foreign_key "invitations", "users", column: "inviter_id"
|
||||
add_foreign_key "merchants", "families"
|
||||
add_foreign_key "security_prices", "securities"
|
||||
add_foreign_key "sessions", "impersonation_sessions", column: "active_impersonator_session_id"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue