mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 05:25:24 +02:00
Transaction transfers, payments, and matching (#883)
* Add transfer model and clean up family snapshot fixtures * Ignore transfers in income and expense snapshots * Add transfer validations * Implement basic transfer matching UI * Fix merge conflicts * Add missing translations * Tweak selection states for transfer types * Add missing i18n translation
This commit is contained in:
parent
b462bc8f8c
commit
ca39b26070
57 changed files with 991 additions and 427 deletions
7
db/migrate/20240614120946_create_transfers.rb
Normal file
7
db/migrate/20240614120946_create_transfers.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class CreateTransfers < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :transfers, id: :uuid do |t|
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
class AddTransferFieldsToTransaction < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
change_table :transactions do |t|
|
||||
t.references :transfer, foreign_key: true, type: :uuid
|
||||
t.boolean :marked_as_transfer, default: false, null: false
|
||||
end
|
||||
end
|
||||
end
|
13
db/schema.rb
generated
13
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_06_12_164944) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_06_14_121110) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
enable_extension "plpgsql"
|
||||
|
@ -87,7 +87,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_06_12_164944) do
|
|||
t.uuid "accountable_id"
|
||||
t.decimal "balance", precision: 19, scale: 4, default: "0.0"
|
||||
t.string "currency", default: "USD"
|
||||
t.virtual "classification", type: :string, as: "\nCASE\n WHEN ((accountable_type)::text = ANY (ARRAY[('Account::Loan'::character varying)::text, ('Account::Credit'::character varying)::text, ('Account::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['Account::Loan'::character varying, 'Account::Credit'::character varying, 'Account::OtherLiability'::character varying])::text[])) THEN 'liability'::text\n ELSE 'asset'::text\nEND", stored: true
|
||||
t.boolean "is_active", default: true, null: false
|
||||
t.enum "status", default: "ok", null: false, enum_type: "account_status"
|
||||
t.jsonb "sync_warnings", default: [], null: false
|
||||
|
@ -310,9 +310,17 @@ ActiveRecord::Schema[7.2].define(version: 2024_06_12_164944) do
|
|||
t.boolean "excluded", default: false
|
||||
t.text "notes"
|
||||
t.uuid "merchant_id"
|
||||
t.uuid "transfer_id"
|
||||
t.boolean "marked_as_transfer", default: false, null: false
|
||||
t.index ["account_id"], name: "index_transactions_on_account_id"
|
||||
t.index ["category_id"], name: "index_transactions_on_category_id"
|
||||
t.index ["merchant_id"], name: "index_transactions_on_merchant_id"
|
||||
t.index ["transfer_id"], name: "index_transactions_on_transfer_id"
|
||||
end
|
||||
|
||||
create_table "transfers", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "users", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
|
@ -357,6 +365,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_06_12_164944) do
|
|||
add_foreign_key "transactions", "accounts", on_delete: :cascade
|
||||
add_foreign_key "transactions", "transaction_categories", column: "category_id", on_delete: :nullify
|
||||
add_foreign_key "transactions", "transaction_merchants", column: "merchant_id"
|
||||
add_foreign_key "transactions", "transfers"
|
||||
add_foreign_key "users", "families"
|
||||
add_foreign_key "valuations", "accounts", on_delete: :cascade
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue