commit 9cba4dae68d145eb14df7770539ddf6273b335b5
Author: Hrabikv <hrabikv@students.zcu.cz>
Date:   Fri Nov 3 20:29:54 2023 +0100

    https://kivprogrammers.atlassian.net/browse/TSP2-45 Dokončení funkcionality SAVE AS

diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/ConfigurationController.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/ConfigurationController.java
index 8d5f47b..c5360b0 100644
--- a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/ConfigurationController.java
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/ConfigurationController.java
@@ -38,7 +38,8 @@ public class ConfigurationController {
         ConfigurationControllerStatusCodes returnCode = configurationService.addConfiguration(userConfiguration);
         String message = returnCode.getLabel();
         Map<String,Object> json = new HashMap<>();
-        json.put("message",message);
+        json.put("message", message);
+        json.put("id", userConfiguration.getId());
         //ResponseEntity<String> response = configurationService.addConfiguration(userConfiguration);
         return new ResponseEntity<>(JSONBuilder.buildJSON(json),HttpStatus.valueOf(returnCode.getStatusCode()));
     }
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/dials/ConfigurationControllerStatusCodes.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/dials/ConfigurationControllerStatusCodes.java
index 4fc7c31..912d26c 100644
--- a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/dials/ConfigurationControllerStatusCodes.java
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/dials/ConfigurationControllerStatusCodes.java
@@ -19,7 +19,7 @@ public enum ConfigurationControllerStatusCodes {
     UPDATE_SUCCESSFUL("Configuration updated",200),
 
     CONFIGURATION_PAIRING_EXISTS("Configuration already exists in your collection",400),
-    CONFIGURATION_PAIRING_CREATED("configuration added to collection",200);
+    CONFIGURATION_PAIRING_CREATED("Configuration added to collection",200);
 
 
 
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/UserConfiguration.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/UserConfiguration.java
index ddf3451..926f25f 100644
--- a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/UserConfiguration.java
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/UserConfiguration.java
@@ -10,7 +10,6 @@ public class UserConfiguration {
     private ConfigurationDto configuration;
     private String isDefault;
     private String configurationName;
-
     private String id;
 
     public UserConfiguration(User user, ConfigurationDto configuration, String isDefault, String configurationName) {
@@ -30,7 +29,6 @@ public class UserConfiguration {
         this.id = id;
     }
 
-
     public User getUser() {
         return this.user;
     }
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/service/configuration/ConfigurationServiceImplementation.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/service/configuration/ConfigurationServiceImplementation.java
index 3bdb36a..c3ba1f9 100644
--- a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/service/configuration/ConfigurationServiceImplementation.java
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/service/configuration/ConfigurationServiceImplementation.java
@@ -74,9 +74,11 @@ public class ConfigurationServiceImplementation implements ConfigService {
         else {
             configuration = existingConfiguration;
         }
+
+        cfg.setId(String.valueOf(configuration.getId()));
+
         //pair the configuration to the user
-        pairConfigurationWithUser(user,configuration);
-        return ConfigurationControllerStatusCodes.INSERT_SUCCESSFUL;
+        return pairConfigurationWithUser(user, configuration);
     }
 
     /**
@@ -189,7 +191,7 @@ public class ConfigurationServiceImplementation implements ConfigService {
         }
         //save the relation between user and configuration
         this.userConfigurationJoinRepository.save(new UserConfigurationJoin(key,configuration.getConfigurationName()));
-        return ConfigurationControllerStatusCodes.CONFIGURATION_PAIRING_CREATED;
+        return ConfigurationControllerStatusCodes.INSERT_SUCCESSFUL;
     }
 
 
