- Create invoices.controller.ts and invoices.routes.ts with singleton service - Create products.service.ts, products.controller.ts, products.routes.ts - Create warehouses.service.ts, warehouses.controller.ts, warehouses.routes.ts - Register all routes in app.ts - Use Zod validation schemas in all controllers - Apply multi-tenant isolation via tenantId - Update invoices.module.ts to use singleton pattern All business modules now have API routes registered and build passes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
35 lines
837 B
TypeScript
35 lines
837 B
TypeScript
import { Router } from 'express';
|
|
import { invoicesService } from './services/index.js';
|
|
import { Invoice, Payment, InvoiceItem, PaymentAllocation } from './entities/index.js';
|
|
|
|
/**
|
|
* Invoices Module - Provides invoice and payment management functionality
|
|
*
|
|
* This module is kept for backwards compatibility but the recommended
|
|
* approach is to use the routes directly via invoices.routes.ts
|
|
*/
|
|
export class InvoicesModule {
|
|
public router: Router;
|
|
|
|
constructor() {
|
|
this.router = Router();
|
|
}
|
|
|
|
/**
|
|
* Get service instance
|
|
*/
|
|
getService() {
|
|
return invoicesService;
|
|
}
|
|
|
|
/**
|
|
* Get all entities managed by this module
|
|
*/
|
|
static getEntities(): Function[] {
|
|
return [Invoice, InvoiceItem, Payment, PaymentAllocation];
|
|
}
|
|
}
|
|
|
|
// Export module instance
|
|
export const invoicesModule = new InvoicesModule();
|