processDashboardConfig function

Future<void> processDashboardConfig(
  1. List<DashboardChartConfigSchema> dashboardConfig,
  2. int startDate,
  3. int endDate,
  4. Isar isar,
  5. DateTime lastSelectedDate,
  6. DashboardRemoteRepository dashboardRemoteRepo,
  7. String actionPath,
  8. String tenantId,
  9. String projectId,
  10. 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,
      );
    }
  }
}