From 747ce5f06433b9b71798ed65d84e33b96521b088 Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Wed, 10 Apr 2024 09:20:59 +0200 Subject: [PATCH] missing files --- Manager.Interfaces/DTO/ConfigurationDTO.cs | 11 ++++++---- Manager.Interfaces/DTO/SubSection/MapDTO.cs | 6 ++++++ .../DTO/SubSection/WeatherDTO.cs | 13 ++++++++++++ Manager.Interfaces/Models/Configuration.cs | 16 ++++++++++++++- .../Controllers/ConfigurationController.cs | 20 ++++++++++++++++--- 5 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 Manager.Interfaces/DTO/SubSection/WeatherDTO.cs diff --git a/Manager.Interfaces/DTO/ConfigurationDTO.cs b/Manager.Interfaces/DTO/ConfigurationDTO.cs index 715e1cb..d2110a7 100644 --- a/Manager.Interfaces/DTO/ConfigurationDTO.cs +++ b/Manager.Interfaces/DTO/ConfigurationDTO.cs @@ -25,10 +25,10 @@ namespace Manager.Interfaces.DTO public List sectionIds { get; set; } public string loaderImageId { get; set; } // == ResourceId public string loaderImageUrl { get; set; } // == Image url - public string weatherCity { get; set; } // Weather City - public DateTimeOffset? weatherUpdatedDate { get; set; } // Weather date update (to only refresh) - public string weatherResult { get; set; } // Weather result - public bool isWeather + public string weatherCity { get; set; } // Weather City // TODO REMOVE + public DateTimeOffset? weatherUpdatedDate { get; set; } // Weather date update (to only refresh) // TODO REMOVE + public string weatherResult { get; set; } // Weather result // TODO REMOVE + public bool isWeather // TODO REMOVE { get { @@ -38,5 +38,8 @@ namespace Manager.Interfaces.DTO public bool isDate { get; set; } public bool isHour { get; set; } + public bool isSectionImageBackground { get; set; } // Use to display background for section main image (or not) + public int? roundedValue { get; set; } // Use to set rounded decoration value + public int? screenPercentageSectionsMainPage { get; set; } // Use to set percentage of screen will be used to show sections (base on center) } } diff --git a/Manager.Interfaces/DTO/SubSection/MapDTO.cs b/Manager.Interfaces/DTO/SubSection/MapDTO.cs index 27c8369..78d116e 100644 --- a/Manager.Interfaces/DTO/SubSection/MapDTO.cs +++ b/Manager.Interfaces/DTO/SubSection/MapDTO.cs @@ -26,6 +26,12 @@ namespace Manager.Interfaces.DTO public CategorieDTO categorie { get; set; } public string latitude { get; set; } public string longitude { get; set; } + + public List schedules { get; set; } + public List prices { get; set; } + public List phone { get; set; } + public List email { get; set; } + public List site { get; set; } } public class CategorieDTO diff --git a/Manager.Interfaces/DTO/SubSection/WeatherDTO.cs b/Manager.Interfaces/DTO/SubSection/WeatherDTO.cs new file mode 100644 index 0000000..f70b872 --- /dev/null +++ b/Manager.Interfaces/DTO/SubSection/WeatherDTO.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Manager.Interfaces.DTO +{ + public class WeatherDTO + { + public string city { get; set; } // Weather City + public DateTimeOffset? updatedDate { get; set; } // Weather date update (to only refresh) + public string result { get; set; } // Weather result + } +} diff --git a/Manager.Interfaces/Models/Configuration.cs b/Manager.Interfaces/Models/Configuration.cs index b9053bb..774fb96 100644 --- a/Manager.Interfaces/Models/Configuration.cs +++ b/Manager.Interfaces/Models/Configuration.cs @@ -76,6 +76,15 @@ namespace Manager.Interfaces.Models [BsonElement("IsHour")] public bool IsHour { get; set; } + [BsonElement("IsSectionImageBackground")] + public bool IsSectionImageBackground { get; set; } + + [BsonElement("RoundedValue")] + public int? RoundedValue { get; set; } + + [BsonElement("ScreenPercentageSectionsMainPage")] + public int? ScreenPercentageSectionsMainPage { get; set; } + public ConfigurationDTO ToDTO(List sectionIds) { return new ConfigurationDTO() @@ -100,6 +109,9 @@ namespace Manager.Interfaces.Models instanceId = InstanceId, isDate = IsDate, isHour = IsHour, + isSectionImageBackground = IsSectionImageBackground, + roundedValue = RoundedValue, + screenPercentageSectionsMainPage = ScreenPercentageSectionsMainPage, sectionIds = sectionIds }; } @@ -126,7 +138,9 @@ namespace Manager.Interfaces.Models resources = resources, instanceId = InstanceId, isDate = IsDate, - isHour = IsHour, + isSectionImageBackground = IsSectionImageBackground, + roundedValue = RoundedValue, + screenPercentageSectionsMainPage = ScreenPercentageSectionsMainPage, sectionIds = sections.Select(s => s.id).ToList() }; } diff --git a/ManagerService/Controllers/ConfigurationController.cs b/ManagerService/Controllers/ConfigurationController.cs index b8b19a4..8457c3a 100644 --- a/ManagerService/Controllers/ConfigurationController.cs +++ b/ManagerService/Controllers/ConfigurationController.cs @@ -223,6 +223,9 @@ namespace ManagerService.Controllers configuration.WeatherResult = null; configuration.IsDate = newConfiguration.isDate; configuration.IsHour = newConfiguration.isHour; + configuration.IsSectionImageBackground = newConfiguration.isSectionImageBackground; + configuration.RoundedValue = newConfiguration.roundedValue; + configuration.ScreenPercentageSectionsMainPage = newConfiguration.screenPercentageSectionsMainPage; configuration.Languages = _configuration.GetSection("SupportedLanguages").Get>(); @@ -296,6 +299,9 @@ namespace ManagerService.Controllers } configuration.IsDate = updatedConfiguration.isDate; configuration.IsHour = updatedConfiguration.isHour; + configuration.IsSectionImageBackground = updatedConfiguration.isSectionImageBackground; + configuration.RoundedValue = updatedConfiguration.roundedValue; + configuration.ScreenPercentageSectionsMainPage = updatedConfiguration.screenPercentageSectionsMainPage; Configuration configurationModified = _configurationService.Update(updatedConfiguration.id, configuration); @@ -430,11 +436,14 @@ namespace ManagerService.Controllers } } - foreach (var categorie in mapDTO.categories) + if (mapDTO.categories != null && mapDTO.categories.Count > 0) { - if (categorie.iconResourceId != null) + foreach (var categorie in mapDTO.categories) { - addResourceToList(resourceDTOs, categorie.iconResourceId); + if (categorie.iconResourceId != null) + { + addResourceToList(resourceDTOs, categorie.iconResourceId); + } } } @@ -560,6 +569,7 @@ namespace ManagerService.Controllers case SectionType.Menu: case SectionType.Web: case SectionType.Video: + case SectionType.Weather: default: break; } @@ -643,6 +653,9 @@ namespace ManagerService.Controllers configuration.WeatherCity = exportConfiguration.weatherCity; configuration.IsDate = exportConfiguration.isDate; configuration.IsHour = exportConfiguration.isHour; + configuration.IsSectionImageBackground = exportConfiguration.isSectionImageBackground; + configuration.RoundedValue = exportConfiguration.roundedValue; + configuration.ScreenPercentageSectionsMainPage = exportConfiguration.screenPercentageSectionsMainPage; _configurationService.Create(configuration); @@ -795,6 +808,7 @@ namespace ManagerService.Controllers case SectionType.Menu: case SectionType.Web: case SectionType.Video: + case SectionType.Weather: default: break; }