From 79be291113b355ffe8c06ce9b0c92375912cd9e1 Mon Sep 17 00:00:00 2001 From: Fransolet Thomas Date: Thu, 20 Oct 2022 16:09:34 +0200 Subject: [PATCH] Add instanceId to config, section and resource --- ManagerService/Controllers/ConfigurationController.cs | 2 ++ ManagerService/Controllers/ResourceController.cs | 2 ++ ManagerService/Controllers/SectionController.cs | 2 ++ ManagerService/Controllers/UserController.cs | 3 +++ ManagerService/appsettings.json | 4 ++-- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ManagerService/Controllers/ConfigurationController.cs b/ManagerService/Controllers/ConfigurationController.cs index 6f9aa9a..9384c41 100644 --- a/ManagerService/Controllers/ConfigurationController.cs +++ b/ManagerService/Controllers/ConfigurationController.cs @@ -110,6 +110,7 @@ namespace ManagerService.Controllers // Todo add some verification ? Configuration configuration = new Configuration(); + configuration.InstanceId = newConfiguration.instanceId; configuration.Label = newConfiguration.label; configuration.Title = new List(); configuration.ImageId = newConfiguration.imageId; @@ -168,6 +169,7 @@ namespace ManagerService.Controllers throw new KeyNotFoundException("Configuration does not exist"); // Todo add some verification ? + configuration.InstanceId = updatedConfiguration.instanceId; configuration.Label = updatedConfiguration.label; configuration.Title = updatedConfiguration.title; configuration.ImageId = updatedConfiguration.imageId; diff --git a/ManagerService/Controllers/ResourceController.cs b/ManagerService/Controllers/ResourceController.cs index 2e9b8e9..e124531 100644 --- a/ManagerService/Controllers/ResourceController.cs +++ b/ManagerService/Controllers/ResourceController.cs @@ -204,6 +204,7 @@ namespace ManagerService.Controllers // Todo add some verification ? Resource resource = new Resource(); + resource.InstanceId = newResource.instanceId; resource.Label = newResource.label; resource.Type = newResource.type; resource.DateCreation = DateTime.Now; @@ -251,6 +252,7 @@ namespace ManagerService.Controllers throw new KeyNotFoundException("Resource does not exist"); // Todo add some verification ? + resource.InstanceId = updatedResource.instanceId; resource.Label = updatedResource.label; resource.Type = updatedResource.type; resource.Data = updatedResource.data; diff --git a/ManagerService/Controllers/SectionController.cs b/ManagerService/Controllers/SectionController.cs index 1eac2c2..b3b156c 100644 --- a/ManagerService/Controllers/SectionController.cs +++ b/ManagerService/Controllers/SectionController.cs @@ -233,6 +233,7 @@ namespace ManagerService.Controllers // Todo add some verification ? Section section = new Section(); + section.InstanceId = newSection.instanceId; section.Label = newSection.label; section.ImageId = newSection.imageId; section.ImageSource = newSection.imageSource; @@ -456,6 +457,7 @@ namespace ManagerService.Controllers throw new KeyNotFoundException("Section does not exist"); // Todo add some verification ? + section.InstanceId = updatedSection.instanceId; section.Label = updatedSection.label; section.Title = updatedSection.title; section.Description = updatedSection.description; diff --git a/ManagerService/Controllers/UserController.cs b/ManagerService/Controllers/UserController.cs index 5f1e16b..8e868ca 100644 --- a/ManagerService/Controllers/UserController.cs +++ b/ManagerService/Controllers/UserController.cs @@ -99,6 +99,9 @@ namespace ManagerService.Controllers if (newUser == null) throw new ArgumentNullException("User param is null"); + if (newUser.InstanceId == null) + throw new ArgumentNullException("InstanceId is null"); + newUser.Token = _tokenService.GenerateToken(newUser.Email).ToString(); newUser.DateCreation = DateTime.Now; diff --git a/ManagerService/appsettings.json b/ManagerService/appsettings.json index 1538c85..6c4d2e4 100644 --- a/ManagerService/appsettings.json +++ b/ManagerService/appsettings.json @@ -2,9 +2,9 @@ "ConnectionStrings": { //"TabletDb": "mongodb://admin:MioTech4ever!@localhost:27017" //DEV //"TabletDb": "mongodb://admin:MioTech4ever!@localhost:27017", //PROD - Thomas - "TabletDb": "mongodb://admin:MioTech4ever!@192.168.31.140:27017" //PROD - Thomas + //"TabletDb": "mongodb://admin:MioTech4ever!@192.168.31.140:27017" //PROD - Thomas //"TabletDb": "mongodb://admin:mdlf2021!@localhost:27017" //PROD MDLF - //"TabletDb": "mongodb://admin:MyMuseum2022!@51.77.222.154:27017" //PROD MyMuseum + "TabletDb": "mongodb://admin:MyMuseum2022!@51.77.222.154:27017" //PROD MyMuseum }, "Logging": { "LogLevel": {