diff --git a/CHANGELOG.md b/CHANGELOG.md index 70719382..3cff0dd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - add French translation - remember selected language +- rework balance table into a basic statistics page with lifetime group statistics ## 1.6.0 (2026-01-10) diff --git a/apps/web/src/components/accounts/BalanceTable.tsx b/apps/web/src/components/accounts/BalanceTable.tsx deleted file mode 100644 index b859ccfb..00000000 --- a/apps/web/src/components/accounts/BalanceTable.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import { useAppSelector } from "@/store"; -import { selectAccountBalances, useSortedAccounts } from "@abrechnung/redux"; -import { DataGrid, GridColDef, GridToolbar } from "@mui/x-data-grid"; -import React from "react"; -import { renderCurrency } from "../style/datagrid/renderCurrency"; -import { useTranslation } from "react-i18next"; -import { Group } from "@abrechnung/api"; - -interface Props { - group: Group; -} - -export const BalanceTable: React.FC = ({ group }) => { - const { t } = useTranslation(); - const personalAccounts = useSortedAccounts(group.id, "name", "personal"); - const balances = useAppSelector((state) => selectAccountBalances(state, group.id)); - - const tableData = personalAccounts.map((acc) => { - return { - id: acc.id, - name: acc.name, - balance: balances[acc.id]?.balance ?? 0, - totalPaid: balances[acc.id]?.totalPaid ?? 0, - totalConsumed: balances[acc.id]?.totalConsumed ?? 0, - }; - }); - - const columns: GridColDef[] = [ - { field: "name", headerName: "Name", flex: 1 }, - { - field: "totalConsumed", - headerName: t("balanceTable.totalConsumed"), - renderCell: renderCurrency(group.currency_identifier, -1), - }, - { - field: "totalPaid", - headerName: t("balanceTable.totalPaid"), - renderCell: renderCurrency(group.currency_identifier, 1), - }, - { - field: "balance", - headerName: t("balanceTable.balance"), - renderCell: renderCurrency(group.currency_identifier), - }, - ]; - - return ( -
- row.id} - sx={{ border: 0 }} - rows={tableData} - columns={columns} - disableRowSelectionOnClick - slots={{ - toolbar: GridToolbar, - }} - /> -
- ); -}; diff --git a/apps/web/src/components/accounts/index.ts b/apps/web/src/components/accounts/index.ts index c0454859..66ae1a44 100644 --- a/apps/web/src/components/accounts/index.ts +++ b/apps/web/src/components/accounts/index.ts @@ -1,3 +1,2 @@ export * from "./DeleteAccountModal"; -export * from "./BalanceTable"; export * from "./ClearingAccountParticipants"; diff --git a/apps/web/src/components/style/datagrid/renderCurrency.tsx b/apps/web/src/components/style/datagrid/renderCurrency.tsx index 1c22cd02..dc5a5834 100644 --- a/apps/web/src/components/style/datagrid/renderCurrency.tsx +++ b/apps/web/src/components/style/datagrid/renderCurrency.tsx @@ -4,17 +4,16 @@ import * as React from "react"; interface CurrencyValueProps { currencySymbol: string; value?: number; - signOverride?: number; } -const CurrencyValue = React.memo(({ currencySymbol, value = 0, signOverride }: CurrencyValueProps) => { +const CurrencyValue = React.memo(({ currencySymbol, value = 0 }: CurrencyValueProps) => { const formatCurrency = useFormatCurrency(); const getAmountColor = useGetAmountColor(); return (
{ - return ; + return ; }; component.displayName = "CurrencyValue"; return component; diff --git a/apps/web/src/hooks/useGetAmountColor.ts b/apps/web/src/hooks/useGetAmountColor.ts index f83ee54f..3acd14b3 100644 --- a/apps/web/src/hooks/useGetAmountColor.ts +++ b/apps/web/src/hooks/useGetAmountColor.ts @@ -11,6 +11,10 @@ export const useGetAmountColor = () => { const colorRedInverted = theme.palette.mode === "dark" ? theme.palette.error.light : theme.palette.error.dark; + if (Math.abs(amount) < Number.EPSILON) { + return undefined; + } + return amount < 0 ? colorRedInverted : colorGreenInverted; }, [theme] diff --git a/apps/web/src/pages/accounts/AccountDetail/AccountInfo.tsx b/apps/web/src/pages/accounts/AccountDetail/AccountInfo.tsx index d01b9f49..5731b072 100644 --- a/apps/web/src/pages/accounts/AccountDetail/AccountInfo.tsx +++ b/apps/web/src/pages/accounts/AccountDetail/AccountInfo.tsx @@ -222,7 +222,10 @@ export const AccountInfo: React.FC = ({ groupId, account }) => { margin="dense" fullWidth value={formatCurrency( - balances[account.id].totalConsumed - balances[account.id].totalPaid, + balances[account.id].totalConsumedPurchases + + balances[account.id].totalReceivedTransfers - + balances[account.id].totalPaidPurchases - + balances[account.id].totalPaidTransfers, currencyIdentifier )} onChange={() => undefined} diff --git a/apps/web/src/pages/accounts/BalanceBarGraph.tsx b/apps/web/src/pages/accounts/Balances/BalanceBarGraph.tsx similarity index 92% rename from apps/web/src/pages/accounts/BalanceBarGraph.tsx rename to apps/web/src/pages/accounts/Balances/BalanceBarGraph.tsx index 03cbdc74..76b1f71d 100644 --- a/apps/web/src/pages/accounts/BalanceBarGraph.tsx +++ b/apps/web/src/pages/accounts/Balances/BalanceBarGraph.tsx @@ -2,9 +2,10 @@ import { useFormatCurrency } from "@/hooks"; import { useAppSelector } from "@/store"; import { Group } from "@abrechnung/api"; import { selectAccountBalances, useSortedAccounts } from "@abrechnung/redux"; -import { Box, Theme, Typography } from "@mui/material"; +import { Box, Chip, Theme, Typography } from "@mui/material"; import { useTheme } from "@mui/material/styles"; import * as React from "react"; +import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router"; export type BalanceBarGraphProps = { @@ -15,9 +16,11 @@ type Data = { name: string; id: number; balance: number; + isYou: boolean; }; export const BalanceBarGraph: React.FC = ({ group }) => { + const { t } = useTranslation(); const formatCurrency = useFormatCurrency(); const theme: Theme = useTheme(); const navigate = useNavigate(); @@ -35,6 +38,7 @@ export const BalanceBarGraph: React.FC = ({ group }) => { return { id: account.id, name: account.name, + isYou: group.owned_account_id === account.id, balance: roundTwoDecimals(balance?.balance ?? 0), }; }); @@ -46,6 +50,10 @@ export const BalanceBarGraph: React.FC = ({ group }) => { navigate(`/groups/${group.id}/accounts/${accountId}`); }; + const itsYouChip = ( + + ); + return ( {chartData.map((item, index) => { @@ -77,6 +85,7 @@ export const BalanceBarGraph: React.FC = ({ group }) => { {isPositive ? ( {item.name} + {item.isYou && itsYouChip} ) : ( <> @@ -129,6 +138,7 @@ export const BalanceBarGraph: React.FC = ({ group }) => { ) : ( {item.name} + {item.isYou && itsYouChip} )} diff --git a/apps/web/src/pages/accounts/Balances.tsx b/apps/web/src/pages/accounts/Balances/Balances.tsx similarity index 82% rename from apps/web/src/pages/accounts/Balances.tsx rename to apps/web/src/pages/accounts/Balances/Balances.tsx index afb8e739..80880425 100644 --- a/apps/web/src/pages/accounts/Balances.tsx +++ b/apps/web/src/pages/accounts/Balances/Balances.tsx @@ -1,5 +1,4 @@ import { GroupArchivedDisclaimer } from "@/components"; -import { BalanceTable } from "@/components/accounts/BalanceTable"; import { MobilePaper } from "@/components/style"; import { useTitle } from "@/core/utils"; import { useFormatCurrency, useGetAmountColor } from "@/hooks"; @@ -17,6 +16,7 @@ import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { Navigate, Link as RouterLink } from "react-router"; import { BalanceBarGraph } from "./BalanceBarGraph"; +import { Statistics } from "./Statistics"; interface Props { groupId: number; @@ -58,8 +58,8 @@ export const Balances: React.FC = ({ groupId }) => { setSelectedTab(idx)} centered> - - + + @@ -84,21 +84,21 @@ export const Balances: React.FC = ({ groupId }) => { )} + {isGroupWritable && ( + <> + + + + + + )} - + - {isGroupWritable && ( - <> - - - - - - )} ); }; diff --git a/apps/web/src/pages/accounts/Balances/Statistics.tsx b/apps/web/src/pages/accounts/Balances/Statistics.tsx new file mode 100644 index 00000000..63edd190 --- /dev/null +++ b/apps/web/src/pages/accounts/Balances/Statistics.tsx @@ -0,0 +1,76 @@ +import { Group } from "@/core/generated/api"; +import { useFormatCurrency } from "@/hooks"; +import { useAppSelector } from "@/store"; +import { Help } from "@abrechnung/components"; +import { selectAccountBalances } from "@abrechnung/redux"; +import { Alert, AlertTitle, Box, Link, Stack, Typography } from "@mui/material"; +import * as React from "react"; +import { Trans, useTranslation } from "react-i18next"; +import { Link as RouterLink } from "react-router"; + +export type StatisticsProps = { + group: Group; +}; + +export const Statistics: React.FC = ({ group }) => { + const { t } = useTranslation(); + const formatCurrency = useFormatCurrency(); + + const balances = useAppSelector((state) => selectAccountBalances(state, group.id)); + + const personalBalance = group.owned_account_id != null ? balances[group.owned_account_id] : undefined; + + const totalSpendings = React.useMemo(() => { + return Object.values(balances).reduce( + (totalSpendings, balance) => totalSpendings + balance.totalConsumedPurchases, + 0 + ); + }, []); + + return ( + + + + {t("accounts.balances.totalGroupExpenses")} + + + {formatCurrency(totalSpendings, group.currency_identifier)} + + + {personalBalance != null ? ( + <> + + + {t("accounts.balances.yourTotalDisbursements")} + + + + {formatCurrency(personalBalance.totalPaidPurchases, group.currency_identifier)} + + + + + + {t("accounts.balances.yourTotalExpenses")} + + + + {formatCurrency(personalBalance.totalConsumedPurchases, group.currency_identifier)} + + + + ) : ( + + {t("accounts.balances.noOwnedAccountAlertTitle")} + + Head over to the{" "} + + group settings + {" "} + to claim an account and have individualized statistics shown here. + + + )} + + ); +}; diff --git a/apps/web/src/pages/groups/Group.tsx b/apps/web/src/pages/groups/Group.tsx index 99bd0723..3699d849 100644 --- a/apps/web/src/pages/groups/Group.tsx +++ b/apps/web/src/pages/groups/Group.tsx @@ -7,7 +7,7 @@ import { import React, { Suspense } from "react"; import { Navigate, Route, Routes, useParams } from "react-router"; import { toast } from "react-toastify"; -import { Balances } from "../accounts/Balances"; +import { Balances } from "../accounts/Balances/Balances"; import { Loading } from "@abrechnung/components"; import { api } from "@/core/api"; import { useAppDispatch, useAppSelector } from "@/store"; diff --git a/libs/components/src/lib/Help.tsx b/libs/components/src/lib/Help.tsx new file mode 100644 index 00000000..92b5f3cd --- /dev/null +++ b/libs/components/src/lib/Help.tsx @@ -0,0 +1,15 @@ +import { Tooltip } from "@mui/material"; +import { HelpOutline as HelpIcon } from "@mui/icons-material"; +import * as React from "react"; + +export type HelpProps = { + title: string; +}; + +export const Help: React.FC = ({ title }) => { + return ( + + + + ); +}; diff --git a/libs/components/src/lib/index.ts b/libs/components/src/lib/index.ts index 3eeddd5c..7133a188 100644 --- a/libs/components/src/lib/index.ts +++ b/libs/components/src/lib/index.ts @@ -7,3 +7,4 @@ export * from "./Loading"; export * from "./FormCheckbox"; export * from "./CurrencyIdentifierSelect"; export * from "./Select"; +export * from "./Help"; diff --git a/libs/core/src/lib/accounts.test.ts b/libs/core/src/lib/accounts.spec.ts similarity index 71% rename from libs/core/src/lib/accounts.test.ts rename to libs/core/src/lib/accounts.spec.ts index e8b4e9fd..ea780336 100644 --- a/libs/core/src/lib/accounts.test.ts +++ b/libs/core/src/lib/accounts.spec.ts @@ -71,22 +71,28 @@ describe("computeAccountBalances", () => { 1: { balance: 75, beforeClearing: 75, - totalConsumed: 25, - totalPaid: 100, + totalConsumedPurchases: 25, + totalPaidPurchases: 100, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 2: { balance: -50, beforeClearing: -50, - totalConsumed: 50, - totalPaid: 0, + totalConsumedPurchases: 50, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 3: { balance: -25, beforeClearing: -25, - totalConsumed: 25, - totalPaid: 0, + totalConsumedPurchases: 25, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, }; @@ -128,29 +134,37 @@ describe("computeAccountBalances", () => { 1: { balance: 75, beforeClearing: 75, - totalConsumed: 25, - totalPaid: 100, + totalConsumedPurchases: 25, + totalPaidPurchases: 100, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 2: { balance: -25, beforeClearing: -25, - totalConsumed: 25, - totalPaid: 0, + totalConsumedPurchases: 25, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 3: { balance: -50, beforeClearing: 0, - totalConsumed: 50, - totalPaid: 0, + totalConsumedPurchases: 50, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 4: { balance: 0, beforeClearing: -50, - totalConsumed: 50, - totalPaid: 0, + totalConsumedPurchases: 50, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: { 3: -50, }, @@ -229,50 +243,64 @@ describe("computeAccountBalances", () => { 1: { balance: 37.5, beforeClearing: 75, - totalConsumed: 62.5, - totalPaid: 100, + totalConsumedPurchases: 62.5, + totalPaidPurchases: 100, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 2: { balance: 37.5, beforeClearing: 75, - totalConsumed: 62.5, - totalPaid: 100, + totalConsumedPurchases: 62.5, + totalPaidPurchases: 100, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 3: { balance: -25, beforeClearing: 100, - totalConsumed: 125, - totalPaid: 100, + totalConsumedPurchases: 125, + totalPaidPurchases: 100, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 4: { balance: 0, beforeClearing: -50, - totalConsumed: 125, - totalPaid: 0, + totalConsumedPurchases: 125, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: { 3: -125 }, }, 5: { balance: 0, beforeClearing: -50, - totalConsumed: 150, - totalPaid: 0, + totalConsumedPurchases: 150, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: { 1: -37.5, 2: -37.5, 4: -75 }, }, 6: { balance: 0, beforeClearing: -100, - totalConsumed: 100, - totalPaid: 0, + totalConsumedPurchases: 100, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: { 5: -100 }, }, 7: { balance: -50, beforeClearing: -50, - totalConsumed: 50, - totalPaid: 0, + totalConsumedPurchases: 50, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, }; @@ -319,9 +347,11 @@ describe("computeAccountBalances", () => { expect(balances[2]).toStrictEqual({ balance: -100, beforeClearing: 0, - totalConsumed: 100, - totalPaid: 0, + totalConsumedPurchases: 100, + totalPaidPurchases: 0, clearingResolution: {}, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, }); }); }); @@ -332,22 +362,28 @@ describe("computeGroupSettlement", () => { 1: { balance: 50, beforeClearing: 50, - totalConsumed: 0, - totalPaid: 50, + totalConsumedPurchases: 0, + totalPaidPurchases: 50, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 2: { balance: -25, beforeClearing: -25, - totalConsumed: 25, - totalPaid: 0, + totalConsumedPurchases: 25, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 3: { balance: -25, beforeClearing: -25, - totalConsumed: 25, - totalPaid: 0, + totalConsumedPurchases: 25, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, }; @@ -362,71 +398,91 @@ describe("computeGroupSettlement", () => { 1: { balance: 100, beforeClearing: 100, - totalConsumed: 0, - totalPaid: 100, + totalConsumedPurchases: 0, + totalPaidPurchases: 100, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 2: { balance: -50, beforeClearing: -50, - totalConsumed: 50, - totalPaid: 0, + totalConsumedPurchases: 50, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 3: { balance: -30, beforeClearing: -30, - totalConsumed: 30, - totalPaid: 0, + totalConsumedPurchases: 30, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 4: { balance: -80, beforeClearing: -80, - totalConsumed: 80, - totalPaid: 0, + totalConsumedPurchases: 80, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 5: { balance: 50, beforeClearing: 50, - totalConsumed: 0, - totalPaid: 50, + totalConsumedPurchases: 0, + totalPaidPurchases: 50, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 6: { balance: -45, beforeClearing: -45, - totalConsumed: 45, - totalPaid: 0, + totalConsumedPurchases: 45, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 7: { balance: 65, beforeClearing: 65, - totalConsumed: 0, - totalPaid: 65, + totalConsumedPurchases: 0, + totalPaidPurchases: 65, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 8: { balance: -10, beforeClearing: -10, - totalConsumed: 10, - totalPaid: 0, + totalConsumedPurchases: 10, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 9: { balance: -60, beforeClearing: -60, - totalConsumed: 60, - totalPaid: 0, + totalConsumedPurchases: 60, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, 10: { balance: 60, beforeClearing: 60, - totalConsumed: 0, - totalPaid: 60, + totalConsumedPurchases: 0, + totalPaidPurchases: 60, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }, }; diff --git a/libs/core/src/lib/accounts.ts b/libs/core/src/lib/accounts.ts index 45bca445..e9437787 100644 --- a/libs/core/src/lib/accounts.ts +++ b/libs/core/src/lib/accounts.ts @@ -55,14 +55,19 @@ export const computeAccountBalances = (accounts: Account[], transactions: Transa balances[account.id] = { balance: 0, beforeClearing: 0, - totalConsumed: 0, - totalPaid: 0, + totalConsumedPurchases: 0, + totalPaidPurchases: 0, + totalReceivedTransfers: 0, + totalPaidTransfers: 0, clearingResolution: {}, }; return balances; }, {}); - const balanceEffects = transactions.map((t) => computeTransactionBalanceEffect(t)); + const balanceEffects: Array = transactions.map((t) => ({ + ...computeTransactionBalanceEffect(t), + transaction: t, + })); for (const balanceEffect of balanceEffects) { for (const accountIdStr in balanceEffect) { @@ -70,9 +75,17 @@ export const computeAccountBalances = (accounts: Account[], transactions: Transa const balance = accountBalances[accountId]; if (balance) { balance.balance += balanceEffect[accountId].total; - balance.totalConsumed += balanceEffect[accountId].commonDebitors + balanceEffect[accountId].positions; - balance.totalPaid += balanceEffect[accountId].commonCreditors; balance.beforeClearing = balance.balance; + if (balanceEffect.transaction.type === "transfer") { + balance.totalReceivedTransfers += + balanceEffect[accountId].commonDebitors + balanceEffect[accountId].positions; + balance.totalPaidTransfers += balanceEffect[accountId].commonCreditors; + } else { + // mimo or purchase + balance.totalConsumedPurchases += + balanceEffect[accountId].commonDebitors + balanceEffect[accountId].positions; + balance.totalPaidPurchases += balanceEffect[accountId].commonCreditors; + } } } } @@ -164,9 +177,11 @@ export const computeAccountBalances = (accounts: Account[], transactions: Transa if (accBalance) { accBalance.balance += accShare; if (accShare > 0) { - accBalance.totalPaid += Math.abs(accShare); + // TODO: this is not fully accurate since we assume here that no transfer was booked onto a clearing account + accBalance.totalPaidPurchases += Math.abs(accShare); } else { - accBalance.totalConsumed += Math.abs(accShare); + // TODO: this is not fully accurate since we assume here that no transfer was booked onto a clearing account + accBalance.totalConsumedPurchases += Math.abs(accShare); } } } diff --git a/libs/core/src/lib/transactions.test.ts b/libs/core/src/lib/transactions.spec.ts similarity index 100% rename from libs/core/src/lib/transactions.test.ts rename to libs/core/src/lib/transactions.spec.ts diff --git a/libs/translations/src/lib/en.json b/libs/translations/src/lib/en.json index cd50263c..4fdf0d16 100644 --- a/libs/translations/src/lib/en.json +++ b/libs/translations/src/lib/en.json @@ -208,7 +208,17 @@ }, "balances": { "tabTitle": "{{groupName}} - Balances", - "clearingAccountsRemainingBalances": "Some Events have remaining balances" + "clearingAccountsRemainingBalances": "Some Events have remaining balances", + "chartTabTitle": "Chart", + "statisticsTabTitle": "Statistics", + "totalGroupExpenses": "Total group expenses", + "totalGroupExpensesHelp": "Sum of all purchases", + "yourTotalDisbursements": "Your total disbursements", + "yourTotalDisbursementsHelp": "Sum of purchases paid by you", + "yourTotalExpenses": "Your contribution to group expenses", + "yourTotalExpensesHelp": "Sum of your share in group purchases", + "noOwnedAccountAlertTitle": "No account is assigned to you.", + "noOwnedAccountAlertBody": "Head over to the <1>group settings to claim an account and have individualized statistics shown here." }, "detail": { "tabTitleEvent": "{{group.name}} - Event {{account.name}}", diff --git a/libs/types/src/lib/accounts.ts b/libs/types/src/lib/accounts.ts index 70812b45..3a0615eb 100644 --- a/libs/types/src/lib/accounts.ts +++ b/libs/types/src/lib/accounts.ts @@ -36,8 +36,10 @@ export const AccountValidator = z.discriminatedUnion("type", [ export interface AccountBalance { balance: number; beforeClearing: number; - totalConsumed: number; - totalPaid: number; + totalConsumedPurchases: number; + totalPaidPurchases: number; + totalReceivedTransfers: number; + totalPaidTransfers: number; clearingResolution: { [k: number]: number }; }