mirror of
https://github.com/we-promise/sure.git
synced 2026-04-08 14:54:49 +00:00
* Providers factory (#250) * Implement providers factory * Multiple providers sync support - Proper Multi-Provider Syncing: When you click sync on an account with multiple providers (e.g., both Plaid and SimpleFin), all provider items are synced - Better API: The existing account.providers method already returns all providers, and account.provider returns the first one for backward compatibility - Correct Holdings Deletion Logic: Holdings can only be deleted if ALL providers allow it, preventing accidental deletions that would be recreated on next sync TODO: validate this is the way we want to go? We would need to check holdings belong to which account, and then check provider allows deletion. More complex - Database Constraints: The existing validations ensure an account can have at most one provider of each type (one PlaidAccount, one SimplefinAccount, etc.) * Add generic provider_import_adapter * Finish unified import strategy * Update app/models/plaid_account.rb Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: soky srm <sokysrm@gmail.com> * Update app/models/provider/factory.rb Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: soky srm <sokysrm@gmail.com> * Fix account linked by plaid_id instead of external_id * Parse numerics to BigDecimal Parse numerics to BigDecimal before computing amount; guard nils. Avoid String * String and float drift; also normalize date. * Fix incorrect usage of assert_raises. * Fix linter * Fix processor test. * Update current_balance_manager.rb * Test fixes * Fix plaid linked account test * Add support for holding per account_provider * Fix proper account access Also fix account deletion for simpefin too * FIX match tests for consistency * Some more factory updates * Fix account schema for multipe providers Can do: - Account #1 → PlaidAccount + SimplefinAccount (multiple different providers) - Account #2 → PlaidAccount only - Account #3 → SimplefinAccount only Cannot do: - Account #1 → PlaidAccount + PlaidAccount (duplicate provider type) - PlaidAccount #123 → Account #1 + Account #2 (provider linked to multiple accounts) * Fix account setup - An account CAN have multiple providers (the schema shows account_providers with unique index on [account_id, provider_type]) - Each provider should maintain its own separate entries - We should NOT update one provider's entry when another provider syncs * Fix linter and guard migration * FIX linter issues. * Fixes - Remove duplicated index - Pass account_provider_id - Guard holdings call to avoid NoMethodError * Update schema and provider import fix * Plaid doesn't allow holdings deletion * Use ClimateControl for proper env setup * No need for this in .git --------- Signed-off-by: soky srm <sokysrm@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com> * Update pages/dashboard locales (#255) * Localization for an accountable group and sidebar - Added localization for account types - Updated account localization for en and ca --------- Signed-off-by: soky srm <sokysrm@gmail.com> Co-authored-by: soky srm <sokysrm@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
66 lines
3.1 KiB
Plaintext
66 lines
3.1 KiB
Plaintext
<%# locals: (account_group:, mobile: false, all_tab: false, open: nil, **args) %>
|
|
|
|
<div id="<%= account_group.dom_id(tab: all_tab ? :all : nil, mobile: mobile) %>">
|
|
<% is_open = open.nil? ? account_group.accounts.any? { |account| page_active?(account_path(account)) } : open %>
|
|
<%= render DS::Disclosure.new(align: :left, open: is_open) do |disclosure| %>
|
|
<% disclosure.with_summary_content do %>
|
|
<div class="flex items-center gap-3">
|
|
<%= icon "chevron-right", class: "group-open:transform group-open:rotate-90" %>
|
|
<%= tag.span class: class_names("text-sm text-primary font-medium", "animate-pulse" => account_group.syncing?) do %>
|
|
<%= account_group.name %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="ml-auto text-right grow">
|
|
<%= tag.p format_money(account_group.total_money), class: "text-sm font-medium text-primary" %>
|
|
<%= turbo_frame_tag "#{account_group.key}_sparkline", src: accountable_sparkline_path(account_group.key), loading: "lazy", data: { controller: "turbo-frame-timeout", turbo_frame_timeout_timeout_value: 10000 } do %>
|
|
<div class="flex items-center w-8 h-4 ml-auto">
|
|
<div class="w-6 h-px bg-loader"></div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="space-y-1">
|
|
<% account_group.accounts.each do |account| %>
|
|
<%= link_to account_path(account),
|
|
class: class_names(
|
|
"block flex items-center gap-2 px-3 py-2 rounded-lg",
|
|
page_active?(account_path(account)) ? "bg-container" : "hover:bg-surface-hover"
|
|
),
|
|
title: account.name do %>
|
|
<%= render "accounts/logo", account: account, size: "sm", color: account_group.color %>
|
|
|
|
<div class="min-w-0 grow">
|
|
<div class="flex items-center gap-2 mb-0.5">
|
|
<%= tag.p account.name, class: class_names("text-sm text-primary font-medium truncate", "animate-pulse" => account.syncing?) %>
|
|
</div>
|
|
<%= tag.p account.short_subtype_label, class: "text-sm text-secondary truncate" %>
|
|
</div>
|
|
|
|
<div class="ml-auto text-right grow h-10">
|
|
<%= tag.p format_money(account.balance_money), class: "text-sm font-medium text-primary whitespace-nowrap" %>
|
|
<%= turbo_frame_tag dom_id(account, :sparkline), src: sparkline_account_path(account), loading: "lazy", data: { controller: "turbo-frame-timeout", turbo_frame_timeout_timeout_value: 10000 } do %>
|
|
<div class="flex items-center w-8 h-4 ml-auto">
|
|
<div class="w-6 h-px bg-loader"></div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="my-2">
|
|
<%= render DS::Link.new(
|
|
href: new_polymorphic_path(account_group.key, step: "method_select"),
|
|
text: t("accounts.sidebar.new_account_group", account_group: account_group.name.downcase.singularize),
|
|
icon: "plus",
|
|
full_width: true,
|
|
variant: "ghost",
|
|
frame: :modal,
|
|
class: "justify-start"
|
|
) %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|