feat: setup service get report config

pull/11/head
Firman Ramdhani 2024-07-03 16:05:36 +07:00
parent 4dc9f7ee99
commit 85d461c70a
1 changed files with 15 additions and 1 deletions

View File

@ -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';
}