From f26b6fceeb1c506bfb4b7566aa26a1efb59e66f0 Mon Sep 17 00:00:00 2001 From: himeshr Date: Thu, 12 Sep 2024 12:30:36 +0530 Subject: [PATCH] #762 | Remove unused schema param in createQuestionForTable() and remove unused DatabaseService from MetabaseService --- .../avni/server/service/metabase/DatabaseService.java | 10 ++++------ .../avni/server/service/metabase/MetabaseService.java | 3 --- .../service/metabase/QuestionCreationService.java | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/avni-server-api/src/main/java/org/avni/server/service/metabase/DatabaseService.java b/avni-server-api/src/main/java/org/avni/server/service/metabase/DatabaseService.java index fd3cec2e6..98fc49f82 100644 --- a/avni-server-api/src/main/java/org/avni/server/service/metabase/DatabaseService.java +++ b/avni-server-api/src/main/java/org/avni/server/service/metabase/DatabaseService.java @@ -62,11 +62,10 @@ public void createQuestionForTable(TableDetails tableDetails, TableDetails addre } @Override - public void createQuestionForTable(String tableName, String schema) { + public void createQuestionForTable(String tableName) { Database database = getGlobalDatabase(); - TableDetails tableDetails = new TableDetails(); - tableDetails.setName(tableName); + TableDetails tableDetails = new TableDetails(tableName); TableDetails fetchedTableDetails = databaseRepository.findTableDetailsByName(database, tableDetails); databaseRepository.createQuestionForASingleTable(database, fetchedTableDetails); @@ -120,8 +119,7 @@ private void createQuestionsForEntities(List entityNames, FieldDetails a List filteredEntities = filterOutExistingQuestions(entityNames); for (String entityName : filteredEntities) { - TableDetails entityTableDetails = new TableDetails(); - entityTableDetails.setName(entityName); + TableDetails entityTableDetails = new TableDetails(entityName); TableDetails fetchedEntityTableDetails = databaseRepository.findTableDetailsByName(getGlobalDatabase(), entityTableDetails); createQuestionForTable(fetchedEntityTableDetails, fetchedAddressTableDetails, addressFieldDetails, entityFieldDetails); } @@ -148,7 +146,7 @@ public void createQuestionsForIndividualTables() { List filteredTables = filterOutExistingQuestions(individualTables); for (String tableName : filteredTables) { - createQuestionForTable(tableName, "!public"); + createQuestionForTable(tableName); } } diff --git a/avni-server-api/src/main/java/org/avni/server/service/metabase/MetabaseService.java b/avni-server-api/src/main/java/org/avni/server/service/metabase/MetabaseService.java index 050ee873d..1ee20e42e 100644 --- a/avni-server-api/src/main/java/org/avni/server/service/metabase/MetabaseService.java +++ b/avni-server-api/src/main/java/org/avni/server/service/metabase/MetabaseService.java @@ -18,7 +18,6 @@ public class MetabaseService { private final OrganisationService organisationService; private final AvniDatabase avniDatabase; private final DatabaseRepository databaseRepository; - private final DatabaseService databaseService; private final GroupPermissionsRepository groupPermissionsRepository; private final CollectionPermissionsRepository collectionPermissionsRepository; private final CollectionRepository collectionRepository; @@ -29,14 +28,12 @@ public class MetabaseService { public MetabaseService(OrganisationService organisationService, AvniDatabase avniDatabase, DatabaseRepository databaseRepository, - @Lazy DatabaseService databaseService, GroupPermissionsRepository groupPermissionsRepository, CollectionPermissionsRepository collectionPermissionsRepository, CollectionRepository collectionRepository) { this.organisationService = organisationService; this.avniDatabase = avniDatabase; this.databaseRepository = databaseRepository; - this.databaseService = databaseService; this.groupPermissionsRepository = groupPermissionsRepository; this.collectionPermissionsRepository = collectionPermissionsRepository; this.collectionRepository = collectionRepository; diff --git a/avni-server-api/src/main/java/org/avni/server/service/metabase/QuestionCreationService.java b/avni-server-api/src/main/java/org/avni/server/service/metabase/QuestionCreationService.java index 8ae178f68..0be93ce7d 100644 --- a/avni-server-api/src/main/java/org/avni/server/service/metabase/QuestionCreationService.java +++ b/avni-server-api/src/main/java/org/avni/server/service/metabase/QuestionCreationService.java @@ -4,5 +4,5 @@ public interface QuestionCreationService { void createQuestionForTable(TableDetails tableDetails, TableDetails addressTableDetails, FieldDetails addressFieldDetails, FieldDetails tableFieldDetails) throws Exception; - void createQuestionForTable(String tableName, String schema) throws Exception; + void createQuestionForTable(String tableName) throws Exception; }