34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { DynamicLoader } from '@app/event-emitter/configs/dynamic-loader';
|
|
import { RootIssueSubTreesWidgetService } from '@app/event-emitter/project-dashboard/widgets/root-issue-subtrees.widget.service';
|
|
import { Controller, Get, Param, Render } from '@nestjs/common';
|
|
import { ConfigService } from '@nestjs/config';
|
|
import { parse } from 'jsonc-parser';
|
|
|
|
@Controller('simple-kanban-board')
|
|
export class SimpleKanbanBoardController {
|
|
private path: string;
|
|
|
|
constructor(
|
|
private rootIssueSubTreesWidgetService: RootIssueSubTreesWidgetService,
|
|
private dynamicLoader: DynamicLoader,
|
|
private configService: ConfigService,
|
|
) {
|
|
this.path = this.configService.get<string>('simpleKanbanBoard.path');
|
|
}
|
|
|
|
@Get('/tree/:name/raw')
|
|
async getRawData(@Param('name') name: string): Promise<any> {
|
|
const cfg = this.dynamicLoader.load(name, {
|
|
path: this.path,
|
|
ext: 'jsonc',
|
|
parser: parse,
|
|
});
|
|
return await this.rootIssueSubTreesWidgetService.render(cfg);
|
|
}
|
|
|
|
@Get('/tree/:name')
|
|
@Render('simple-kanban-board')
|
|
async get(@Param('name') name: string): Promise<any> {
|
|
return await this.getRawData(name);
|
|
}
|
|
}
|