mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-02 20:15:22 +02:00
Basic Plaid Integration (#1433)
* Basic plaid data model and linking * Remove institutions, add plaid items * Improve schema and Plaid provider * Add webhook verification sketch * Webhook verification * Item accounts and balances sync setup * Provide test encryption keys * Fix test * Only provide encryption keys in prod * Try defining keys in test env * Consolidate account sync logic * Add back plaid account initialization * Plaid transaction sync * Sync UI overhaul for Plaid * Add liability and investment syncing * Handle investment webhooks and process current day holdings * Remove logs * Remove "all" period select for performance * fix amount calc * Remove todo comment * Coming soon for investment historical data * Document Plaid configuration * Listen for holding updates
This commit is contained in:
parent
3bc9da4105
commit
cbba2ba675
127 changed files with 1537 additions and 841 deletions
56
db/migrate/20241106193743_add_plaid_domain.rb
Normal file
56
db/migrate/20241106193743_add_plaid_domain.rb
Normal file
|
@ -0,0 +1,56 @@
|
|||
class AddPlaidDomain < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :plaid_items, id: :uuid do |t|
|
||||
t.references :family, null: false, type: :uuid, foreign_key: true
|
||||
t.string :access_token
|
||||
t.string :plaid_id
|
||||
t.string :name
|
||||
t.string :next_cursor
|
||||
t.boolean :scheduled_for_deletion, default: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :plaid_accounts, id: :uuid do |t|
|
||||
t.references :plaid_item, null: false, type: :uuid, foreign_key: true
|
||||
t.string :plaid_id
|
||||
t.string :plaid_type
|
||||
t.string :plaid_subtype
|
||||
t.decimal :current_balance, precision: 19, scale: 4
|
||||
t.decimal :available_balance, precision: 19, scale: 4
|
||||
t.string :currency
|
||||
t.string :name
|
||||
t.string :mask
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :syncs, id: :uuid do |t|
|
||||
t.references :syncable, polymorphic: true, null: false, type: :uuid
|
||||
t.datetime :last_ran_at
|
||||
t.date :start_date
|
||||
t.string :status, default: "pending"
|
||||
t.string :error
|
||||
t.jsonb :data
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
remove_column :families, :last_synced_at, :datetime
|
||||
add_column :families, :last_auto_synced_at, :datetime
|
||||
remove_column :accounts, :last_sync_date, :date
|
||||
remove_reference :accounts, :institution
|
||||
add_reference :accounts, :plaid_account, type: :uuid, foreign_key: true
|
||||
|
||||
add_column :account_entries, :plaid_id, :string
|
||||
add_column :accounts, :scheduled_for_deletion, :boolean, default: false
|
||||
|
||||
drop_table :account_syncs do |t|
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
drop_table :institutions do |t|
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
10
db/migrate/20241114164118_add_products_to_plaid_item.rb
Normal file
10
db/migrate/20241114164118_add_products_to_plaid_item.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class AddProductsToPlaidItem < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_column :plaid_items, :available_products, :string, array: true, default: []
|
||||
add_column :plaid_items, :billed_products, :string, array: true, default: []
|
||||
|
||||
rename_column :families, :last_auto_synced_at, :last_synced_at
|
||||
add_column :plaid_items, :last_synced_at, :datetime
|
||||
add_column :accounts, :last_synced_at, :datetime
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue