From 2cff25c55b718c8800c6d3c8c3c76554f8ce5035 Mon Sep 17 00:00:00 2001 From: Alexander Zinn Date: Thu, 11 Dec 2025 02:24:01 -0500 Subject: [PATCH] Update formatting and improve consistency across configuration and documentation files - Adjusted formatting in .prettierrc for consistent newline handling. - Enhanced API documentation in BACKEND_PROMPT.md for better readability and structure. - Updated docker-compose.yml to standardize quotes and improve health check commands. - Refactored ESLint configuration for better readability and consistency. - Made minor formatting adjustments in various frontend components for improved user experience and code clarity. --- .prettierrc | 2 +- BACKEND_PROMPT.md | 176 +++++++++--------- backend-api/src/config/database.ts | 2 +- .../src/repositories/InvoiceRepository.ts | 8 +- docker-compose.yml | 13 +- eslint.config.js | 7 +- frontend-web/src/components/Layout.tsx | 3 +- .../src/components/ProtectedRoute.tsx | 1 - .../src/components/dialogs/AddAssetDialog.tsx | 2 +- .../components/dialogs/AddLiabilityDialog.tsx | 2 +- .../components/dialogs/EditAssetDialog.tsx | 2 +- .../dialogs/EditLiabilityDialog.tsx | 2 +- .../src/components/dialogs/LoginDialog.tsx | 4 +- .../src/components/dialogs/SignUpDialog.tsx | 9 +- frontend-web/src/lib/api/auth.service.ts | 2 +- frontend-web/src/lib/api/cashflow.service.ts | 6 +- frontend-web/src/lib/api/client.ts | 16 +- frontend-web/src/lib/api/networth.service.ts | 14 +- frontend-web/src/lib/api/token.ts | 2 +- frontend-web/src/pages/LandingPage.tsx | 52 +++--- .../src/store/slices/cashflowSlice.ts | 17 +- .../src/store/slices/netWorthSlice.ts | 10 +- 22 files changed, 173 insertions(+), 179 deletions(-) diff --git a/.prettierrc b/.prettierrc index 5d0b59a..caa814d 100644 --- a/.prettierrc +++ b/.prettierrc @@ -9,4 +9,4 @@ "tabWidth": 2, "trailingComma": "none", "useTabs": false -} \ No newline at end of file +} diff --git a/BACKEND_PROMPT.md b/BACKEND_PROMPT.md index feb244e..05fa251 100644 --- a/BACKEND_PROMPT.md +++ b/BACKEND_PROMPT.md @@ -252,127 +252,127 @@ All API routes are prefixed with `/api` to avoid conflicts with frontend routes. ### Authentication -| Method | Endpoint | Description | -|--------|----------|-------------| -| POST | `/api/auth/register` | Register new user | -| POST | `/api/auth/login` | Login, returns JWT + refresh token | -| POST | `/api/auth/refresh` | Refresh access token | -| POST | `/api/auth/logout` | Invalidate refresh token | -| GET | `/api/auth/me` | Get current user profile | +| Method | Endpoint | Description | +| ------ | -------------------- | ---------------------------------- | +| POST | `/api/auth/register` | Register new user | +| POST | `/api/auth/login` | Login, returns JWT + refresh token | +| POST | `/api/auth/refresh` | Refresh access token | +| POST | `/api/auth/logout` | Invalidate refresh token | +| GET | `/api/auth/me` | Get current user profile | ### Assets -| Method | Endpoint | Description | -|--------|----------|-------------| -| GET | `/api/assets` | List all assets for user | -| POST | `/api/assets` | Create new asset | -| GET | `/api/assets/:id` | Get asset by ID | -| PUT | `/api/assets/:id` | Update asset | -| DELETE | `/api/assets/:id` | Delete asset | +| Method | Endpoint | Description | +| ------ | ----------------- | ------------------------ | +| GET | `/api/assets` | List all assets for user | +| POST | `/api/assets` | Create new asset | +| GET | `/api/assets/:id` | Get asset by ID | +| PUT | `/api/assets/:id` | Update asset | +| DELETE | `/api/assets/:id` | Delete asset | ### Liabilities -| Method | Endpoint | Description | -|--------|----------|-------------| -| GET | `/api/liabilities` | List all liabilities for user | -| POST | `/api/liabilities` | Create new liability | -| GET | `/api/liabilities/:id` | Get liability by ID | -| PUT | `/api/liabilities/:id` | Update liability | -| DELETE | `/api/liabilities/:id` | Delete liability | +| Method | Endpoint | Description | +| ------ | ---------------------- | ----------------------------- | +| GET | `/api/liabilities` | List all liabilities for user | +| POST | `/api/liabilities` | Create new liability | +| GET | `/api/liabilities/:id` | Get liability by ID | +| PUT | `/api/liabilities/:id` | Update liability | +| DELETE | `/api/liabilities/:id` | Delete liability | ### Net Worth Snapshots -| Method | Endpoint | Description | -|--------|----------|-------------| -| GET | `/api/net-worth/snapshots` | List snapshots (with date range filter) | -| POST | `/api/net-worth/snapshots` | Create snapshot (auto-calculates totals) | -| GET | `/api/net-worth/current` | Get current net worth calculation | +| Method | Endpoint | Description | +| ------ | -------------------------- | ---------------------------------------- | +| GET | `/api/net-worth/snapshots` | List snapshots (with date range filter) | +| POST | `/api/net-worth/snapshots` | Create snapshot (auto-calculates totals) | +| GET | `/api/net-worth/current` | Get current net worth calculation | ### Debt Categories -| Method | Endpoint | Description | -|--------|----------|-------------| -| GET | `/api/debts/categories` | List all categories | -| POST | `/api/debts/categories` | Create category | -| PUT | `/api/debts/categories/:id` | Update category | +| Method | Endpoint | Description | +| ------ | --------------------------- | ------------------------------------------- | +| GET | `/api/debts/categories` | List all categories | +| POST | `/api/debts/categories` | Create category | +| PUT | `/api/debts/categories/:id` | Update category | | DELETE | `/api/debts/categories/:id` | Delete category (moves accounts to "Other") | ### Debt Accounts -| Method | Endpoint | Description | -|--------|----------|-------------| -| GET | `/api/debts/accounts` | List all debt accounts | -| POST | `/api/debts/accounts` | Create debt account | -| GET | `/api/debts/accounts/:id` | Get account with payment history | -| PUT | `/api/debts/accounts/:id` | Update account | -| DELETE | `/api/debts/accounts/:id` | Delete account | +| Method | Endpoint | Description | +| ------ | ------------------------- | -------------------------------- | +| GET | `/api/debts/accounts` | List all debt accounts | +| POST | `/api/debts/accounts` | Create debt account | +| GET | `/api/debts/accounts/:id` | Get account with payment history | +| PUT | `/api/debts/accounts/:id` | Update account | +| DELETE | `/api/debts/accounts/:id` | Delete account | ### Debt Payments -| Method | Endpoint | Description | -|--------|----------|-------------| -| GET | `/api/debts/accounts/:id/payments` | List payments for account | -| POST | `/api/debts/accounts/:id/payments` | Record payment (updates balance) | -| DELETE | `/api/debts/payments/:id` | Delete payment (restores balance) | +| Method | Endpoint | Description | +| ------ | ---------------------------------- | --------------------------------- | +| GET | `/api/debts/accounts/:id/payments` | List payments for account | +| POST | `/api/debts/accounts/:id/payments` | Record payment (updates balance) | +| DELETE | `/api/debts/payments/:id` | Delete payment (restores balance) | ### Clients -| Method | Endpoint | Description | -|--------|----------|-------------| -| GET | `/api/clients` | List all clients | -| POST | `/api/clients` | Create client | -| GET | `/api/clients/:id` | Get client with invoice stats | -| PUT | `/api/clients/:id` | Update client | -| DELETE | `/api/clients/:id` | Delete client | +| Method | Endpoint | Description | +| ------ | ------------------ | ----------------------------- | +| GET | `/api/clients` | List all clients | +| POST | `/api/clients` | Create client | +| GET | `/api/clients/:id` | Get client with invoice stats | +| PUT | `/api/clients/:id` | Update client | +| DELETE | `/api/clients/:id` | Delete client | ### Invoices -| Method | Endpoint | Description | -|--------|----------|-------------| -| GET | `/api/invoices` | List invoices (filterable by status, client) | -| POST | `/api/invoices` | Create invoice with line items | -| GET | `/api/invoices/:id` | Get invoice with line items | -| PUT | `/api/invoices/:id` | Update invoice | -| PATCH | `/api/invoices/:id/status` | Update invoice status only | -| DELETE | `/api/invoices/:id` | Delete invoice | +| Method | Endpoint | Description | +| ------ | -------------------------- | -------------------------------------------- | +| GET | `/api/invoices` | List invoices (filterable by status, client) | +| POST | `/api/invoices` | Create invoice with line items | +| GET | `/api/invoices/:id` | Get invoice with line items | +| PUT | `/api/invoices/:id` | Update invoice | +| PATCH | `/api/invoices/:id/status` | Update invoice status only | +| DELETE | `/api/invoices/:id` | Delete invoice | ### Income Sources -| Method | Endpoint | Description | -|--------|----------|-------------| -| GET | `/api/cashflow/income` | List income sources | -| POST | `/api/cashflow/income` | Create income source | -| PUT | `/api/cashflow/income/:id` | Update income source | +| Method | Endpoint | Description | +| ------ | -------------------------- | -------------------- | +| GET | `/api/cashflow/income` | List income sources | +| POST | `/api/cashflow/income` | Create income source | +| PUT | `/api/cashflow/income/:id` | Update income source | | DELETE | `/api/cashflow/income/:id` | Delete income source | ### Expenses -| Method | Endpoint | Description | -|--------|----------|-------------| -| GET | `/api/cashflow/expenses` | List expenses | -| POST | `/api/cashflow/expenses` | Create expense | -| PUT | `/api/cashflow/expenses/:id` | Update expense | +| Method | Endpoint | Description | +| ------ | ---------------------------- | -------------- | +| GET | `/api/cashflow/expenses` | List expenses | +| POST | `/api/cashflow/expenses` | Create expense | +| PUT | `/api/cashflow/expenses/:id` | Update expense | | DELETE | `/api/cashflow/expenses/:id` | Delete expense | ### Transactions -| Method | Endpoint | Description | -|--------|----------|-------------| -| GET | `/api/cashflow/transactions` | List transactions (with date range, pagination) | -| POST | `/api/cashflow/transactions` | Create transaction | -| DELETE | `/api/cashflow/transactions/:id` | Delete transaction | +| Method | Endpoint | Description | +| ------ | -------------------------------- | ----------------------------------------------- | +| GET | `/api/cashflow/transactions` | List transactions (with date range, pagination) | +| POST | `/api/cashflow/transactions` | Create transaction | +| DELETE | `/api/cashflow/transactions/:id` | Delete transaction | ### Dashboard / Summary -| Method | Endpoint | Description | -|--------|----------|-------------| -| GET | `/api/dashboard/summary` | Get aggregated summary stats | +| Method | Endpoint | Description | +| ------ | ------------------------ | ---------------------------- | +| GET | `/api/dashboard/summary` | Get aggregated summary stats | ### Health Check -| Method | Endpoint | Description | -|--------|----------|-------------| -| GET | `/api/health` | Health check (no auth required) | +| Method | Endpoint | Description | +| ------ | ------------- | ------------------------------- | +| GET | `/api/health` | Health check (no auth required) | --- @@ -390,9 +390,10 @@ All API routes are prefixed with `/api` to avoid conflicts with frontend routes. - Store refresh token hash in DB or Redis 3. **JWT Payload:** + ```typescript interface JWTPayload { - sub: string; // user ID + sub: string; // user ID email: string; iat: number; exp: number; @@ -521,13 +522,13 @@ import path from 'path'; if (process.env.NODE_ENV === 'production') { app.register(fastifyStatic, { root: path.join(__dirname, '../public'), - prefix: '/', + prefix: '/' }); // SPA fallback - serve index.html for all non-API routes app.setNotFoundHandler((request, reply) => { if (request.url.startsWith('/api')) { - reply.status(404).send({ success: false, error: { code: 'NOT_FOUND', message: 'Route not found' } }); + reply.status(404).send({success: false, error: {code: 'NOT_FOUND', message: 'Route not found'}}); } else { reply.sendFile('index.html'); } @@ -535,9 +536,9 @@ if (process.env.NODE_ENV === 'production') { } // Register all API routes with /api prefix -app.register(authRoutes, { prefix: '/api/auth' }); -app.register(assetsRoutes, { prefix: '/api/assets' }); -app.register(liabilitiesRoutes, { prefix: '/api/liabilities' }); +app.register(authRoutes, {prefix: '/api/auth'}); +app.register(assetsRoutes, {prefix: '/api/assets'}); +app.register(liabilitiesRoutes, {prefix: '/api/liabilities'}); // ... etc ``` @@ -641,14 +642,14 @@ services: POSTGRES_PASSWORD: wealth_dev POSTGRES_DB: wealth ports: - - "5432:5432" + - '5432:5432' volumes: - postgres_data:/var/lib/postgresql/data api: build: . ports: - - "3000:3000" + - '3000:3000' environment: DATABASE_URL: postgresql://wealth:wealth_dev@db:5432/wealth JWT_SECRET: dev-secret-change-in-production @@ -807,4 +808,3 @@ interface Transaction { note?: string; } ``` - diff --git a/backend-api/src/config/database.ts b/backend-api/src/config/database.ts index bf45b87..ed33670 100644 --- a/backend-api/src/config/database.ts +++ b/backend-api/src/config/database.ts @@ -12,7 +12,7 @@ class DatabaseConnection { public static getInstance(): PrismaClient { if (!DatabaseConnection.instance) { DatabaseConnection.instance = new PrismaClient({ - log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'], + log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'] }); } diff --git a/backend-api/src/repositories/InvoiceRepository.ts b/backend-api/src/repositories/InvoiceRepository.ts index 7b176f1..0bb7fd5 100644 --- a/backend-api/src/repositories/InvoiceRepository.ts +++ b/backend-api/src/repositories/InvoiceRepository.ts @@ -94,12 +94,8 @@ export class InvoiceRepository implements IUserScopedRepository { const now = new Date(); const totalInvoices = invoices.length; const paidInvoices = invoices.filter(inv => inv.status === 'paid').length; - const outstandingAmount = invoices - .filter(inv => inv.status !== 'paid' && inv.status !== 'cancelled') - .reduce((sum, inv) => sum + inv.total, 0); - const overdueInvoices = invoices.filter( - inv => inv.status !== 'paid' && inv.status !== 'cancelled' && inv.dueDate < now - ).length; + const outstandingAmount = invoices.filter(inv => inv.status !== 'paid' && inv.status !== 'cancelled').reduce((sum, inv) => sum + inv.total, 0); + const overdueInvoices = invoices.filter(inv => inv.status !== 'paid' && inv.status !== 'cancelled' && inv.dueDate < now).length; return {totalInvoices, paidInvoices, outstandingAmount, overdueInvoices}; } diff --git a/docker-compose.yml b/docker-compose.yml index 9ab36b5..3707d3e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,11 +10,11 @@ services: POSTGRES_PASSWORD: wealth_dev POSTGRES_DB: wealth_dev ports: - - "5432:5432" + - '5432:5432' volumes: - postgres_dev_data:/var/lib/postgresql/data healthcheck: - test: ["CMD-SHELL", "pg_isready -U wealth -d wealth_dev"] + test: ['CMD-SHELL', 'pg_isready -U wealth -d wealth_dev'] interval: 10s timeout: 5s retries: 5 @@ -28,11 +28,11 @@ services: POSTGRES_PASSWORD: ${STAGING_DB_PASSWORD:-wealth_staging} POSTGRES_DB: wealth_staging ports: - - "5433:5432" + - '5433:5432' volumes: - postgres_staging_data:/var/lib/postgresql/data healthcheck: - test: ["CMD-SHELL", "pg_isready -U wealth -d wealth_staging"] + test: ['CMD-SHELL', 'pg_isready -U wealth -d wealth_staging'] interval: 10s timeout: 5s retries: 5 @@ -46,11 +46,11 @@ services: POSTGRES_PASSWORD: ${PROD_DB_PASSWORD:?PROD_DB_PASSWORD is required} POSTGRES_DB: wealth_prod ports: - - "5434:5432" + - '5434:5432' volumes: - postgres_prod_data:/var/lib/postgresql/data healthcheck: - test: ["CMD-SHELL", "pg_isready -U wealth -d wealth_prod"] + test: ['CMD-SHELL', 'pg_isready -U wealth -d wealth_prod'] interval: 10s timeout: 5s retries: 5 @@ -63,4 +63,3 @@ volumes: postgres_dev_data: postgres_staging_data: postgres_prod_data: - diff --git a/eslint.config.js b/eslint.config.js index b3047df..baf2e3f 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -28,12 +28,7 @@ export default defineConfig([ // Frontend Web - TypeScript/React files { files: ['frontend-web/**/*.{ts,tsx}'], - extends: [ - js.configs.recommended, - tseslint.configs.recommended, - reactHooks.configs.flat.recommended, - reactRefresh.configs.vite - ], + extends: [js.configs.recommended, tseslint.configs.recommended, reactHooks.configs.flat.recommended, reactRefresh.configs.vite], languageOptions: { ecmaVersion: 2020, globals: globals.browser diff --git a/frontend-web/src/components/Layout.tsx b/frontend-web/src/components/Layout.tsx index 56e5988..a3078b3 100644 --- a/frontend-web/src/components/Layout.tsx +++ b/frontend-web/src/components/Layout.tsx @@ -57,8 +57,7 @@ export default function Layout() { diff --git a/frontend-web/src/components/ProtectedRoute.tsx b/frontend-web/src/components/ProtectedRoute.tsx index dc4a08d..d11192f 100644 --- a/frontend-web/src/components/ProtectedRoute.tsx +++ b/frontend-web/src/components/ProtectedRoute.tsx @@ -10,4 +10,3 @@ export default function ProtectedRoute() { return ; } - diff --git a/frontend-web/src/components/dialogs/AddAssetDialog.tsx b/frontend-web/src/components/dialogs/AddAssetDialog.tsx index a1e3b4b..382e84d 100644 --- a/frontend-web/src/components/dialogs/AddAssetDialog.tsx +++ b/frontend-web/src/components/dialogs/AddAssetDialog.tsx @@ -50,7 +50,7 @@ export default function AddAssetDialog({open, onOpenChange}: Props) { createAsset({ name: sanitizeString(form.name), type: form.type.toUpperCase() as 'CASH' | 'INVESTMENT' | 'PROPERTY' | 'VEHICLE' | 'OTHER', - value: valueNum, + value: valueNum }) ); onOpenChange(false); diff --git a/frontend-web/src/components/dialogs/AddLiabilityDialog.tsx b/frontend-web/src/components/dialogs/AddLiabilityDialog.tsx index cf235b5..e067379 100644 --- a/frontend-web/src/components/dialogs/AddLiabilityDialog.tsx +++ b/frontend-web/src/components/dialogs/AddLiabilityDialog.tsx @@ -23,7 +23,7 @@ export default function AddLiabilityDialog({open, onOpenChange}: Props) { createLiability({ name: form.name, type: form.type.toUpperCase() as 'CREDIT_CARD' | 'LOAN' | 'MORTGAGE' | 'OTHER', - currentBalance: parseFloat(form.balance) || 0, + currentBalance: parseFloat(form.balance) || 0 }) ); onOpenChange(false); diff --git a/frontend-web/src/components/dialogs/EditAssetDialog.tsx b/frontend-web/src/components/dialogs/EditAssetDialog.tsx index 7f5f612..50b9202 100644 --- a/frontend-web/src/components/dialogs/EditAssetDialog.tsx +++ b/frontend-web/src/components/dialogs/EditAssetDialog.tsx @@ -66,7 +66,7 @@ export default function EditAssetDialog({open, onOpenChange, asset}: Props) { data: { name: form.name.trim(), type: form.type.toUpperCase() as 'CASH' | 'INVESTMENT' | 'PROPERTY' | 'VEHICLE' | 'OTHER', - value: valueNum, + value: valueNum } }) ); diff --git a/frontend-web/src/components/dialogs/EditLiabilityDialog.tsx b/frontend-web/src/components/dialogs/EditLiabilityDialog.tsx index 8aec0dd..7fa64c8 100644 --- a/frontend-web/src/components/dialogs/EditLiabilityDialog.tsx +++ b/frontend-web/src/components/dialogs/EditLiabilityDialog.tsx @@ -66,7 +66,7 @@ export default function EditLiabilityDialog({open, onOpenChange, liability}: Pro data: { name: form.name.trim(), type: form.type.toUpperCase() as 'CREDIT_CARD' | 'LOAN' | 'MORTGAGE' | 'OTHER', - currentBalance: balanceNum, + currentBalance: balanceNum } }) ); diff --git a/frontend-web/src/components/dialogs/LoginDialog.tsx b/frontend-web/src/components/dialogs/LoginDialog.tsx index 38bd6be..eb5b1a4 100644 --- a/frontend-web/src/components/dialogs/LoginDialog.tsx +++ b/frontend-web/src/components/dialogs/LoginDialog.tsx @@ -16,7 +16,7 @@ export default function LoginDialog({open, onOpenChange, onSwitchToSignUp}: Prop const dispatch = useAppDispatch(); const [form, setForm] = useState({ email: '', - password: '', + password: '' }); const [error, setError] = useState(''); const [isLoading, setIsLoading] = useState(false); @@ -36,7 +36,7 @@ export default function LoginDialog({open, onOpenChange, onSwitchToSignUp}: Prop await dispatch( loginUser({ email: form.email, - password: form.password, + password: form.password }) ).unwrap(); diff --git a/frontend-web/src/components/dialogs/SignUpDialog.tsx b/frontend-web/src/components/dialogs/SignUpDialog.tsx index d14093a..916bfa6 100644 --- a/frontend-web/src/components/dialogs/SignUpDialog.tsx +++ b/frontend-web/src/components/dialogs/SignUpDialog.tsx @@ -18,7 +18,7 @@ export default function SignUpDialog({open, onOpenChange, onSwitchToLogin}: Prop name: '', email: '', password: '', - confirmPassword: '', + confirmPassword: '' }); const [error, setError] = useState(''); const [isLoading, setIsLoading] = useState(false); @@ -45,7 +45,7 @@ export default function SignUpDialog({open, onOpenChange, onSwitchToLogin}: Prop registerUser({ email: form.email, password: form.password, - name: form.name, + name: form.name }) ).unwrap(); @@ -117,9 +117,7 @@ export default function SignUpDialog({open, onOpenChange, onSwitchToLogin}: Prop /> {error &&

