diff --git a/api/src/zero.ts b/api/src/zero.ts index 1bc31ce..d220065 100644 --- a/api/src/zero.ts +++ b/api/src/zero.ts @@ -116,7 +116,7 @@ const createMutators = (authData: AuthData | null) => { const { data } = await plaidClient.transactionsGet({ access_token: account.token, start_date: "2025-10-01", - end_date: "2025-10-18", + end_date: new Date().toISOString().split("T")[0], }); const transactions = data.transactions.map(tx => ({ diff --git a/app/index.tsx b/app/index.tsx index dfc8ccd..a4967fb 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -1,5 +1,5 @@ import { authClient } from '@/lib/auth-client'; -import { Pressable, ScrollView, Text, View } from 'react-native'; +import { Image, Pressable, ScrollView, Text, View } from 'react-native'; import { useQuery, useZero } from "@rocicorp/zero/react"; import { queries, type Mutators, type Schema } from '@money/shared'; import { useEffect, useState } from 'react'; @@ -58,6 +58,12 @@ export default function HomeScreen() { return Array.from({ length: LEN - nstr.length }).join(" ") + nstr; } + function uuu(t: typeof filteredTransactions[number]): string | undefined { + if (!t.json) return; + const j = JSON.parse(t.json); + return j.counterparties.filter((c: any) => !!c.logo_url).at(0)?.logo_url || j.personal_finance_category_icon_url; + } + return ( @@ -71,7 +77,12 @@ export default function HomeScreen() { {filteredTransactions.map((t, i) => { setIdx(i); }} style={{ backgroundColor: i == idx ? 'black' : undefined, cursor: 'default' as 'auto' }} key={t.id}> - {new Date(t.datetime!).toDateString()} 0 ? 'red' : 'green' }}>{lpad(t.amount)} {t.name.substring(0, 50)} + + {new Date(t.datetime!).toDateString()} + 0 ? 'red' : 'green' }}> {lpad(t.amount)} + + {t.name.substring(0, 50)} + )} diff --git a/shared/src/queries.ts b/shared/src/queries.ts index bcea14e..368fc2e 100644 --- a/shared/src/queries.ts +++ b/shared/src/queries.ts @@ -5,14 +5,19 @@ import { type AuthData } from "./auth"; import { isLoggedIn } from "./zql"; export const queries = { + me: syncedQueryWithContext('me', z.tuple([]), (authData: AuthData | null) => { + isLoggedIn(authData); + return builder.users + .where('id', '=', authData.user.id) + .one(); + }), allTransactions: syncedQueryWithContext('allTransactions', z.tuple([]), (authData: AuthData | null) => { isLoggedIn(authData); return builder.transaction .where('user_id', '=', authData.user.id) .orderBy('datetime', 'desc') .limit(50) - } - ), + }), getPlaidLink: syncedQueryWithContext('getPlaidLink', z.tuple([]), (authData: AuthData | null) => { isLoggedIn(authData); return builder.plaidLink @@ -23,6 +28,7 @@ export const queries = { getBalances: syncedQueryWithContext('getBalances', z.tuple([]), (authData: AuthData | null) => { isLoggedIn(authData); return builder.balance - .where('user_id', '=', authData.user.id); + .where('user_id', '=', authData.user.id) + .orderBy('name', 'asc'); }) }; diff --git a/shared/tsconfig.json b/shared/tsconfig.json index 4d847e1..8c54623 100644 --- a/shared/tsconfig.json +++ b/shared/tsconfig.json @@ -3,7 +3,7 @@ "target": "ES2022", "module": "ESNext", "moduleResolution": "Bundler", - "declaration": true, + "declaration": false, "outDir": "./dist", "strict": true, "verbatimModuleSyntax": true,