diff --git a/src/modules/reports/report/report.service.ts b/src/modules/reports/report/report.service.ts index 0474f56..c494e32 100644 --- a/src/modules/reports/report/report.service.ts +++ b/src/modules/reports/report/report.service.ts @@ -7,12 +7,26 @@ import { ReportConfigs } from '../shared/configs'; @Injectable() export class ReportService extends BaseReportService { async getReportConfig(query: GetReportConfigDto) { - return ReportConfigs; + const { unique_names = [], group_names = [] } = query; + + let configs = ReportConfigs; + if (group_names.length > 0) { + configs = configs.filter((item) => group_names.includes(item.group_name)); + } + + if (unique_names.length > 0) { + configs = configs.filter((item) => + unique_names.includes(item.unique_name), + ); + } + + return configs; } async getReportData(body: GetReportDataDto) { return 'you hit API for get report data'; } + async getReportMeta(body: GetReportDataDto) { return 'you hit API for get report meta'; }