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.
This commit is contained in:
2025-12-11 02:24:01 -05:00
parent 51074d02a9
commit 2cff25c55b
22 changed files with 173 additions and 179 deletions

View File

@@ -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;
}
```