26 lines
867 B
TypeScript
26 lines
867 B
TypeScript
import { PluginInstance, PluginContext } from '../../backend/src/core/types';
|
|
import { createFinanceRoutes } from './backend/routes';
|
|
import manifest from './manifest.json';
|
|
|
|
const plugin: PluginInstance = {
|
|
manifest: manifest as any,
|
|
|
|
async activate(ctx: PluginContext): Promise<void> {
|
|
const router = createFinanceRoutes(ctx);
|
|
ctx.app.use('/api/finance', router);
|
|
|
|
// Listen for new partners to create initial invoice
|
|
ctx.hooks.register('partner:created', async (data: { partnerId: string }) => {
|
|
ctx.logger.info(`Creating initial invoice for partner ${data.partnerId}`);
|
|
});
|
|
|
|
ctx.logger.info('Finance routes registered at /api/finance');
|
|
},
|
|
|
|
async deactivate(ctx: PluginContext): Promise<void> {
|
|
ctx.logger.info('Financeiro plugin deactivated');
|
|
},
|
|
};
|
|
|
|
export default plugin;
|