- Modified TypeScript configuration to disable strict mode and allow importing TypeScript extensions. - Updated Prisma schema to enhance the User model with a new debtAccounts field and refined asset/liability types. - Adjusted environment variable parsing for PORT to use coercion for better type handling. - Refactored various controllers and repositories to utilize type imports for better clarity and maintainability. - Enhanced service layers with new methods for retrieving assets by type and calculating invoice statistics. - Introduced new types for invoice statuses and asset types to ensure consistency across the application.
18 lines
525 B
TypeScript
18 lines
525 B
TypeScript
import type {FastifyRequest, FastifyReply} from 'fastify';
|
|
import {DashboardService} from '../services/DashboardService';
|
|
import {getUserId} from '../middleware/auth';
|
|
|
|
/**
|
|
* Controller for Dashboard endpoints
|
|
*/
|
|
export class DashboardController {
|
|
constructor(private dashboardService: DashboardService) {}
|
|
|
|
async getSummary(request: FastifyRequest, reply: FastifyReply) {
|
|
const userId = getUserId(request);
|
|
const summary = await this.dashboardService.getSummary(userId);
|
|
|
|
return reply.send(summary);
|
|
}
|
|
}
|