{error}

} -

- By signing up, you agree to our Terms of Service and Privacy Policy. -

+

By signing up, you agree to our Terms of Service and Privacy Policy.

@@ -116,11 +112,10 @@ export default function LandingPage() {

- Disclaimer: This application is for informational and personal tracking purposes only. - It does not constitute financial, investment, tax, or legal advice. The information provided should not - be relied upon for making financial decisions. Always consult with qualified professionals before making - any financial decisions. We make no guarantees about the accuracy or completeness of the data you enter - or the calculations performed. Use at your own risk. Past performance is not indicative of future results. + Disclaimer: This application is for informational and personal tracking purposes only. It does not constitute financial, + investment, tax, or legal advice. The information provided should not be relied upon for making financial decisions. Always consult with qualified + professionals before making any financial decisions. We make no guarantees about the accuracy or completeness of the data you enter or the + calculations performed. Use at your own risk. Past performance is not indicative of future results.

@@ -136,9 +131,22 @@ export default function LandingPage() { - { setLoginOpen(false); setSignUpOpen(true); }} /> - { setSignUpOpen(false); setLoginOpen(true); }} /> + { + setLoginOpen(false); + setSignUpOpen(true); + }} + /> + { + setSignUpOpen(false); + setLoginOpen(true); + }} + /> ); } - diff --git a/frontend-web/src/store/slices/cashflowSlice.ts b/frontend-web/src/store/slices/cashflowSlice.ts index 2e17e53..149ef41 100644 --- a/frontend-web/src/store/slices/cashflowSlice.ts +++ b/frontend-web/src/store/slices/cashflowSlice.ts @@ -1,5 +1,12 @@ import {createSlice, createAsyncThunk, type PayloadAction} from '@reduxjs/toolkit'; -import {incomeService, expenseService, transactionService, type IncomeSource as ApiIncome, type Expense as ApiExpense, type Transaction as ApiTransaction} from '@/lib/api/cashflow.service'; +import { + incomeService, + expenseService, + transactionService, + type IncomeSource as ApiIncome, + type Expense as ApiExpense, + type Transaction as ApiTransaction +} from '@/lib/api/cashflow.service'; export interface IncomeSource { id: string; @@ -66,7 +73,7 @@ const mapApiIncomeToIncome = (apiIncome: ApiIncome): IncomeSource => ({ category: 'Income', nextDate: new Date().toISOString(), isActive: true, - createdAt: apiIncome.createdAt || new Date().toISOString(), + createdAt: apiIncome.createdAt || new Date().toISOString() }); const mapApiExpenseToExpense = (apiExpense: ApiExpense): Expense => ({ @@ -78,7 +85,7 @@ const mapApiExpenseToExpense = (apiExpense: ApiExpense): Expense => ({ nextDate: new Date().toISOString(), isActive: true, isEssential: apiExpense.isEssential || false, - createdAt: apiExpense.createdAt || new Date().toISOString(), + createdAt: apiExpense.createdAt || new Date().toISOString() }); const mapApiTransactionToTransaction = (apiTransaction: ApiTransaction): Transaction => ({ @@ -88,7 +95,7 @@ const mapApiTransactionToTransaction = (apiTransaction: ApiTransaction): Transac amount: apiTransaction.amount, category: apiTransaction.category || 'Other', date: apiTransaction.date, - note: apiTransaction.notes, + note: apiTransaction.notes }); // Async thunks @@ -210,7 +217,7 @@ const cashflowSlice = createSlice({ state.isLoading = false; state.error = action.payload as string; }); - }, + } }); export const { diff --git a/frontend-web/src/store/slices/netWorthSlice.ts b/frontend-web/src/store/slices/netWorthSlice.ts index cd20d89..399e7ce 100644 --- a/frontend-web/src/store/slices/netWorthSlice.ts +++ b/frontend-web/src/store/slices/netWorthSlice.ts @@ -8,7 +8,7 @@ import { type CreateAssetRequest, type UpdateAssetRequest, type CreateLiabilityRequest, - type UpdateLiabilityRequest, + type UpdateLiabilityRequest } from '@/lib/api/networth.service'; export interface Asset { @@ -57,7 +57,7 @@ const mapApiAssetToAsset = (apiAsset: ApiAsset): Asset => ({ name: apiAsset.name, type: apiAsset.type.toLowerCase() as Asset['type'], value: apiAsset.value, - updatedAt: apiAsset.updatedAt || new Date().toISOString(), + updatedAt: apiAsset.updatedAt || new Date().toISOString() }); const mapApiLiabilityToLiability = (apiLiability: ApiLiability): Liability => ({ @@ -65,7 +65,7 @@ const mapApiLiabilityToLiability = (apiLiability: ApiLiability): Liability => ({ name: apiLiability.name, type: apiLiability.type.toLowerCase() as Liability['type'], balance: apiLiability.currentBalance, - updatedAt: apiLiability.updatedAt || new Date().toISOString(), + updatedAt: apiLiability.updatedAt || new Date().toISOString() }); // Async thunks for assets @@ -191,7 +191,7 @@ const netWorthSlice = createSlice({ }, setError: (state, action: PayloadAction) => { state.error = action.payload; - }, + } }, extraReducers: builder => { // Fetch assets @@ -267,7 +267,7 @@ const netWorthSlice = createSlice({ state.isLoading = false; state.error = action.payload as string; }); - }, + } }); export const {setLoading, setError} = netWorthSlice.actions;