mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 14:31:25 +00:00
* **Add Coinbase integration with item and account management** - Creates migrations for `coinbase_items` and `coinbase_accounts`. - Adds models, controllers, views, and background tasks to support account linking, syncing, and transaction handling. - Implements Coinbase API client and adapter for seamless integration. - Supports ActiveRecord encryption for secure credential storage. - Adds UI components for provider setup, account management, and synchronization. * Localize Coinbase-related UI strings, refine account linking for security, and add timeouts to Coinbase API requests. * Localize Coinbase account handling to support native currencies (USD, EUR, GBP, etc.) across balances, trades, holdings, and transactions. * Improve Coinbase processing with timezone-safe parsing, native currency support, and immediate holdings updates. * Improve trend percentage formatting and enhance race condition handling for Coinbase account linking. * Fix log message wording for orphan cleanup * Ensure `selected_accounts` parameter is sanitized by rejecting blank entries. * Add tests for Coinbase integration: account, item, and controller coverage - Adds unit tests for `CoinbaseAccount` and `CoinbaseItem` models. - Adds integration tests for `CoinbaseItemsController`. - Introduces Stimulus `select-all` controller for UI checkbox handling. - Localizes UI strings and logging for Coinbase integration. * Update test fixtures to use consistent placeholder API keys and secrets * Refine `coinbase_item` tests to ensure deterministic ordering and improve scope assertions. * Integrate `SyncStats::Collector` into Coinbase syncer to streamline statistics collection and enhance consistency. * Localize Coinbase sync status messages and improve sync summary test coverage. * Update `CoinbaseItem` encryption: use deterministic encryption for `api_key` and standard for `api_secret`. * fix schema drift * Beta labels to lower expectations --------- Co-authored-by: luckyPipewrench <luckypipewrench@proton.me> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
62 lines
1.7 KiB
Ruby
62 lines
1.7 KiB
Ruby
class CreateCoinbaseItemsAndAccounts < ActiveRecord::Migration[7.2]
|
|
def change
|
|
# Create provider items table (stores per-family connection credentials)
|
|
create_table :coinbase_items, id: :uuid do |t|
|
|
t.references :family, null: false, foreign_key: true, type: :uuid
|
|
t.string :name
|
|
|
|
# Institution metadata
|
|
t.string :institution_id
|
|
t.string :institution_name
|
|
t.string :institution_domain
|
|
t.string :institution_url
|
|
t.string :institution_color
|
|
|
|
# Status and lifecycle
|
|
t.string :status, default: "good"
|
|
t.boolean :scheduled_for_deletion, default: false
|
|
t.boolean :pending_account_setup, default: false
|
|
|
|
# Sync settings
|
|
t.datetime :sync_start_date
|
|
|
|
# Raw data storage
|
|
t.jsonb :raw_payload
|
|
t.jsonb :raw_institution_payload
|
|
|
|
# Provider-specific credential fields (API Key authentication)
|
|
t.text :api_key
|
|
t.text :api_secret
|
|
|
|
t.timestamps
|
|
end
|
|
|
|
add_index :coinbase_items, :status
|
|
|
|
# Create provider accounts table (stores individual account data from provider)
|
|
create_table :coinbase_accounts, id: :uuid do |t|
|
|
t.references :coinbase_item, null: false, foreign_key: true, type: :uuid
|
|
|
|
# Account identification
|
|
t.string :name
|
|
t.string :account_id
|
|
|
|
# Account details
|
|
t.string :currency
|
|
t.decimal :current_balance, precision: 19, scale: 4
|
|
t.string :account_status
|
|
t.string :account_type
|
|
t.string :provider
|
|
|
|
# Metadata and raw data
|
|
t.jsonb :institution_metadata
|
|
t.jsonb :raw_payload
|
|
t.jsonb :raw_transactions_payload
|
|
|
|
t.timestamps
|
|
end
|
|
|
|
add_index :coinbase_accounts, :account_id
|
|
end
|
|
end
|