diff --git a/apps/dashboard/src/actions/schema.ts b/apps/dashboard/src/actions/schema.ts index 9c01bce69b..97f11e4b45 100644 --- a/apps/dashboard/src/actions/schema.ts +++ b/apps/dashboard/src/actions/schema.ts @@ -180,6 +180,7 @@ export const connectBankAccountSchema = z.object({ currency: z.string(), name: z.string(), institution_id: z.string(), + account_reference: z.string().nullable().optional(), enabled: z.boolean(), logo_url: z.string().nullable().optional(), type: z.enum([ diff --git a/apps/dashboard/src/components/modals/select-bank-accounts.tsx b/apps/dashboard/src/components/modals/select-bank-accounts.tsx index 5683569609..766dd01058 100644 --- a/apps/dashboard/src/components/modals/select-bank-accounts.tsx +++ b/apps/dashboard/src/components/modals/select-bank-accounts.tsx @@ -8,7 +8,6 @@ import { useConnectParams } from "@/hooks/use-connect-params"; import { useI18n } from "@/locales/client"; import { getInitials } from "@/utils/format"; import { zodResolver } from "@hookform/resolvers/zod"; -import type { Accounts } from "@midday-ai/engine/resources/accounts.mjs"; import { Avatar, AvatarFallback } from "@midday/ui/avatar"; import { Button } from "@midday/ui/button"; import { @@ -39,6 +38,20 @@ import z from "zod"; import { FormatAmount } from "../format-amount"; import { LoadingTransactionsEvent } from "../loading-transactions-event"; +type Account = { + id: string; + name: string; + balance: number; + currency: string; + type: string; + subtype: string; + mask: string; + institution: { + id: string; + name: string; + }; +}; + function RowsSkeleton() { return (
@@ -140,7 +153,7 @@ export function SelectBankAccountsModal() { const { toast } = useToast(); const t = useI18n(); - const [accounts, setAccounts] = useState([]); + const [accounts, setAccounts] = useState([]); const [loading, setLoading] = useState(true); const [runId, setRunId] = useState(); const [accessToken, setAccessToken] = useState(); @@ -235,6 +248,7 @@ export function SelectBankAccountsModal() { institution_id: account.institution.id, logo_url: account.institution?.logo, account_id: account.id, + account_reference: account.resource_id, bank_name: account.institution.name, // TODO: Remove once we have a fix and return currency from engine currency: account.currency ?? account.balance.currency, diff --git a/packages/supabase/src/mutations/index.ts b/packages/supabase/src/mutations/index.ts index 78a769eae9..a52200626e 100644 --- a/packages/supabase/src/mutations/index.ts +++ b/packages/supabase/src/mutations/index.ts @@ -14,6 +14,7 @@ type CreateBankConnectionPayload = { enabled: boolean; balance: number; type: "depository" | "credit" | "other_asset" | "loan" | "other_liability"; + account_reference: string | null; }[]; balance: number; accessToken?: string; @@ -84,6 +85,7 @@ export async function createBankConnection( currency: account.currency, enabled: account.enabled, type: account.type, + account_reference: account.account_reference, balance: account.balance ?? 0, }), {