processDashboardConfig function
Future<void>
processDashboardConfig(
- List<DashboardChartConfigSchema> dashboardConfig,
- int startDate,
- int endDate,
- Isar isar,
- DateTime lastSelectedDate,
- DashboardRemoteRepository dashboardRemoteRepo,
- String actionPath,
- String tenantId,
- String projectId,
- List<String> userList,
)
Implementation
Future<void> processDashboardConfig(
List<DashboardChartConfigSchema> dashboardConfig,
int startDate,
int endDate,
Isar isar,
DateTime lastSelectedDate,
DashboardRemoteRepository dashboardRemoteRepo,
String actionPath,
String tenantId,
String projectId,
List<String> userList,
) async {
if (dashboardConfig.isNotEmpty) {
for (var entry in dashboardConfig) {
String visualizationType = entry.chartType ?? '';
String visualizationCode = entry.name ?? '';
await dashboardRemoteRepo.searchAndWriteToDB(
apiEndPoint: actionPath,
lastSelectedDate: lastSelectedDate,
query: DashboardRequestModel(
aggregationRequestDto: AggregationRequestDto(
visualizationType: visualizationType,
visualizationCode: visualizationCode,
filters: {
DSSEnums.uuid.toValue(): userList,
DSSEnums.projectId.toValue(): projectId
},
moduleLevel: "",
queryType: "",
requestDate: RequestDate(
startDate: startDate,
endDate: endDate,
interval: DSSEnums.day.toValue(),
title: DSSEnums.home.toValue(),
)),
headers: DSSHeaders(
tenantId: tenantId,
)).toMap(),
projectId: projectId,
isar: isar,
);
}
}
}