[PROP-CORE-004] feat: Register payment-terminals module in app
- Added payment-terminals entities to TypeORM config - Registered PaymentTerminalsModule routes in index.ts - Updated API modules list in app.ts - Fixed getEntities() to only reference own entities Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
3514e6305c
commit
aa7e5a3c78
@ -67,6 +67,9 @@ app.get('/api', (_req: Request, res: Response) => {
|
||||
'invoicing',
|
||||
'ecommerce',
|
||||
'purchases',
|
||||
'payment-terminals',
|
||||
'mercadopago',
|
||||
'clip',
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
@ -54,6 +54,11 @@ import { SupplierOrderLine } from '../modules/purchases/entities/supplier-order-
|
||||
import { GoodsReceipt } from '../modules/purchases/entities/goods-receipt.entity';
|
||||
import { GoodsReceiptLine } from '../modules/purchases/entities/goods-receipt-line.entity';
|
||||
|
||||
// Entities - Payment Terminals
|
||||
import { TenantTerminalConfig } from '../modules/payment-terminals/entities/tenant-terminal-config.entity';
|
||||
import { TerminalPayment } from '../modules/payment-terminals/entities/terminal-payment.entity';
|
||||
import { TerminalWebhookEvent } from '../modules/payment-terminals/entities/terminal-webhook-event.entity';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
@ -110,6 +115,10 @@ const baseConfig: DataSourceOptions = {
|
||||
SupplierOrderLine,
|
||||
GoodsReceipt,
|
||||
GoodsReceiptLine,
|
||||
// Payment Terminals
|
||||
TenantTerminalConfig,
|
||||
TerminalPayment,
|
||||
TerminalWebhookEvent,
|
||||
],
|
||||
migrations: ['src/migrations/*.ts'],
|
||||
synchronize: false, // NEVER use in production
|
||||
|
||||
@ -6,7 +6,8 @@ dotenv.config();
|
||||
|
||||
import app from './app';
|
||||
import { initDatabase, closeDatabase } from './config/database';
|
||||
import { initTypeORM, closeTypeORM } from './config/typeorm';
|
||||
import { initTypeORM, closeTypeORM, AppDataSource } from './config/typeorm';
|
||||
import { PaymentTerminalsModule } from './modules/payment-terminals';
|
||||
|
||||
const PORT = parseInt(process.env.PORT || '3001', 10);
|
||||
const HOST = process.env.HOST || '0.0.0.0';
|
||||
@ -21,6 +22,12 @@ async function bootstrap(): Promise<void> {
|
||||
await initDatabase();
|
||||
await initTypeORM();
|
||||
|
||||
// Register payment terminals module (requires DataSource)
|
||||
const paymentTerminals = new PaymentTerminalsModule({ dataSource: AppDataSource });
|
||||
app.use('/api', paymentTerminals.router);
|
||||
app.use('/webhooks', paymentTerminals.webhookRouter);
|
||||
console.log('Payment terminals module registered');
|
||||
|
||||
// Start server
|
||||
const server = app.listen(PORT, HOST, () => {
|
||||
console.log(`Server running on http://${HOST}:${PORT}`);
|
||||
|
||||
@ -62,10 +62,6 @@ export class PaymentTerminalsModule {
|
||||
*/
|
||||
static getEntities() {
|
||||
return [
|
||||
// Existing entities
|
||||
require('../branches/entities/branch-payment-terminal.entity').BranchPaymentTerminal,
|
||||
require('../mobile/entities/payment-transaction.entity').PaymentTransaction,
|
||||
// New entities for MercadoPago/Clip
|
||||
require('./entities/tenant-terminal-config.entity').TenantTerminalConfig,
|
||||
require('./entities/terminal-payment.entity').TerminalPayment,
|
||||
require('./entities/terminal-webhook-event.entity').TerminalWebhookEvent,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user