Add lock files for package management and update architecture documentation
- Introduced bun.lock and package-lock.json to manage dependencies for the project. - Enhanced backend API architecture documentation with additional security and documentation guidelines. - Made minor formatting adjustments across various files for consistency and clarity.
This commit is contained in:
@@ -16,9 +16,9 @@ export async function assetRoutes(fastify: FastifyInstance) {
|
||||
schema: {
|
||||
tags: ['Assets'],
|
||||
description: 'Get all user assets',
|
||||
security: [{bearerAuth: []}],
|
||||
security: [{bearerAuth: []}]
|
||||
},
|
||||
handler: controller.getAll.bind(controller),
|
||||
handler: controller.getAll.bind(controller)
|
||||
});
|
||||
|
||||
fastify.get('/:id', {
|
||||
@@ -29,11 +29,11 @@ export async function assetRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string', format: 'uuid'},
|
||||
},
|
||||
},
|
||||
id: {type: 'string', format: 'uuid'}
|
||||
}
|
||||
}
|
||||
},
|
||||
handler: controller.getById.bind(controller),
|
||||
handler: controller.getById.bind(controller)
|
||||
});
|
||||
|
||||
fastify.post('/', {
|
||||
@@ -47,11 +47,11 @@ export async function assetRoutes(fastify: FastifyInstance) {
|
||||
properties: {
|
||||
name: {type: 'string'},
|
||||
type: {type: 'string', enum: ['CASH', 'INVESTMENT', 'PROPERTY', 'VEHICLE', 'OTHER']},
|
||||
value: {type: 'number', minimum: 0},
|
||||
},
|
||||
},
|
||||
value: {type: 'number', minimum: 0}
|
||||
}
|
||||
}
|
||||
},
|
||||
handler: controller.create.bind(controller),
|
||||
handler: controller.create.bind(controller)
|
||||
});
|
||||
|
||||
fastify.put('/:id', {
|
||||
@@ -62,19 +62,19 @@ export async function assetRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string', format: 'uuid'},
|
||||
},
|
||||
id: {type: 'string', format: 'uuid'}
|
||||
}
|
||||
},
|
||||
body: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: {type: 'string'},
|
||||
type: {type: 'string', enum: ['CASH', 'INVESTMENT', 'PROPERTY', 'VEHICLE', 'OTHER']},
|
||||
value: {type: 'number', minimum: 0},
|
||||
},
|
||||
},
|
||||
value: {type: 'number', minimum: 0}
|
||||
}
|
||||
}
|
||||
},
|
||||
handler: controller.update.bind(controller),
|
||||
handler: controller.update.bind(controller)
|
||||
});
|
||||
|
||||
fastify.delete('/:id', {
|
||||
@@ -85,10 +85,10 @@ export async function assetRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string', format: 'uuid'},
|
||||
},
|
||||
},
|
||||
id: {type: 'string', format: 'uuid'}
|
||||
}
|
||||
}
|
||||
},
|
||||
handler: controller.delete.bind(controller),
|
||||
handler: controller.delete.bind(controller)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,11 +18,11 @@ export async function authRoutes(fastify: FastifyInstance) {
|
||||
properties: {
|
||||
email: {type: 'string', format: 'email'},
|
||||
password: {type: 'string', minLength: 8},
|
||||
name: {type: 'string', minLength: 1},
|
||||
},
|
||||
},
|
||||
name: {type: 'string', minLength: 1}
|
||||
}
|
||||
}
|
||||
},
|
||||
handler: controller.register.bind(controller),
|
||||
handler: controller.register.bind(controller)
|
||||
});
|
||||
|
||||
fastify.post('/login', {
|
||||
@@ -34,20 +34,20 @@ export async function authRoutes(fastify: FastifyInstance) {
|
||||
required: ['email', 'password'],
|
||||
properties: {
|
||||
email: {type: 'string', format: 'email'},
|
||||
password: {type: 'string'},
|
||||
},
|
||||
},
|
||||
password: {type: 'string'}
|
||||
}
|
||||
}
|
||||
},
|
||||
handler: controller.login.bind(controller),
|
||||
handler: controller.login.bind(controller)
|
||||
});
|
||||
|
||||
fastify.get('/profile', {
|
||||
schema: {
|
||||
tags: ['Authentication'],
|
||||
description: 'Get current user profile',
|
||||
security: [{bearerAuth: []}],
|
||||
security: [{bearerAuth: []}]
|
||||
},
|
||||
preHandler: authenticate,
|
||||
handler: controller.getProfile.bind(controller),
|
||||
handler: controller.getProfile.bind(controller)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import {FastifyInstance} from 'fastify';
|
||||
import {CashflowController} from '../controllers/CashflowController';
|
||||
import {CashflowService} from '../services/CashflowService';
|
||||
import {
|
||||
IncomeSourceRepository,
|
||||
ExpenseRepository,
|
||||
TransactionRepository,
|
||||
} from '../repositories/CashflowRepository';
|
||||
import {IncomeSourceRepository, ExpenseRepository, TransactionRepository} from '../repositories/CashflowRepository';
|
||||
import {authenticate} from '../middleware/auth';
|
||||
|
||||
const incomeRepository = new IncomeSourceRepository();
|
||||
@@ -19,199 +15,267 @@ export async function cashflowRoutes(fastify: FastifyInstance) {
|
||||
|
||||
// ===== Income Source Routes =====
|
||||
|
||||
fastify.get('/income', {
|
||||
schema: {
|
||||
description: 'Get all income sources',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
fastify.get(
|
||||
'/income',
|
||||
{
|
||||
schema: {
|
||||
description: 'Get all income sources',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}]
|
||||
}
|
||||
},
|
||||
}, cashflowController.getAllIncome.bind(cashflowController));
|
||||
cashflowController.getAllIncome.bind(cashflowController)
|
||||
);
|
||||
|
||||
fastify.get('/income/total', {
|
||||
schema: {
|
||||
description: 'Get total monthly income',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
fastify.get(
|
||||
'/income/total',
|
||||
{
|
||||
schema: {
|
||||
description: 'Get total monthly income',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}]
|
||||
}
|
||||
},
|
||||
}, cashflowController.getTotalMonthlyIncome.bind(cashflowController));
|
||||
cashflowController.getTotalMonthlyIncome.bind(cashflowController)
|
||||
);
|
||||
|
||||
fastify.get('/income/:id', {
|
||||
schema: {
|
||||
description: 'Get income source by ID',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
fastify.get(
|
||||
'/income/:id',
|
||||
{
|
||||
schema: {
|
||||
description: 'Get income source by ID',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}]
|
||||
}
|
||||
},
|
||||
}, cashflowController.getOneIncome.bind(cashflowController));
|
||||
cashflowController.getOneIncome.bind(cashflowController)
|
||||
);
|
||||
|
||||
fastify.post('/income', {
|
||||
schema: {
|
||||
description: 'Create income source',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
body: {
|
||||
type: 'object',
|
||||
required: ['name', 'amount', 'frequency'],
|
||||
properties: {
|
||||
name: {type: 'string'},
|
||||
amount: {type: 'number'},
|
||||
frequency: {type: 'string'},
|
||||
notes: {type: 'string'},
|
||||
},
|
||||
},
|
||||
fastify.post(
|
||||
'/income',
|
||||
{
|
||||
schema: {
|
||||
description: 'Create income source',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
body: {
|
||||
type: 'object',
|
||||
required: ['name', 'amount', 'frequency'],
|
||||
properties: {
|
||||
name: {type: 'string'},
|
||||
amount: {type: 'number'},
|
||||
frequency: {type: 'string'},
|
||||
notes: {type: 'string'}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}, cashflowController.createIncome.bind(cashflowController));
|
||||
cashflowController.createIncome.bind(cashflowController)
|
||||
);
|
||||
|
||||
fastify.put('/income/:id', {
|
||||
schema: {
|
||||
description: 'Update income source',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
fastify.put(
|
||||
'/income/:id',
|
||||
{
|
||||
schema: {
|
||||
description: 'Update income source',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}]
|
||||
}
|
||||
},
|
||||
}, cashflowController.updateIncome.bind(cashflowController));
|
||||
cashflowController.updateIncome.bind(cashflowController)
|
||||
);
|
||||
|
||||
fastify.delete('/income/:id', {
|
||||
schema: {
|
||||
description: 'Delete income source',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
fastify.delete(
|
||||
'/income/:id',
|
||||
{
|
||||
schema: {
|
||||
description: 'Delete income source',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}]
|
||||
}
|
||||
},
|
||||
}, cashflowController.deleteIncome.bind(cashflowController));
|
||||
cashflowController.deleteIncome.bind(cashflowController)
|
||||
);
|
||||
|
||||
// ===== Expense Routes =====
|
||||
|
||||
fastify.get('/expenses', {
|
||||
schema: {
|
||||
description: 'Get all expenses',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
querystring: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
byCategory: {type: 'string', enum: ['true', 'false']},
|
||||
},
|
||||
},
|
||||
fastify.get(
|
||||
'/expenses',
|
||||
{
|
||||
schema: {
|
||||
description: 'Get all expenses',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
querystring: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
byCategory: {type: 'string', enum: ['true', 'false']}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}, cashflowController.getAllExpenses.bind(cashflowController));
|
||||
cashflowController.getAllExpenses.bind(cashflowController)
|
||||
);
|
||||
|
||||
fastify.get('/expenses/total', {
|
||||
schema: {
|
||||
description: 'Get total monthly expenses',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
fastify.get(
|
||||
'/expenses/total',
|
||||
{
|
||||
schema: {
|
||||
description: 'Get total monthly expenses',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}]
|
||||
}
|
||||
},
|
||||
}, cashflowController.getTotalMonthlyExpenses.bind(cashflowController));
|
||||
cashflowController.getTotalMonthlyExpenses.bind(cashflowController)
|
||||
);
|
||||
|
||||
fastify.get('/expenses/:id', {
|
||||
schema: {
|
||||
description: 'Get expense by ID',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
fastify.get(
|
||||
'/expenses/:id',
|
||||
{
|
||||
schema: {
|
||||
description: 'Get expense by ID',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}]
|
||||
}
|
||||
},
|
||||
}, cashflowController.getOneExpense.bind(cashflowController));
|
||||
cashflowController.getOneExpense.bind(cashflowController)
|
||||
);
|
||||
|
||||
fastify.post('/expenses', {
|
||||
schema: {
|
||||
description: 'Create expense',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
body: {
|
||||
type: 'object',
|
||||
required: ['name', 'amount', 'category', 'frequency'],
|
||||
properties: {
|
||||
name: {type: 'string'},
|
||||
amount: {type: 'number'},
|
||||
category: {type: 'string'},
|
||||
frequency: {type: 'string'},
|
||||
dueDate: {type: 'string', format: 'date-time'},
|
||||
notes: {type: 'string'},
|
||||
},
|
||||
},
|
||||
fastify.post(
|
||||
'/expenses',
|
||||
{
|
||||
schema: {
|
||||
description: 'Create expense',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
body: {
|
||||
type: 'object',
|
||||
required: ['name', 'amount', 'category', 'frequency'],
|
||||
properties: {
|
||||
name: {type: 'string'},
|
||||
amount: {type: 'number'},
|
||||
category: {type: 'string'},
|
||||
frequency: {type: 'string'},
|
||||
dueDate: {type: 'string', format: 'date-time'},
|
||||
notes: {type: 'string'}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}, cashflowController.createExpense.bind(cashflowController));
|
||||
cashflowController.createExpense.bind(cashflowController)
|
||||
);
|
||||
|
||||
fastify.put('/expenses/:id', {
|
||||
schema: {
|
||||
description: 'Update expense',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
fastify.put(
|
||||
'/expenses/:id',
|
||||
{
|
||||
schema: {
|
||||
description: 'Update expense',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}]
|
||||
}
|
||||
},
|
||||
}, cashflowController.updateExpense.bind(cashflowController));
|
||||
cashflowController.updateExpense.bind(cashflowController)
|
||||
);
|
||||
|
||||
fastify.delete('/expenses/:id', {
|
||||
schema: {
|
||||
description: 'Delete expense',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
fastify.delete(
|
||||
'/expenses/:id',
|
||||
{
|
||||
schema: {
|
||||
description: 'Delete expense',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}]
|
||||
}
|
||||
},
|
||||
}, cashflowController.deleteExpense.bind(cashflowController));
|
||||
cashflowController.deleteExpense.bind(cashflowController)
|
||||
);
|
||||
|
||||
// ===== Transaction Routes =====
|
||||
|
||||
fastify.get('/transactions', {
|
||||
schema: {
|
||||
description: 'Get all transactions',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
querystring: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: {type: 'string'},
|
||||
startDate: {type: 'string', format: 'date-time'},
|
||||
endDate: {type: 'string', format: 'date-time'},
|
||||
},
|
||||
},
|
||||
fastify.get(
|
||||
'/transactions',
|
||||
{
|
||||
schema: {
|
||||
description: 'Get all transactions',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
querystring: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: {type: 'string'},
|
||||
startDate: {type: 'string', format: 'date-time'},
|
||||
endDate: {type: 'string', format: 'date-time'}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}, cashflowController.getAllTransactions.bind(cashflowController));
|
||||
cashflowController.getAllTransactions.bind(cashflowController)
|
||||
);
|
||||
|
||||
fastify.get('/transactions/summary', {
|
||||
schema: {
|
||||
description: 'Get cashflow summary for date range',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
querystring: {
|
||||
type: 'object',
|
||||
required: ['startDate', 'endDate'],
|
||||
properties: {
|
||||
startDate: {type: 'string', format: 'date-time'},
|
||||
endDate: {type: 'string', format: 'date-time'},
|
||||
},
|
||||
},
|
||||
fastify.get(
|
||||
'/transactions/summary',
|
||||
{
|
||||
schema: {
|
||||
description: 'Get cashflow summary for date range',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
querystring: {
|
||||
type: 'object',
|
||||
required: ['startDate', 'endDate'],
|
||||
properties: {
|
||||
startDate: {type: 'string', format: 'date-time'},
|
||||
endDate: {type: 'string', format: 'date-time'}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}, cashflowController.getCashflowSummary.bind(cashflowController));
|
||||
cashflowController.getCashflowSummary.bind(cashflowController)
|
||||
);
|
||||
|
||||
fastify.get('/transactions/:id', {
|
||||
schema: {
|
||||
description: 'Get transaction by ID',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
fastify.get(
|
||||
'/transactions/:id',
|
||||
{
|
||||
schema: {
|
||||
description: 'Get transaction by ID',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}]
|
||||
}
|
||||
},
|
||||
}, cashflowController.getOneTransaction.bind(cashflowController));
|
||||
cashflowController.getOneTransaction.bind(cashflowController)
|
||||
);
|
||||
|
||||
fastify.post('/transactions', {
|
||||
schema: {
|
||||
description: 'Create transaction',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
body: {
|
||||
type: 'object',
|
||||
required: ['type', 'category', 'amount', 'date'],
|
||||
properties: {
|
||||
type: {type: 'string'},
|
||||
category: {type: 'string'},
|
||||
amount: {type: 'number'},
|
||||
date: {type: 'string', format: 'date-time'},
|
||||
description: {type: 'string'},
|
||||
notes: {type: 'string'},
|
||||
},
|
||||
},
|
||||
fastify.post(
|
||||
'/transactions',
|
||||
{
|
||||
schema: {
|
||||
description: 'Create transaction',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
body: {
|
||||
type: 'object',
|
||||
required: ['type', 'category', 'amount', 'date'],
|
||||
properties: {
|
||||
type: {type: 'string'},
|
||||
category: {type: 'string'},
|
||||
amount: {type: 'number'},
|
||||
date: {type: 'string', format: 'date-time'},
|
||||
description: {type: 'string'},
|
||||
notes: {type: 'string'}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}, cashflowController.createTransaction.bind(cashflowController));
|
||||
cashflowController.createTransaction.bind(cashflowController)
|
||||
);
|
||||
|
||||
fastify.delete('/transactions/:id', {
|
||||
schema: {
|
||||
description: 'Delete transaction',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}],
|
||||
fastify.delete(
|
||||
'/transactions/:id',
|
||||
{
|
||||
schema: {
|
||||
description: 'Delete transaction',
|
||||
tags: ['Cashflow'],
|
||||
security: [{bearerAuth: []}]
|
||||
}
|
||||
},
|
||||
}, cashflowController.deleteTransaction.bind(cashflowController));
|
||||
cashflowController.deleteTransaction.bind(cashflowController)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ export async function clientRoutes(fastify: FastifyInstance) {
|
||||
withStats: {
|
||||
type: 'string',
|
||||
enum: ['true', 'false'],
|
||||
description: 'Include invoice statistics for each client',
|
||||
},
|
||||
},
|
||||
description: 'Include invoice statistics for each client'
|
||||
}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
@@ -49,14 +49,14 @@ export async function clientRoutes(fastify: FastifyInstance) {
|
||||
address: {type: 'string', nullable: true},
|
||||
notes: {type: 'string', nullable: true},
|
||||
createdAt: {type: 'string'},
|
||||
updatedAt: {type: 'string'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
updatedAt: {type: 'string'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
clientController.getAll.bind(clientController)
|
||||
);
|
||||
@@ -76,11 +76,11 @@ export async function clientRoutes(fastify: FastifyInstance) {
|
||||
description: 'Total revenue',
|
||||
type: 'object',
|
||||
properties: {
|
||||
totalRevenue: {type: 'number'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
totalRevenue: {type: 'number'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
clientController.getTotalRevenue.bind(clientController)
|
||||
);
|
||||
@@ -98,8 +98,8 @@ export async function clientRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
@@ -116,13 +116,13 @@ export async function clientRoutes(fastify: FastifyInstance) {
|
||||
address: {type: 'string', nullable: true},
|
||||
notes: {type: 'string', nullable: true},
|
||||
createdAt: {type: 'string'},
|
||||
updatedAt: {type: 'string'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
updatedAt: {type: 'string'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
clientController.getOne.bind(clientController)
|
||||
);
|
||||
@@ -145,19 +145,19 @@ export async function clientRoutes(fastify: FastifyInstance) {
|
||||
email: {type: 'string', format: 'email'},
|
||||
phone: {type: 'string', maxLength: 50},
|
||||
address: {type: 'string'},
|
||||
notes: {type: 'string'},
|
||||
},
|
||||
notes: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
201: {
|
||||
description: 'Client created successfully',
|
||||
type: 'object',
|
||||
properties: {
|
||||
client: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
client: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
clientController.create.bind(clientController)
|
||||
);
|
||||
@@ -175,8 +175,8 @@ export async function clientRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
body: {
|
||||
type: 'object',
|
||||
@@ -185,19 +185,19 @@ export async function clientRoutes(fastify: FastifyInstance) {
|
||||
email: {type: 'string', format: 'email'},
|
||||
phone: {type: 'string', maxLength: 50},
|
||||
address: {type: 'string'},
|
||||
notes: {type: 'string'},
|
||||
},
|
||||
notes: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
description: 'Client updated successfully',
|
||||
type: 'object',
|
||||
properties: {
|
||||
client: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
client: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
clientController.update.bind(clientController)
|
||||
);
|
||||
@@ -215,16 +215,16 @@ export async function clientRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
204: {
|
||||
description: 'Client deleted successfully',
|
||||
type: 'null',
|
||||
},
|
||||
},
|
||||
},
|
||||
type: 'null'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
clientController.delete.bind(clientController)
|
||||
);
|
||||
|
||||
@@ -5,11 +5,7 @@ import {AssetRepository} from '../repositories/AssetRepository';
|
||||
import {LiabilityRepository} from '../repositories/LiabilityRepository';
|
||||
import {InvoiceRepository} from '../repositories/InvoiceRepository';
|
||||
import {DebtAccountRepository} from '../repositories/DebtAccountRepository';
|
||||
import {
|
||||
IncomeSourceRepository,
|
||||
ExpenseRepository,
|
||||
TransactionRepository,
|
||||
} from '../repositories/CashflowRepository';
|
||||
import {IncomeSourceRepository, ExpenseRepository, TransactionRepository} from '../repositories/CashflowRepository';
|
||||
import {NetWorthSnapshotRepository} from '../repositories/NetWorthSnapshotRepository';
|
||||
import {authenticate} from '../middleware/auth';
|
||||
|
||||
@@ -60,8 +56,8 @@ export async function dashboardRoutes(fastify: FastifyInstance) {
|
||||
assets: {type: 'number'},
|
||||
liabilities: {type: 'number'},
|
||||
change: {type: 'number'},
|
||||
lastUpdated: {type: 'string'},
|
||||
},
|
||||
lastUpdated: {type: 'string'}
|
||||
}
|
||||
},
|
||||
invoices: {
|
||||
type: 'object',
|
||||
@@ -69,15 +65,15 @@ export async function dashboardRoutes(fastify: FastifyInstance) {
|
||||
total: {type: 'number'},
|
||||
paid: {type: 'number'},
|
||||
outstanding: {type: 'number'},
|
||||
overdue: {type: 'number'},
|
||||
},
|
||||
overdue: {type: 'number'}
|
||||
}
|
||||
},
|
||||
debts: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
total: {type: 'number'},
|
||||
accounts: {type: 'number'},
|
||||
},
|
||||
accounts: {type: 'number'}
|
||||
}
|
||||
},
|
||||
cashflow: {
|
||||
type: 'object',
|
||||
@@ -85,21 +81,21 @@ export async function dashboardRoutes(fastify: FastifyInstance) {
|
||||
monthlyIncome: {type: 'number'},
|
||||
monthlyExpenses: {type: 'number'},
|
||||
monthlyNet: {type: 'number'},
|
||||
last30Days: {type: 'object'},
|
||||
},
|
||||
last30Days: {type: 'object'}
|
||||
}
|
||||
},
|
||||
assets: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
total: {type: 'number'},
|
||||
count: {type: 'number'},
|
||||
allocation: {type: 'array'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
allocation: {type: 'array'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
dashboardController.getSummary.bind(dashboardController)
|
||||
);
|
||||
|
||||
@@ -42,9 +42,9 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
withStats: {
|
||||
type: 'string',
|
||||
enum: ['true', 'false'],
|
||||
description: 'Include statistics for each category',
|
||||
},
|
||||
},
|
||||
description: 'Include statistics for each category'
|
||||
}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
@@ -61,14 +61,14 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
description: {type: 'string', nullable: true},
|
||||
color: {type: 'string', nullable: true},
|
||||
createdAt: {type: 'string'},
|
||||
updatedAt: {type: 'string'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
updatedAt: {type: 'string'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
categoryController.getAll.bind(categoryController)
|
||||
);
|
||||
@@ -86,8 +86,8 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
@@ -102,13 +102,13 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
description: {type: 'string', nullable: true},
|
||||
color: {type: 'string', nullable: true},
|
||||
createdAt: {type: 'string'},
|
||||
updatedAt: {type: 'string'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
updatedAt: {type: 'string'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
categoryController.getOne.bind(categoryController)
|
||||
);
|
||||
@@ -129,19 +129,19 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
properties: {
|
||||
name: {type: 'string', minLength: 1, maxLength: 255},
|
||||
description: {type: 'string'},
|
||||
color: {type: 'string', pattern: '^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$'},
|
||||
},
|
||||
color: {type: 'string', pattern: '^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
201: {
|
||||
description: 'Debt category created successfully',
|
||||
type: 'object',
|
||||
properties: {
|
||||
category: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
category: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
categoryController.create.bind(categoryController)
|
||||
);
|
||||
@@ -159,27 +159,27 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
body: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: {type: 'string', minLength: 1, maxLength: 255},
|
||||
description: {type: 'string'},
|
||||
color: {type: 'string', pattern: '^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$'},
|
||||
},
|
||||
color: {type: 'string', pattern: '^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
description: 'Debt category updated successfully',
|
||||
type: 'object',
|
||||
properties: {
|
||||
category: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
category: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
categoryController.update.bind(categoryController)
|
||||
);
|
||||
@@ -197,16 +197,16 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
204: {
|
||||
description: 'Debt category deleted successfully',
|
||||
type: 'null',
|
||||
},
|
||||
},
|
||||
},
|
||||
type: 'null'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
categoryController.delete.bind(categoryController)
|
||||
);
|
||||
@@ -227,19 +227,19 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
type: 'object',
|
||||
properties: {
|
||||
withStats: {type: 'string', enum: ['true', 'false']},
|
||||
categoryId: {type: 'string', description: 'Filter by category ID'},
|
||||
},
|
||||
categoryId: {type: 'string', description: 'Filter by category ID'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
description: 'List of debt accounts',
|
||||
type: 'object',
|
||||
properties: {
|
||||
accounts: {type: 'array', items: {type: 'object'}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
accounts: {type: 'array', items: {type: 'object'}}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
accountController.getAll.bind(accountController)
|
||||
);
|
||||
@@ -259,11 +259,11 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
description: 'Total debt',
|
||||
type: 'object',
|
||||
properties: {
|
||||
totalDebt: {type: 'number'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
totalDebt: {type: 'number'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
accountController.getTotalDebt.bind(accountController)
|
||||
);
|
||||
@@ -281,19 +281,19 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
description: 'Debt account details',
|
||||
type: 'object',
|
||||
properties: {
|
||||
account: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
account: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
accountController.getOne.bind(accountController)
|
||||
);
|
||||
@@ -321,19 +321,19 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
interestRate: {type: 'number', minimum: 0, maximum: 100},
|
||||
minimumPayment: {type: 'number', minimum: 0},
|
||||
dueDate: {type: 'string', format: 'date-time'},
|
||||
notes: {type: 'string'},
|
||||
},
|
||||
notes: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
201: {
|
||||
description: 'Debt account created successfully',
|
||||
type: 'object',
|
||||
properties: {
|
||||
account: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
account: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
accountController.create.bind(accountController)
|
||||
);
|
||||
@@ -351,8 +351,8 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
body: {
|
||||
type: 'object',
|
||||
@@ -364,19 +364,19 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
interestRate: {type: 'number', minimum: 0, maximum: 100},
|
||||
minimumPayment: {type: 'number', minimum: 0},
|
||||
dueDate: {type: 'string', format: 'date-time'},
|
||||
notes: {type: 'string'},
|
||||
},
|
||||
notes: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
description: 'Debt account updated successfully',
|
||||
type: 'object',
|
||||
properties: {
|
||||
account: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
account: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
accountController.update.bind(accountController)
|
||||
);
|
||||
@@ -394,16 +394,16 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
204: {
|
||||
description: 'Debt account deleted successfully',
|
||||
type: 'null',
|
||||
},
|
||||
},
|
||||
},
|
||||
type: 'null'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
accountController.delete.bind(accountController)
|
||||
);
|
||||
@@ -425,19 +425,19 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
properties: {
|
||||
accountId: {type: 'string', description: 'Filter by account ID'},
|
||||
startDate: {type: 'string', format: 'date-time'},
|
||||
endDate: {type: 'string', format: 'date-time'},
|
||||
},
|
||||
endDate: {type: 'string', format: 'date-time'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
description: 'List of debt payments',
|
||||
type: 'object',
|
||||
properties: {
|
||||
payments: {type: 'array', items: {type: 'object'}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
payments: {type: 'array', items: {type: 'object'}}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
paymentController.getAll.bind(paymentController)
|
||||
);
|
||||
@@ -457,11 +457,11 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
description: 'Total payments',
|
||||
type: 'object',
|
||||
properties: {
|
||||
totalPayments: {type: 'number'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
totalPayments: {type: 'number'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
paymentController.getTotalPayments.bind(paymentController)
|
||||
);
|
||||
@@ -479,19 +479,19 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
description: 'Debt payment details',
|
||||
type: 'object',
|
||||
properties: {
|
||||
payment: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
payment: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
paymentController.getOne.bind(paymentController)
|
||||
);
|
||||
@@ -513,19 +513,19 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
accountId: {type: 'string', format: 'uuid'},
|
||||
amount: {type: 'number', minimum: 0.01},
|
||||
paymentDate: {type: 'string', format: 'date-time'},
|
||||
notes: {type: 'string'},
|
||||
},
|
||||
notes: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
201: {
|
||||
description: 'Debt payment created successfully',
|
||||
type: 'object',
|
||||
properties: {
|
||||
payment: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
payment: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
paymentController.create.bind(paymentController)
|
||||
);
|
||||
@@ -543,16 +543,16 @@ export async function debtRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
204: {
|
||||
description: 'Debt payment deleted successfully',
|
||||
type: 'null',
|
||||
},
|
||||
},
|
||||
},
|
||||
type: 'null'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
paymentController.delete.bind(paymentController)
|
||||
);
|
||||
|
||||
@@ -28,8 +28,8 @@ export async function invoiceRoutes(fastify: FastifyInstance) {
|
||||
type: 'object',
|
||||
properties: {
|
||||
clientId: {type: 'string', description: 'Filter by client ID'},
|
||||
status: {type: 'string', description: 'Filter by status'},
|
||||
},
|
||||
status: {type: 'string', description: 'Filter by status'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
@@ -52,14 +52,14 @@ export async function invoiceRoutes(fastify: FastifyInstance) {
|
||||
notes: {type: 'string', nullable: true},
|
||||
terms: {type: 'string', nullable: true},
|
||||
createdAt: {type: 'string'},
|
||||
updatedAt: {type: 'string'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
updatedAt: {type: 'string'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
invoiceController.getAll.bind(invoiceController)
|
||||
);
|
||||
@@ -85,13 +85,13 @@ export async function invoiceRoutes(fastify: FastifyInstance) {
|
||||
total: {type: 'number'},
|
||||
paid: {type: 'number'},
|
||||
outstanding: {type: 'number'},
|
||||
overdue: {type: 'number'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
overdue: {type: 'number'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
invoiceController.getStats.bind(invoiceController)
|
||||
);
|
||||
@@ -111,11 +111,11 @@ export async function invoiceRoutes(fastify: FastifyInstance) {
|
||||
description: 'List of overdue invoices',
|
||||
type: 'object',
|
||||
properties: {
|
||||
invoices: {type: 'array', items: {type: 'object'}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
invoices: {type: 'array', items: {type: 'object'}}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
invoiceController.getOverdue.bind(invoiceController)
|
||||
);
|
||||
@@ -133,8 +133,8 @@ export async function invoiceRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
@@ -155,13 +155,13 @@ export async function invoiceRoutes(fastify: FastifyInstance) {
|
||||
notes: {type: 'string', nullable: true},
|
||||
terms: {type: 'string', nullable: true},
|
||||
createdAt: {type: 'string'},
|
||||
updatedAt: {type: 'string'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
updatedAt: {type: 'string'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
invoiceController.getOne.bind(invoiceController)
|
||||
);
|
||||
@@ -193,24 +193,24 @@ export async function invoiceRoutes(fastify: FastifyInstance) {
|
||||
description: {type: 'string', minLength: 1},
|
||||
quantity: {type: 'number', minimum: 1},
|
||||
unitPrice: {type: 'number', minimum: 0},
|
||||
amount: {type: 'number', minimum: 0},
|
||||
},
|
||||
},
|
||||
amount: {type: 'number', minimum: 0}
|
||||
}
|
||||
}
|
||||
},
|
||||
notes: {type: 'string'},
|
||||
terms: {type: 'string'},
|
||||
},
|
||||
terms: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
201: {
|
||||
description: 'Invoice created successfully',
|
||||
type: 'object',
|
||||
properties: {
|
||||
invoice: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
invoice: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
invoiceController.create.bind(invoiceController)
|
||||
);
|
||||
@@ -228,8 +228,8 @@ export async function invoiceRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
body: {
|
||||
type: 'object',
|
||||
@@ -246,24 +246,24 @@ export async function invoiceRoutes(fastify: FastifyInstance) {
|
||||
description: {type: 'string', minLength: 1},
|
||||
quantity: {type: 'number', minimum: 1},
|
||||
unitPrice: {type: 'number', minimum: 0},
|
||||
amount: {type: 'number', minimum: 0},
|
||||
},
|
||||
},
|
||||
amount: {type: 'number', minimum: 0}
|
||||
}
|
||||
}
|
||||
},
|
||||
notes: {type: 'string'},
|
||||
terms: {type: 'string'},
|
||||
},
|
||||
terms: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
description: 'Invoice updated successfully',
|
||||
type: 'object',
|
||||
properties: {
|
||||
invoice: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
invoice: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
invoiceController.update.bind(invoiceController)
|
||||
);
|
||||
@@ -281,8 +281,8 @@ export async function invoiceRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
body: {
|
||||
type: 'object',
|
||||
@@ -290,20 +290,20 @@ export async function invoiceRoutes(fastify: FastifyInstance) {
|
||||
properties: {
|
||||
status: {
|
||||
type: 'string',
|
||||
enum: ['DRAFT', 'SENT', 'PAID', 'OVERDUE', 'CANCELLED'],
|
||||
},
|
||||
},
|
||||
enum: ['DRAFT', 'SENT', 'PAID', 'OVERDUE', 'CANCELLED']
|
||||
}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
description: 'Invoice status updated successfully',
|
||||
type: 'object',
|
||||
properties: {
|
||||
invoice: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
invoice: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
invoiceController.updateStatus.bind(invoiceController)
|
||||
);
|
||||
@@ -321,16 +321,16 @@ export async function invoiceRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
204: {
|
||||
description: 'Invoice deleted successfully',
|
||||
type: 'null',
|
||||
},
|
||||
},
|
||||
},
|
||||
type: 'null'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
invoiceController.delete.bind(invoiceController)
|
||||
);
|
||||
|
||||
@@ -42,14 +42,14 @@ export async function liabilityRoutes(fastify: FastifyInstance) {
|
||||
creditor: {type: 'string', nullable: true},
|
||||
notes: {type: 'string', nullable: true},
|
||||
createdAt: {type: 'string'},
|
||||
updatedAt: {type: 'string'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
updatedAt: {type: 'string'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
liabilityController.getAll.bind(liabilityController)
|
||||
);
|
||||
@@ -69,11 +69,11 @@ export async function liabilityRoutes(fastify: FastifyInstance) {
|
||||
description: 'Total liability value',
|
||||
type: 'object',
|
||||
properties: {
|
||||
totalValue: {type: 'number'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
totalValue: {type: 'number'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
liabilityController.getTotalValue.bind(liabilityController)
|
||||
);
|
||||
@@ -97,13 +97,13 @@ export async function liabilityRoutes(fastify: FastifyInstance) {
|
||||
type: 'object',
|
||||
additionalProperties: {
|
||||
type: 'array',
|
||||
items: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
items: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
liabilityController.getByType.bind(liabilityController)
|
||||
);
|
||||
@@ -121,8 +121,8 @@ export async function liabilityRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
@@ -142,13 +142,13 @@ export async function liabilityRoutes(fastify: FastifyInstance) {
|
||||
creditor: {type: 'string', nullable: true},
|
||||
notes: {type: 'string', nullable: true},
|
||||
createdAt: {type: 'string'},
|
||||
updatedAt: {type: 'string'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
updatedAt: {type: 'string'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
liabilityController.getOne.bind(liabilityController)
|
||||
);
|
||||
@@ -174,19 +174,19 @@ export async function liabilityRoutes(fastify: FastifyInstance) {
|
||||
minimumPayment: {type: 'number', minimum: 0},
|
||||
dueDate: {type: 'string', format: 'date-time'},
|
||||
creditor: {type: 'string', maxLength: 255},
|
||||
notes: {type: 'string'},
|
||||
},
|
||||
notes: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
201: {
|
||||
description: 'Liability created successfully',
|
||||
type: 'object',
|
||||
properties: {
|
||||
liability: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
liability: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
liabilityController.create.bind(liabilityController)
|
||||
);
|
||||
@@ -204,8 +204,8 @@ export async function liabilityRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
body: {
|
||||
type: 'object',
|
||||
@@ -217,19 +217,19 @@ export async function liabilityRoutes(fastify: FastifyInstance) {
|
||||
minimumPayment: {type: 'number', minimum: 0},
|
||||
dueDate: {type: 'string', format: 'date-time'},
|
||||
creditor: {type: 'string', maxLength: 255},
|
||||
notes: {type: 'string'},
|
||||
},
|
||||
notes: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
description: 'Liability updated successfully',
|
||||
type: 'object',
|
||||
properties: {
|
||||
liability: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
liability: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
liabilityController.update.bind(liabilityController)
|
||||
);
|
||||
@@ -247,16 +247,16 @@ export async function liabilityRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
204: {
|
||||
description: 'Liability deleted successfully',
|
||||
type: 'null',
|
||||
},
|
||||
},
|
||||
},
|
||||
type: 'null'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
liabilityController.delete.bind(liabilityController)
|
||||
);
|
||||
|
||||
@@ -35,11 +35,11 @@ export async function netWorthRoutes(fastify: FastifyInstance) {
|
||||
totalLiabilities: {type: 'number'},
|
||||
netWorth: {type: 'number'},
|
||||
asOf: {type: 'string'},
|
||||
isCalculated: {type: 'boolean'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
isCalculated: {type: 'boolean'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
netWorthController.getCurrent.bind(netWorthController)
|
||||
);
|
||||
@@ -70,14 +70,14 @@ export async function netWorthRoutes(fastify: FastifyInstance) {
|
||||
totalLiabilities: {type: 'number'},
|
||||
netWorth: {type: 'number'},
|
||||
notes: {type: 'string', nullable: true},
|
||||
createdAt: {type: 'string'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
createdAt: {type: 'string'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
netWorthController.getAllSnapshots.bind(netWorthController)
|
||||
);
|
||||
@@ -97,19 +97,19 @@ export async function netWorthRoutes(fastify: FastifyInstance) {
|
||||
required: ['startDate', 'endDate'],
|
||||
properties: {
|
||||
startDate: {type: 'string', format: 'date-time'},
|
||||
endDate: {type: 'string', format: 'date-time'},
|
||||
},
|
||||
endDate: {type: 'string', format: 'date-time'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
description: 'Snapshots in date range',
|
||||
type: 'object',
|
||||
properties: {
|
||||
snapshots: {type: 'array', items: {type: 'object'}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
snapshots: {type: 'array', items: {type: 'object'}}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
netWorthController.getByDateRange.bind(netWorthController)
|
||||
);
|
||||
@@ -127,8 +127,8 @@ export async function netWorthRoutes(fastify: FastifyInstance) {
|
||||
querystring: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
limit: {type: 'string', description: 'Number of periods to include (default: 12)'},
|
||||
},
|
||||
limit: {type: 'string', description: 'Number of periods to include (default: 12)'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
@@ -143,14 +143,14 @@ export async function netWorthRoutes(fastify: FastifyInstance) {
|
||||
date: {type: 'string'},
|
||||
netWorth: {type: 'number'},
|
||||
growthAmount: {type: 'number'},
|
||||
growthPercent: {type: 'number'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
growthPercent: {type: 'number'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
netWorthController.getGrowthStats.bind(netWorthController)
|
||||
);
|
||||
@@ -168,19 +168,19 @@ export async function netWorthRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
200: {
|
||||
description: 'Snapshot details',
|
||||
type: 'object',
|
||||
properties: {
|
||||
snapshot: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
snapshot: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
netWorthController.getOne.bind(netWorthController)
|
||||
);
|
||||
@@ -203,19 +203,19 @@ export async function netWorthRoutes(fastify: FastifyInstance) {
|
||||
totalAssets: {type: 'number', minimum: 0},
|
||||
totalLiabilities: {type: 'number', minimum: 0},
|
||||
netWorth: {type: 'number'},
|
||||
notes: {type: 'string'},
|
||||
},
|
||||
notes: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
201: {
|
||||
description: 'Snapshot created successfully',
|
||||
type: 'object',
|
||||
properties: {
|
||||
snapshot: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
snapshot: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
netWorthController.createSnapshot.bind(netWorthController)
|
||||
);
|
||||
@@ -233,19 +233,19 @@ export async function netWorthRoutes(fastify: FastifyInstance) {
|
||||
body: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
notes: {type: 'string'},
|
||||
},
|
||||
notes: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
201: {
|
||||
description: 'Snapshot created successfully',
|
||||
type: 'object',
|
||||
properties: {
|
||||
snapshot: {type: 'object'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
snapshot: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
netWorthController.createFromCurrent.bind(netWorthController)
|
||||
);
|
||||
@@ -263,16 +263,16 @@ export async function netWorthRoutes(fastify: FastifyInstance) {
|
||||
params: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {type: 'string'},
|
||||
},
|
||||
id: {type: 'string'}
|
||||
}
|
||||
},
|
||||
response: {
|
||||
204: {
|
||||
description: 'Snapshot deleted successfully',
|
||||
type: 'null',
|
||||
},
|
||||
},
|
||||
},
|
||||
type: 'null'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
netWorthController.delete.bind(netWorthController)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user