Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/__tests__/base-app.module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ describe('BaseNraAppModule', () => {
expect(result.controllers).toContain(AppController);
});

it('registers project controllers after AppController', () => {
class ProjectController { }
const result = BaseNraAppModule.forRoot({
entitiesModule: FakeEntitiesModule,
yemotHandlerService: FakeYemotHandlerService as any,
controllers: [ProjectController],
});

expect(result.controllers).toEqual([AppController, ProjectController]);
});

it('includes AppService in providers', () => {
const result = BaseNraAppModule.forRoot({
entitiesModule: FakeEntitiesModule,
Expand Down
4 changes: 3 additions & 1 deletion app/base-app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export interface BaseNraAppModuleOptions {
throttlerLimit?: number;
/** Project-specific async job handlers, registered alongside the shared ones. */
jobHandlers?: Type<JobHandler>[];
/** Project-specific controllers, registered next to the shared `AppController`. */
controllers?: Type<any>[];
/** MCP tools; when given, the app serves them at `/mcp`. */
mcpTools?: Type<McpTool>[];
/** MCP server instructions: what the app is and how its tools fit together. */
Expand Down Expand Up @@ -59,7 +61,7 @@ export class BaseNraAppModule {
YemotModule.register(options.yemotHandlerService),
...(options.mcpTools?.length ? [McpModule.forRoot({ tools: options.mcpTools, instructions: options.mcpInstructions, prompts: options.mcpPrompts, consent: options.mcpConsent })] : []),
],
controllers: [AppController],
controllers: [AppController, ...(options.controllers ?? [])],
providers: [
AppService,
{
Expand Down
Loading