to lowerCase in all DTO + update to GeometryDTO

This commit is contained in:
Thomas Fransolet 2025-07-16 15:28:54 +02:00
parent 62e302a0f0
commit b5396643ce
22 changed files with 463 additions and 449 deletions

View File

@ -51,7 +51,7 @@ namespace ManagerService.Controllers
{ {
List<ApplicationInstance> applicationInstances = _myInfoMateDbContext.ApplicationInstances.Where(ai => ai.InstanceId == instanceId).ToList(); List<ApplicationInstance> applicationInstances = _myInfoMateDbContext.ApplicationInstances.Where(ai => ai.InstanceId == instanceId).ToList();
return new OkObjectResult(applicationInstances.Select(ai => ai.ToDTO()).OrderBy(c => c.AppType)); return new OkObjectResult(applicationInstances.Select(ai => ai.ToDTO()).OrderBy(c => c.appType));
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -116,7 +116,7 @@ namespace ManagerService.Controllers
if (updatedApplicationInstanceDTO == null) if (updatedApplicationInstanceDTO == null)
throw new ArgumentNullException("application instance param is null"); throw new ArgumentNullException("application instance param is null");
ApplicationInstance applicationInstance = _myInfoMateDbContext.ApplicationInstances.FirstOrDefault(ai => ai.Id == updatedApplicationInstanceDTO.Id); ApplicationInstance applicationInstance = _myInfoMateDbContext.ApplicationInstances.FirstOrDefault(ai => ai.Id == updatedApplicationInstanceDTO.id);
if (applicationInstance == null) if (applicationInstance == null)
throw new KeyNotFoundException("application instance does not exist"); throw new KeyNotFoundException("application instance does not exist");
@ -208,7 +208,7 @@ namespace ManagerService.Controllers
if (applicationInstance == null) if (applicationInstance == null)
throw new KeyNotFoundException("This application instance was not found"); throw new KeyNotFoundException("This application instance was not found");
Configuration configuration = _myInfoMateDbContext.Configurations.FirstOrDefault(c => c.Id == appConfigurationLinkDTO.ConfigurationId); Configuration configuration = _myInfoMateDbContext.Configurations.FirstOrDefault(c => c.Id == appConfigurationLinkDTO.configurationId);
if (configuration == null) if (configuration == null)
throw new KeyNotFoundException("This configuration was not found"); throw new KeyNotFoundException("This configuration was not found");

View File

@ -68,7 +68,7 @@ namespace ManagerService.Controllers
configurationDTOs.Add(configurationDTO); configurationDTOs.Add(configurationDTO);
} }
return new OkObjectResult(configurationDTOs.OrderBy(c => c.DateCreation)); return new OkObjectResult(configurationDTOs.OrderBy(c => c.dateCreation));
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -224,19 +224,19 @@ namespace ManagerService.Controllers
// Todo add some verification ? // Todo add some verification ?
Configuration configuration = new Configuration(); Configuration configuration = new Configuration();
configuration.InstanceId = newConfiguration.InstanceId; configuration.InstanceId = newConfiguration.instanceId;
configuration.Label = newConfiguration.Label; configuration.Label = newConfiguration.label;
configuration.Title = new List<TranslationDTO>(); configuration.Title = new List<TranslationDTO>();
configuration.ImageId = newConfiguration.ImageId; configuration.ImageId = newConfiguration.imageId;
configuration.ImageSource = newConfiguration.ImageSource; configuration.ImageSource = newConfiguration.imageSource;
configuration.PrimaryColor = newConfiguration.PrimaryColor; configuration.PrimaryColor = newConfiguration.primaryColor;
configuration.SecondaryColor = newConfiguration.SecondaryColor; configuration.SecondaryColor = newConfiguration.secondaryColor;
configuration.LoaderImageId = newConfiguration.LoaderImageId; configuration.LoaderImageId = newConfiguration.loaderImageId;
configuration.LoaderImageUrl = newConfiguration.LoaderImageUrl; configuration.LoaderImageUrl = newConfiguration.loaderImageUrl;
configuration.Languages = newConfiguration.Languages; configuration.Languages = newConfiguration.languages;
configuration.Title = LanguageInit.Init("Title", configuration.Languages); configuration.Title = LanguageInit.Init("Title", configuration.Languages);
configuration.DateCreation = DateTime.Now.ToUniversalTime(); configuration.DateCreation = DateTime.Now.ToUniversalTime();
configuration.IsOffline = newConfiguration.IsOffline; configuration.IsOffline = newConfiguration.isOffline;
configuration.Id = idService.GenerateHexId(); configuration.Id = idService.GenerateHexId();
@ -278,23 +278,23 @@ namespace ManagerService.Controllers
if (updatedConfiguration == null) if (updatedConfiguration == null)
throw new ArgumentNullException("configuration param is null"); throw new ArgumentNullException("configuration param is null");
Configuration configuration = _myInfoMateDbContext.Configurations.FirstOrDefault(c => c.Id == updatedConfiguration.Id); Configuration configuration = _myInfoMateDbContext.Configurations.FirstOrDefault(c => c.Id == updatedConfiguration.id);
if (configuration == null) if (configuration == null)
throw new KeyNotFoundException("Configuration does not exist"); throw new KeyNotFoundException("Configuration does not exist");
// Todo add some verification ? // Todo add some verification ?
configuration.InstanceId = updatedConfiguration.InstanceId; configuration.InstanceId = updatedConfiguration.instanceId;
configuration.Label = updatedConfiguration.Label; configuration.Label = updatedConfiguration.label;
configuration.Title = updatedConfiguration.Title; configuration.Title = updatedConfiguration.title;
configuration.ImageId = updatedConfiguration.ImageId; configuration.ImageId = updatedConfiguration.imageId;
configuration.ImageSource = updatedConfiguration.ImageSource; configuration.ImageSource = updatedConfiguration.imageSource;
configuration.PrimaryColor = updatedConfiguration.PrimaryColor; configuration.PrimaryColor = updatedConfiguration.primaryColor;
configuration.SecondaryColor = updatedConfiguration.SecondaryColor; configuration.SecondaryColor = updatedConfiguration.secondaryColor;
configuration.Languages = updatedConfiguration.Languages; configuration.Languages = updatedConfiguration.languages;
configuration.IsOffline = updatedConfiguration.IsOffline; configuration.IsOffline = updatedConfiguration.isOffline;
configuration.LoaderImageId = updatedConfiguration.LoaderImageId; configuration.LoaderImageId = updatedConfiguration.loaderImageId;
configuration.LoaderImageUrl = updatedConfiguration.LoaderImageUrl; configuration.LoaderImageUrl = updatedConfiguration.loaderImageUrl;
//Configuration configurationModified = _configurationService.Update(updatedConfiguration.id, configuration); //Configuration configurationModified = _configurationService.Update(updatedConfiguration.id, configuration);
_myInfoMateDbContext.SaveChanges(); _myInfoMateDbContext.SaveChanges();
@ -620,30 +620,30 @@ namespace ManagerService.Controllers
if (exportConfiguration == null) if (exportConfiguration == null)
throw new ArgumentNullException("File to import is null"); throw new ArgumentNullException("File to import is null");
Configuration configuration = _myInfoMateDbContext.Configurations.FirstOrDefault(c => c.Id == exportConfiguration.Id); Configuration configuration = _myInfoMateDbContext.Configurations.FirstOrDefault(c => c.Id == exportConfiguration.id);
if (configuration != null) if (configuration != null)
throw new InvalidOperationException("Configuration already exist in the system"); throw new InvalidOperationException("Configuration already exist in the system");
configuration = new Configuration(); configuration = new Configuration();
configuration.Id = exportConfiguration.Id; configuration.Id = exportConfiguration.id;
configuration.InstanceId = exportConfiguration.InstanceId; configuration.InstanceId = exportConfiguration.instanceId;
configuration.Label = exportConfiguration.Label; configuration.Label = exportConfiguration.label;
configuration.Title = exportConfiguration.Title; configuration.Title = exportConfiguration.title;
configuration.ImageId = exportConfiguration.ImageId; configuration.ImageId = exportConfiguration.imageId;
configuration.ImageSource = exportConfiguration.ImageSource; configuration.ImageSource = exportConfiguration.imageSource;
if (configuration.ImageId != null) if (configuration.ImageId != null)
{ {
createResource(exportConfiguration.resources.Where(r => r.id == configuration.ImageId).FirstOrDefault()); createResource(exportConfiguration.resources.Where(r => r.id == configuration.ImageId).FirstOrDefault());
} }
configuration.DateCreation = exportConfiguration.DateCreation; configuration.DateCreation = exportConfiguration.dateCreation;
configuration.PrimaryColor = exportConfiguration.PrimaryColor; configuration.PrimaryColor = exportConfiguration.primaryColor;
configuration.SecondaryColor = exportConfiguration.SecondaryColor; configuration.SecondaryColor = exportConfiguration.secondaryColor;
configuration.Languages = exportConfiguration.Languages; configuration.Languages = exportConfiguration.languages;
configuration.IsOffline = exportConfiguration.IsOffline; configuration.IsOffline = exportConfiguration.isOffline;
configuration.LoaderImageId = exportConfiguration.LoaderImageId; configuration.LoaderImageId = exportConfiguration.loaderImageId;
configuration.LoaderImageUrl = exportConfiguration.LoaderImageUrl; configuration.LoaderImageUrl = exportConfiguration.loaderImageUrl;
if (configuration.LoaderImageId != null) if (configuration.LoaderImageId != null)
{ {

View File

@ -135,37 +135,37 @@ namespace ManagerService.Controllers
if (eventAgendaDTO == null) if (eventAgendaDTO == null)
throw new ArgumentNullException("EventAgenda param is null"); throw new ArgumentNullException("EventAgenda param is null");
var existing = _myInfoMateDbContext.EventAgendas.FirstOrDefault(ea => ea.Id == eventAgendaDTO.Id); var existing = _myInfoMateDbContext.EventAgendas.FirstOrDefault(ea => ea.Id == eventAgendaDTO.id);
if (existing == null) if (existing == null)
throw new KeyNotFoundException("EventAgenda does not exist"); throw new KeyNotFoundException("EventAgenda does not exist");
existing.Label = eventAgendaDTO.Label; existing.Label = eventAgendaDTO.label;
existing.Description = eventAgendaDTO.Description; existing.Description = eventAgendaDTO.description;
existing.Type = eventAgendaDTO.Type; existing.Type = eventAgendaDTO.type;
existing.DateAdded = eventAgendaDTO.DateAdded; existing.DateAdded = eventAgendaDTO.dateAdded;
existing.DateFrom = eventAgendaDTO.DateFrom; existing.DateFrom = eventAgendaDTO.dateFrom;
existing.DateTo = eventAgendaDTO.DateTo; existing.DateTo = eventAgendaDTO.dateTo;
existing.Website = eventAgendaDTO.Website; existing.Website = eventAgendaDTO.website;
existing.ResourceId = eventAgendaDTO.ResourceId; existing.ResourceId = eventAgendaDTO.resourceId;
existing.Phone = eventAgendaDTO.Phone; existing.Phone = eventAgendaDTO.phone;
existing.Email = eventAgendaDTO.Email; existing.Email = eventAgendaDTO.email;
existing.SectionAgendaId = eventAgendaDTO.SectionAgendaId; existing.SectionAgendaId = eventAgendaDTO.sectionAgendaId;
existing.SectionEventId = eventAgendaDTO.SectionEventId; existing.SectionEventId = eventAgendaDTO.sectionEventId;
if (eventAgendaDTO.Address != null) if (eventAgendaDTO.address != null)
{ {
existing.Address = new EventAddress existing.Address = new EventAddress
{ {
Address = eventAgendaDTO.Address.Address, Address = eventAgendaDTO.address.address,
StreetNumber = eventAgendaDTO.Address.StreetNumber, StreetNumber = eventAgendaDTO.address.streetNumber,
StreetName = eventAgendaDTO.Address.StreetName, StreetName = eventAgendaDTO.address.streetName,
City = eventAgendaDTO.Address.City, City = eventAgendaDTO.address.city,
State = eventAgendaDTO.Address.State, State = eventAgendaDTO.address.state,
PostCode = eventAgendaDTO.Address.PostCode, PostCode = eventAgendaDTO.address.postCode,
Country = eventAgendaDTO.Address.Country, Country = eventAgendaDTO.address.country,
Geometry = eventAgendaDTO.Address.Geometry?.FromDto(), Geometry = eventAgendaDTO.address.geometry?.FromDto(),
PolyColor = eventAgendaDTO.Address.PolyColor, PolyColor = eventAgendaDTO.address.polyColor,
Zoom = eventAgendaDTO.Address.Zoom Zoom = eventAgendaDTO.address.zoom
}; };
} }

View File

@ -1,6 +1,7 @@
using ManagerService.Data; using ManagerService.Data;
using ManagerService.Data.SubSection; using ManagerService.Data.SubSection;
using ManagerService.DTOs; using ManagerService.DTOs;
using ManagerService.Helpers;
using ManagerService.Services; using ManagerService.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@ -137,14 +138,14 @@ namespace ManagerService.Controllers
if (programmeBlockDTO == null) if (programmeBlockDTO == null)
throw new ArgumentNullException("ProgrammeBlock param is null"); throw new ArgumentNullException("ProgrammeBlock param is null");
var existingProgramBlock = _myInfoMateDbContext.ProgrammeBlocks.FirstOrDefault(pb => pb.Id == programmeBlockDTO.Id); var existingProgramBlock = _myInfoMateDbContext.ProgrammeBlocks.FirstOrDefault(pb => pb.Id == programmeBlockDTO.id);
if (existingProgramBlock == null) if (existingProgramBlock == null)
throw new KeyNotFoundException("ProgrammeBlock does not exist"); throw new KeyNotFoundException("ProgrammeBlock does not exist");
existingProgramBlock.Title = programmeBlockDTO.Title; existingProgramBlock.Title = programmeBlockDTO.title;
existingProgramBlock.Description = programmeBlockDTO.Description; existingProgramBlock.Description = programmeBlockDTO.description;
existingProgramBlock.StartTime = programmeBlockDTO.StartTime; existingProgramBlock.StartTime = programmeBlockDTO.startTime;
existingProgramBlock.EndTime = programmeBlockDTO.EndTime; existingProgramBlock.EndTime = programmeBlockDTO.endTime;
_myInfoMateDbContext.SaveChanges(); _myInfoMateDbContext.SaveChanges();
@ -309,17 +310,24 @@ namespace ManagerService.Controllers
if (mapAnnotationDTO == null) if (mapAnnotationDTO == null)
throw new ArgumentNullException("MapAnnotation param is null"); throw new ArgumentNullException("MapAnnotation param is null");
var existingMapAnnotation = _myInfoMateDbContext.MapAnnotations.Include(ma => ma.IconResource).FirstOrDefault(ma => ma.Id == mapAnnotationDTO.Id); var existingMapAnnotation = _myInfoMateDbContext.MapAnnotations.Include(ma => ma.IconResource).FirstOrDefault(ma => ma.Id == mapAnnotationDTO.id);
if (existingMapAnnotation == null) if (existingMapAnnotation == null)
throw new KeyNotFoundException("MapAnnotation does not exist"); throw new KeyNotFoundException("MapAnnotation does not exist");
existingMapAnnotation.Type = mapAnnotationDTO.Type; existingMapAnnotation.Type = mapAnnotationDTO.type;
existingMapAnnotation.Label = mapAnnotationDTO.Label; existingMapAnnotation.Label = mapAnnotationDTO.label;
existingMapAnnotation.GeometryType = mapAnnotationDTO.GeometryType; existingMapAnnotation.GeometryType = mapAnnotationDTO.geometryType;
existingMapAnnotation.Geometry = mapAnnotationDTO.Geometry; if (mapAnnotationDTO.geometry != null)
existingMapAnnotation.PolyColor = mapAnnotationDTO.PolyColor; {
existingMapAnnotation.Icon = mapAnnotationDTO.Icon; existingMapAnnotation.Geometry = mapAnnotationDTO.geometry.FromDto();
existingMapAnnotation.IconResourceId = mapAnnotationDTO.IconResourceId; }
else
{
existingMapAnnotation.Geometry = null;
}
existingMapAnnotation.PolyColor = mapAnnotationDTO.polyColor;
existingMapAnnotation.Icon = mapAnnotationDTO.icon;
existingMapAnnotation.IconResourceId = mapAnnotationDTO.iconResourceId;
_myInfoMateDbContext.SaveChanges(); _myInfoMateDbContext.SaveChanges();

View File

@ -9,12 +9,10 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using NetTopologySuite.Geometries;
using NSwag.Annotations; using NSwag.Annotations;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using static ManagerService.Data.SubSection.SectionEvent;
namespace ManagerService.Controllers namespace ManagerService.Controllers
{ {
@ -430,19 +428,19 @@ namespace ManagerService.Controllers
if (guidedPathDTO == null) if (guidedPathDTO == null)
throw new ArgumentNullException("GuidedPath param is null"); throw new ArgumentNullException("GuidedPath param is null");
var existingGuidedPath = _myInfoMateDbContext.GuidedPaths.FirstOrDefault(gp => gp.Id == guidedPathDTO.Id); var existingGuidedPath = _myInfoMateDbContext.GuidedPaths.FirstOrDefault(gp => gp.Id == guidedPathDTO.id);
if (existingGuidedPath == null) if (existingGuidedPath == null)
throw new KeyNotFoundException("GuidedPath does not exist"); throw new KeyNotFoundException("GuidedPath does not exist");
existingGuidedPath.InstanceId = guidedPathDTO.InstanceId; existingGuidedPath.InstanceId = guidedPathDTO.instanceId;
existingGuidedPath.Title = guidedPathDTO.Title ?? new List<TranslationDTO>(); existingGuidedPath.Title = guidedPathDTO.title ?? new List<TranslationDTO>();
existingGuidedPath.Description = guidedPathDTO.Description ?? new List<TranslationDTO>(); existingGuidedPath.Description = guidedPathDTO.description ?? new List<TranslationDTO>();
existingGuidedPath.SectionMapId = guidedPathDTO.SectionMapId; existingGuidedPath.SectionMapId = guidedPathDTO.sectionMapId;
existingGuidedPath.SectionEventId = guidedPathDTO.SectionEventId; existingGuidedPath.SectionEventId = guidedPathDTO.sectionEventId;
existingGuidedPath.IsLinear = guidedPathDTO.IsLinear; existingGuidedPath.IsLinear = guidedPathDTO.isLinear;
existingGuidedPath.RequireSuccessToAdvance = guidedPathDTO.RequireSuccessToAdvance; existingGuidedPath.RequireSuccessToAdvance = guidedPathDTO.requireSuccessToAdvance;
existingGuidedPath.HideNextStepsUntilComplete = guidedPathDTO.HideNextStepsUntilComplete; existingGuidedPath.HideNextStepsUntilComplete = guidedPathDTO.hideNextStepsUntilComplete;
existingGuidedPath.Order = guidedPathDTO.Order; existingGuidedPath.Order = guidedPathDTO.order;
_myInfoMateDbContext.SaveChanges(); _myInfoMateDbContext.SaveChanges();
@ -597,24 +595,31 @@ namespace ManagerService.Controllers
if (guidedStepDTO == null) if (guidedStepDTO == null)
throw new ArgumentNullException("GuidedStep param is null"); throw new ArgumentNullException("GuidedStep param is null");
var existingGuidedStep = _myInfoMateDbContext.GuidedSteps.FirstOrDefault(gs => gs.Id == guidedStepDTO.Id); var existingGuidedStep = _myInfoMateDbContext.GuidedSteps.FirstOrDefault(gs => gs.Id == guidedStepDTO.id);
if (existingGuidedStep == null) if (existingGuidedStep == null)
throw new KeyNotFoundException("GuidedStep does not exist"); throw new KeyNotFoundException("GuidedStep does not exist");
existingGuidedStep.GuidedPathId = guidedStepDTO.GuidedPathId; existingGuidedStep.GuidedPathId = guidedStepDTO.guidedPathId;
existingGuidedStep.Order = guidedStepDTO.Order; existingGuidedStep.Order = guidedStepDTO.order;
existingGuidedStep.Title = guidedStepDTO.Title; existingGuidedStep.Title = guidedStepDTO.title;
existingGuidedStep.Description = guidedStepDTO.Description; existingGuidedStep.Description = guidedStepDTO.description;
existingGuidedStep.Geometry = guidedStepDTO.Geometry != null ? guidedStepDTO.Geometry : null; // TO TEST if (guidedStepDTO.geometry != null)
existingGuidedStep.ZoneRadiusMeters = guidedStepDTO.ZoneRadiusMeters; {
existingGuidedStep.ImageUrl = guidedStepDTO.ImageUrl; existingGuidedStep.Geometry = guidedStepDTO.geometry.FromDto();
existingGuidedStep.TriggerGeoPointId = guidedStepDTO.TriggerGeoPointId; }
existingGuidedStep.IsHiddenInitially = guidedStepDTO.IsHiddenInitially; else
existingGuidedStep.QuizQuestions = guidedStepDTO.QuizQuestions; // à convertir si besoin ? {
existingGuidedStep.IsStepTimer = guidedStepDTO.IsStepTimer; existingGuidedStep.Geometry = null;
existingGuidedStep.IsStepLocked = guidedStepDTO.IsStepLocked; }
existingGuidedStep.TimerSeconds = guidedStepDTO.TimerSeconds; existingGuidedStep.ZoneRadiusMeters = guidedStepDTO.zoneRadiusMeters;
existingGuidedStep.TimerExpiredMessage = guidedStepDTO.TimerExpiredMessage; existingGuidedStep.ImageUrl = guidedStepDTO.imageUrl;
existingGuidedStep.TriggerGeoPointId = guidedStepDTO.triggerGeoPointId;
existingGuidedStep.IsHiddenInitially = guidedStepDTO.isHiddenInitially;
existingGuidedStep.QuizQuestions = guidedStepDTO.quizQuestions; // à convertir si besoin ?
existingGuidedStep.IsStepTimer = guidedStepDTO.isStepTimer;
existingGuidedStep.IsStepLocked = guidedStepDTO.isStepLocked;
existingGuidedStep.TimerSeconds = guidedStepDTO.timerSeconds;
existingGuidedStep.TimerExpiredMessage = guidedStepDTO.timerExpiredMessage;
_myInfoMateDbContext.SaveChanges(); _myInfoMateDbContext.SaveChanges();

View File

@ -2,16 +2,16 @@
{ {
public class AppConfigurationLinkDTO public class AppConfigurationLinkDTO
{ {
public string Id { get; set; } public string id { get; set; }
public string ConfigurationId { get; set; } public string configurationId { get; set; }
public string ApplicationInstanceId { get; set; } public string applicationInstanceId { get; set; }
public int? Order { get; set; } public int? order { get; set; }
public bool IsActive { get; set; } = true; public bool isActive { get; set; } = true;
public int? WeightMasonryGrid { get; set; } public int? weightMasonryGrid { get; set; }
} }
} }

View File

@ -5,36 +5,36 @@ namespace ManagerService.DTOs
{ {
public class ApplicationInstanceDTO public class ApplicationInstanceDTO
{ {
public string Id { get; set; } public string id { get; set; }
public string InstanceId { get; set; } public string instanceId { get; set; }
public AppType AppType { get; set; } public AppType appType { get; set; }
public List<AppConfigurationLink> Configurations { get; set; } public List<AppConfigurationLink> configurations { get; set; }
public string MainImageId { get; set; } public string mainImageId { get; set; }
public string MainImageUrl { get; set; } public string mainImageUrl { get; set; }
public string LoaderImageId { get; set; } public string loaderImageId { get; set; }
public string LoaderImageUrl { get; set; } public string loaderImageUrl { get; set; }
public bool IsDate { get; set; } public bool isDate { get; set; }
public bool IsHour { get; set; } public bool isHour { get; set; }
public string PrimaryColor { get; set; } public string primaryColor { get; set; }
public string SecondaryColor { get; set; } public string secondaryColor { get; set; }
public int? RoundedValue { get; set; } public int? roundedValue { get; set; }
public int? ScreenPercentageSectionsMainPage { get; set; } public int? screenPercentageSectionsMainPage { get; set; }
public bool IsSectionImageBackground { get; set; } public bool isSectionImageBackground { get; set; }
public List<string> Languages { get; set; } public List<string> languages { get; set; }
} }
} }

View File

@ -5,19 +5,19 @@ namespace ManagerService.DTOs
{ {
public class ConfigurationDTO public class ConfigurationDTO
{ {
public string Id { get; set; } public string id { get; set; }
public string InstanceId { get; set; } public string instanceId { get; set; }
public string Label { get; set; } public string label { get; set; }
public List<TranslationDTO> Title { get; set; } public List<TranslationDTO> title { get; set; }
public string ImageId { get; set; } // == ResourceId public string imageId { get; set; } // == ResourceId
public string ImageSource { get; set; } // == Image url public string imageSource { get; set; } // == Image url
public string PrimaryColor { get; set; } public string primaryColor { get; set; }
public string SecondaryColor { get; set; } public string secondaryColor { get; set; }
public List<string> Languages { get; set; } // fr, en, de, nl => Sélection dans une liste déjà établie dans l'application ! public List<string> languages { get; set; } // fr, en, de, nl => Sélection dans une liste déjà établie dans l'application !
public DateTime DateCreation { get; set; } public DateTime dateCreation { get; set; }
public bool IsOffline { get; set; } public bool isOffline { get; set; }
public List<string> sectionIds { get; set; } public List<string> sectionIds { get; set; }
public string LoaderImageId { get; set; } // == ResourceId public string loaderImageId { get; set; } // == ResourceId
public string LoaderImageUrl { get; set; } // == Image url public string loaderImageUrl { get; set; } // == Image url
} }
} }

View File

@ -6,57 +6,58 @@ namespace ManagerService.DTOs
{ {
public class EventAgendaDTO public class EventAgendaDTO
{ {
public int Id { get; set; } public int id { get; set; }
public List<TranslationDTO> Label { get; set; } public List<TranslationDTO> label { get; set; }
public List<TranslationDTO> Description { get; set; } public List<TranslationDTO> description { get; set; }
public string Type { get; set; } public string type { get; set; }
public DateTime? DateAdded { get; set; } public DateTime? dateAdded { get; set; }
public DateTime? DateFrom { get; set; } public DateTime? dateFrom { get; set; }
public DateTime? DateTo { get; set; } public DateTime? dateTo { get; set; }
public string? Website { get; set; } public string? website { get; set; }
public string ResourceId { get; set; } // Background image id public string resourceId { get; set; } // Background image id
public ResourceDTO Resource { get; set; } // Background image public ResourceDTO resource { get; set; } // Background image
public EventAddressDTO Address { get; set; } public EventAddressDTO address { get; set; }
public string Phone { get; set; } public string phone { get; set; }
public string Email { get; set; } public string email { get; set; }
public string SectionAgendaId { get; set; } public string sectionAgendaId { get; set; }
public string SectionEventId { get; set; }
public string sectionEventId { get; set; }
} }
public class EventAddressDTO public class EventAddressDTO
{ {
public string Address { get; set; } public string address { get; set; }
public string StreetNumber { get; set; } public string streetNumber { get; set; }
public string StreetName { get; set; } public string streetName { get; set; }
public string City { get; set; } public string city { get; set; }
public string State { get; set; } public string state { get; set; }
public string PostCode { get; set; } public string postCode { get; set; }
public string Country { get; set; } public string country { get; set; }
public GeometryDTO Geometry { get; set; } public GeometryDTO geometry { get; set; }
public string PolyColor { get; set; } // color of the polyline or polygon public string polyColor { get; set; } // color of the polyline or polygon
public int Zoom { get; set; } public int zoom { get; set; }
} }
} }

View File

@ -4,16 +4,16 @@ namespace ManagerService.DTOs
{ {
public class GuidedPathDTO public class GuidedPathDTO
{ {
public string Id { get; set; } public string id { get; set; }
public string InstanceId { get; set; } public string instanceId { get; set; }
public List<TranslationDTO> Title { get; set; } public List<TranslationDTO> title { get; set; }
public List<TranslationDTO> Description { get; set; } public List<TranslationDTO> description { get; set; }
public string? SectionMapId { get; set; } public string? sectionMapId { get; set; }
public string? SectionEventId { get; set; } public string? sectionEventId { get; set; }
public bool IsLinear { get; set; } public bool isLinear { get; set; }
public bool RequireSuccessToAdvance { get; set; } public bool requireSuccessToAdvance { get; set; }
public bool HideNextStepsUntilComplete { get; set; } public bool hideNextStepsUntilComplete { get; set; }
public int Order { get; set; } public int order { get; set; }
public List<GuidedStepDTO> Steps { get; set; } public List<GuidedStepDTO> steps { get; set; }
} }
} }

View File

@ -1,27 +1,26 @@
using System.Collections.Generic; using System.Collections.Generic;
using Manager.DTOs; using Manager.DTOs;
using ManagerService.Data.SubSection; using ManagerService.Data.SubSection;
using NetTopologySuite.Geometries;
namespace ManagerService.DTOs namespace ManagerService.DTOs
{ {
public class GuidedStepDTO public class GuidedStepDTO
{ {
public string Id { get; set; } public string id { get; set; }
public string GuidedPathId { get; set; } public string guidedPathId { get; set; }
public int Order { get; set; } public int order { get; set; }
public List<TranslationDTO> Title { get; set; } public List<TranslationDTO> title { get; set; }
public List<TranslationDTO> Description { get; set; } public List<TranslationDTO> description { get; set; }
public Geometry Geometry { get; set; } public GeometryDTO geometry { get; set; }
public double? ZoneRadiusMeters { get; set; } public double? zoneRadiusMeters { get; set; }
public string ImageUrl { get; set; } public string imageUrl { get; set; }
public int? TriggerGeoPointId { get; set; } public int? triggerGeoPointId { get; set; }
public GeoPointDTO? TriggerGeoPoint { get; set; } public GeoPointDTO? triggerGeoPoint { get; set; }
public bool IsHiddenInitially { get; set; } public bool isHiddenInitially { get; set; }
public bool IsStepTimer { get; set; } public bool isStepTimer { get; set; }
public bool IsStepLocked { get; set; } public bool isStepLocked { get; set; }
public int? TimerSeconds { get; set; } public int? timerSeconds { get; set; }
public List<TranslationDTO> TimerExpiredMessage { get; set; } public List<TranslationDTO> timerExpiredMessage { get; set; }
public List<QuizQuestion> QuizQuestions { get; set; } public List<QuizQuestion> quizQuestions { get; set; }
} }
} }

View File

@ -1,19 +1,19 @@
using NetTopologySuite.Geometries; using System.Collections.Generic;
using System.Collections.Generic;
using ManagerService.Data.SubSection; using ManagerService.Data.SubSection;
using Manager.DTOs;
namespace ManagerService.DTOs namespace ManagerService.DTOs
{ {
public class MapAnnotationDTO public class MapAnnotationDTO
{ {
public string Id { get; set; } public string id { get; set; }
public List<TranslationDTO> Type { get; set; } public List<TranslationDTO> type { get; set; }
public List<TranslationDTO> Label { get; set; } public List<TranslationDTO> label { get; set; }
public SectionEvent.GeometryType GeometryType { get; set; } public SectionEvent.GeometryType geometryType { get; set; }
public Geometry Geometry { get; set; } public GeometryDTO geometry { get; set; }
public string PolyColor { get; set; } public string polyColor { get; set; }
public string Icon { get; set; } public string icon { get; set; }
public string IconResourceId { get; set; } public string iconResourceId { get; set; }
public ResourceDTO IconResource { get; set; } public ResourceDTO iconResource { get; set; }
} }
} }

View File

@ -5,11 +5,11 @@ namespace ManagerService.DTOs
{ {
public class ProgrammeBlockDTO public class ProgrammeBlockDTO
{ {
public string Id { get; set; } public string id { get; set; }
public List<TranslationDTO> Title { get; set; } public List<TranslationDTO> title { get; set; }
public List<TranslationDTO> Description { get; set; } public List<TranslationDTO> description { get; set; }
public DateTime StartTime { get; set; } public DateTime startTime { get; set; }
public DateTime EndTime { get; set; } public DateTime endTime { get; set; }
public List<MapAnnotationDTO> MapAnnotations { get; set; } public List<MapAnnotationDTO> mapAnnotations { get; set; }
} }
} }

View File

@ -48,8 +48,8 @@ namespace Manager.DTOs
public class GeometryDTO public class GeometryDTO
{ {
public string Type { get; set; } // "Point", "Polygon", "LineString" public string type { get; set; } // "Point", "Polygon", "LineString"
public object Coordinates { get; set; } public object coordinates { get; set; }
} }
/*public class ContentGeoPoint /*public class ContentGeoPoint

View File

@ -39,12 +39,12 @@ namespace ManagerService.Data
{ {
return new AppConfigurationLinkDTO() return new AppConfigurationLinkDTO()
{ {
Id = Id, id = Id,
ConfigurationId = ConfigurationId, configurationId = ConfigurationId,
ApplicationInstanceId = ApplicationInstanceId, applicationInstanceId = ApplicationInstanceId,
Order = Order, order = Order,
IsActive = IsActive, isActive = IsActive,
WeightMasonryGrid = WeightMasonryGrid weightMasonryGrid = WeightMasonryGrid
}; };
} }
@ -52,12 +52,12 @@ namespace ManagerService.Data
{ {
return new AppConfigurationLink() return new AppConfigurationLink()
{ {
Id = appConfigurationLinkDTO.Id, Id = appConfigurationLinkDTO.id,
ConfigurationId = appConfigurationLinkDTO.ConfigurationId, ConfigurationId = appConfigurationLinkDTO.configurationId,
ApplicationInstanceId = appConfigurationLinkDTO.ApplicationInstanceId, ApplicationInstanceId = appConfigurationLinkDTO.applicationInstanceId,
Order = appConfigurationLinkDTO.Order, Order = appConfigurationLinkDTO.order,
IsActive = appConfigurationLinkDTO.IsActive, IsActive = appConfigurationLinkDTO.isActive,
WeightMasonryGrid = appConfigurationLinkDTO?.WeightMasonryGrid, WeightMasonryGrid = appConfigurationLinkDTO?.weightMasonryGrid,
}; };
} }

View File

@ -58,22 +58,22 @@ namespace ManagerService.Data
{ {
return new ApplicationInstanceDTO() return new ApplicationInstanceDTO()
{ {
Id = Id, id = Id,
InstanceId = InstanceId, instanceId = InstanceId,
AppType = AppType, appType = AppType,
Configurations = Configurations, configurations = Configurations,
MainImageId = MainImageId, mainImageId = MainImageId,
MainImageUrl = MainImageUrl, mainImageUrl = MainImageUrl,
LoaderImageId = LoaderImageId, loaderImageId = LoaderImageId,
LoaderImageUrl = LoaderImageUrl, loaderImageUrl = LoaderImageUrl,
IsDate = IsDate, isDate = IsDate,
IsHour = IsHour, isHour = IsHour,
PrimaryColor = PrimaryColor, primaryColor = PrimaryColor,
SecondaryColor = SecondaryColor, secondaryColor = SecondaryColor,
RoundedValue = RoundedValue, roundedValue = RoundedValue,
ScreenPercentageSectionsMainPage = ScreenPercentageSectionsMainPage, screenPercentageSectionsMainPage = ScreenPercentageSectionsMainPage,
IsSectionImageBackground = IsSectionImageBackground, isSectionImageBackground = IsSectionImageBackground,
Languages = Languages languages = Languages
}; };
} }
@ -81,22 +81,22 @@ namespace ManagerService.Data
{ {
return new ApplicationInstance() return new ApplicationInstance()
{ {
Id = applicationInstanceDTO.Id, Id = applicationInstanceDTO.id,
InstanceId = applicationInstanceDTO.InstanceId, InstanceId = applicationInstanceDTO.instanceId,
AppType = applicationInstanceDTO.AppType, AppType = applicationInstanceDTO.appType,
MainImageId = applicationInstanceDTO.MainImageId, MainImageId = applicationInstanceDTO.mainImageId,
MainImageUrl = applicationInstanceDTO.MainImageUrl, MainImageUrl = applicationInstanceDTO.mainImageUrl,
LoaderImageId = applicationInstanceDTO.LoaderImageId, LoaderImageId = applicationInstanceDTO.loaderImageId,
LoaderImageUrl = applicationInstanceDTO.LoaderImageUrl, LoaderImageUrl = applicationInstanceDTO.loaderImageUrl,
IsDate = applicationInstanceDTO.IsDate, IsDate = applicationInstanceDTO.isDate,
IsHour = applicationInstanceDTO.IsHour, IsHour = applicationInstanceDTO.isHour,
PrimaryColor = applicationInstanceDTO.PrimaryColor, PrimaryColor = applicationInstanceDTO.primaryColor,
SecondaryColor = applicationInstanceDTO.SecondaryColor, SecondaryColor = applicationInstanceDTO.secondaryColor,
RoundedValue = applicationInstanceDTO.RoundedValue, RoundedValue = applicationInstanceDTO.roundedValue,
ScreenPercentageSectionsMainPage = applicationInstanceDTO.ScreenPercentageSectionsMainPage, ScreenPercentageSectionsMainPage = applicationInstanceDTO.screenPercentageSectionsMainPage,
IsSectionImageBackground = applicationInstanceDTO.IsSectionImageBackground, IsSectionImageBackground = applicationInstanceDTO.isSectionImageBackground,
Languages = applicationInstanceDTO.Languages, Languages = applicationInstanceDTO.languages,
Configurations = applicationInstanceDTO.Configurations, Configurations = applicationInstanceDTO.configurations,
}; };
} }

View File

@ -55,19 +55,19 @@ namespace ManagerService.Data
{ {
return new ConfigurationDTO() return new ConfigurationDTO()
{ {
Id = Id, id = Id,
InstanceId = InstanceId, instanceId = InstanceId,
Label = Label, label = Label,
Title = Title, title = Title,
ImageId = ImageId, imageId = ImageId,
ImageSource = ImageSource, imageSource = ImageSource,
LoaderImageId = LoaderImageId, loaderImageId = LoaderImageId,
LoaderImageUrl = LoaderImageUrl, loaderImageUrl = LoaderImageUrl,
DateCreation = DateCreation, dateCreation = DateCreation,
PrimaryColor = PrimaryColor, primaryColor = PrimaryColor,
Languages = Languages, languages = Languages,
SecondaryColor = SecondaryColor, secondaryColor = SecondaryColor,
IsOffline = IsOffline, isOffline = IsOffline,
sectionIds = sectionIds sectionIds = sectionIds
}; };
} }
@ -75,19 +75,19 @@ namespace ManagerService.Data
public ExportConfigurationDTO ToExportDTO(List<SectionDTO> sections, List<ResourceDTO> resources) { public ExportConfigurationDTO ToExportDTO(List<SectionDTO> sections, List<ResourceDTO> resources) {
return new ExportConfigurationDTO() return new ExportConfigurationDTO()
{ {
Id = Id, id = Id,
InstanceId = InstanceId, instanceId = InstanceId,
Label = Label, label = Label,
Title = Title, title = Title,
ImageId = ImageId, imageId = ImageId,
ImageSource = ImageSource, imageSource = ImageSource,
LoaderImageId = LoaderImageId, loaderImageId = LoaderImageId,
LoaderImageUrl = LoaderImageUrl, loaderImageUrl = LoaderImageUrl,
DateCreation = DateCreation, dateCreation = DateCreation,
PrimaryColor = PrimaryColor, primaryColor = PrimaryColor,
Languages = Languages, languages = Languages,
SecondaryColor = SecondaryColor, secondaryColor = SecondaryColor,
IsOffline = IsOffline, isOffline = IsOffline,
sections = sections, sections = sections,
resources = resources, resources = resources,
sectionIds = sections.Select(s => s.id).ToList() sectionIds = sections.Select(s => s.id).ToList()

View File

@ -88,19 +88,19 @@ namespace ManagerService.Data
{ {
return new ConfigurationDTO() return new ConfigurationDTO()
{ {
Id = Id, id = Id,
InstanceId = InstanceId, instanceId = InstanceId,
Label = Label, label = Label,
Title = Title, title = Title,
ImageId = ImageId, imageId = ImageId,
ImageSource = ImageSource, imageSource = ImageSource,
PrimaryColor = PrimaryColor, primaryColor = PrimaryColor,
SecondaryColor = SecondaryColor, secondaryColor = SecondaryColor,
Languages = Languages, languages = Languages,
DateCreation = DateCreation, dateCreation = DateCreation,
IsOffline = IsOffline, isOffline = IsOffline,
LoaderImageId = LoaderImageId, loaderImageId = LoaderImageId,
LoaderImageUrl = LoaderImageUrl, loaderImageUrl = LoaderImageUrl,
sectionIds = sectionIds sectionIds = sectionIds
}; };
} }
@ -108,19 +108,19 @@ namespace ManagerService.Data
public ExportConfigurationDTO ToExportDTO(List<SectionDTO> sections, List<ResourceDTO> resources) { public ExportConfigurationDTO ToExportDTO(List<SectionDTO> sections, List<ResourceDTO> resources) {
return new ExportConfigurationDTO() return new ExportConfigurationDTO()
{ {
Id = Id, id = Id,
InstanceId = InstanceId, instanceId = InstanceId,
Label = Label, label = Label,
Title = Title, title = Title,
ImageId = ImageId, imageId = ImageId,
ImageSource = ImageSource, imageSource = ImageSource,
PrimaryColor = PrimaryColor, primaryColor = PrimaryColor,
SecondaryColor = SecondaryColor, secondaryColor = SecondaryColor,
Languages = Languages, languages = Languages,
DateCreation = DateCreation, dateCreation = DateCreation,
IsOffline = IsOffline, isOffline = IsOffline,
LoaderImageId = LoaderImageId, loaderImageId = LoaderImageId,
LoaderImageUrl = LoaderImageUrl, loaderImageUrl = LoaderImageUrl,
sections = sections, sections = sections,
resources = resources, resources = resources,
sectionIds = sections.Select(s => s.id).ToList() sectionIds = sections.Select(s => s.id).ToList()

View File

@ -61,36 +61,36 @@ namespace ManagerService.Data.SubSection
{ {
return new EventAgendaDTO() return new EventAgendaDTO()
{ {
Id = Id, id = Id,
Label = Label, label = Label,
Description = Description, description = Description,
Type = Type, type = Type,
DateAdded = DateAdded, dateAdded = DateAdded,
DateFrom = DateFrom, dateFrom = DateFrom,
DateTo = DateTo, dateTo = DateTo,
Website = Website, website = Website,
ResourceId = ResourceId, resourceId = ResourceId,
Resource = Resource?.ToDTO(), resource = Resource?.ToDTO(),
Address = Address != null ? new EventAddressDTO address = Address != null ? new EventAddressDTO
{ {
Address = Address.Address, address = Address.Address,
StreetNumber = Address.StreetNumber, streetNumber = Address.StreetNumber,
StreetName = Address.StreetName, streetName = Address.StreetName,
City = Address.City, city = Address.City,
State = Address.State, state = Address.State,
PostCode = Address.PostCode, postCode = Address.PostCode,
Country = Address.Country, country = Address.Country,
Geometry = Address.Geometry != null ? new GeometryDTO geometry = Address.Geometry != null ? new GeometryDTO
{ {
Type = Address.Geometry.GeometryType, type = Address.Geometry.GeometryType,
Coordinates = Address.Geometry.Coordinates, coordinates = Address.Geometry.Coordinates,
} : null, } : null,
PolyColor = Address.PolyColor, polyColor = Address.PolyColor,
Zoom = Address.Zoom zoom = Address.Zoom
} : null, } : null,
Phone = Phone, phone = Phone,
Email = Email, email = Email,
SectionAgendaId = SectionAgendaId sectionAgendaId = SectionAgendaId
}; };
} }
@ -98,32 +98,32 @@ namespace ManagerService.Data.SubSection
{ {
return new EventAgenda return new EventAgenda
{ {
Id = dto.Id, Id = dto.id,
Label = dto.Label, Label = dto.label,
Description = dto.Description, Description = dto.description,
Type = dto.Type, Type = dto.type,
DateAdded = dto.DateAdded, DateAdded = dto.dateAdded,
DateFrom = dto.DateFrom, DateFrom = dto.dateFrom,
DateTo = dto.DateTo, DateTo = dto.dateTo,
Website = dto.Website, Website = dto.website,
ResourceId = dto.ResourceId, ResourceId = dto.resourceId,
//Resource = dto.Resource != null ? Resource.From(dto.Resource) : null, //Resource = dto.Resource != null ? Resource.From(dto.Resource) : null,
Address = dto.Address != null ? new EventAddress Address = dto.address != null ? new EventAddress
{ {
Address = dto.Address.Address, Address = dto.address.address,
StreetNumber = dto.Address.StreetNumber, StreetNumber = dto.address.streetNumber,
StreetName = dto.Address.StreetName, StreetName = dto.address.streetName,
City = dto.Address.City, City = dto.address.city,
State = dto.Address.State, State = dto.address.state,
PostCode = dto.Address.PostCode, PostCode = dto.address.postCode,
Country = dto.Address.Country, Country = dto.address.country,
Geometry = dto.Address.Geometry!= null ? dto.Address.Geometry.FromDto() : null, Geometry = dto.address.geometry!= null ? dto.address.geometry.FromDto() : null,
PolyColor = dto.Address.PolyColor, PolyColor = dto.address.polyColor,
Zoom = dto.Address.Zoom Zoom = dto.address.zoom
} : null, } : null,
Phone = dto.Phone, Phone = dto.phone,
Email = dto.Email, Email = dto.email,
SectionAgendaId = dto.SectionAgendaId SectionAgendaId = dto.sectionAgendaId
}; };
} }

View File

@ -1,4 +1,5 @@
using ManagerService.DTOs; using ManagerService.DTOs;
using ManagerService.Helpers;
using NetTopologySuite.Geometries; using NetTopologySuite.Geometries;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -36,12 +37,12 @@ namespace ManagerService.Data.SubSection
{ {
return new ProgrammeBlockDTO return new ProgrammeBlockDTO
{ {
Id = this.Id, id = this.Id,
Title = this.Title, title = this.Title,
Description = this.Description, description = this.Description,
StartTime = this.StartTime, startTime = this.StartTime,
EndTime = this.EndTime, endTime = this.EndTime,
MapAnnotations = this.MapAnnotations?.Select(ma => ma.ToDTO()).ToList() mapAnnotations = this.MapAnnotations?.Select(ma => ma.ToDTO()).ToList()
}; };
} }
@ -49,11 +50,11 @@ namespace ManagerService.Data.SubSection
{ {
return new ProgrammeBlock return new ProgrammeBlock
{ {
Id = dto.Id, Id = dto.id,
Title = dto.Title, Title = dto.title,
Description = dto.Description, Description = dto.description,
StartTime = dto.StartTime, StartTime = dto.startTime,
EndTime = dto.EndTime, EndTime = dto.endTime,
//MapAnnotations = dto.MapAnnotations?.Select(ma => new MapAnnotation.FromDTO(ma)).ToList() // Other method //MapAnnotations = dto.MapAnnotations?.Select(ma => new MapAnnotation.FromDTO(ma)).ToList() // Other method
}; };
} }
@ -79,15 +80,15 @@ namespace ManagerService.Data.SubSection
{ {
return new MapAnnotationDTO return new MapAnnotationDTO
{ {
Id = Id, id = Id,
Type = Type, type = Type,
Label = Label, label = Label,
GeometryType = GeometryType, geometryType = GeometryType,
Geometry = Geometry, geometry = Geometry.ToDto(),
PolyColor = PolyColor, polyColor = PolyColor,
Icon = Icon, icon = Icon,
IconResourceId = IconResourceId, iconResourceId = IconResourceId,
IconResource = IconResource?.ToDTO() iconResource = IconResource?.ToDTO()
}; };
} }
@ -95,14 +96,14 @@ namespace ManagerService.Data.SubSection
{ {
return new MapAnnotation return new MapAnnotation
{ {
Id = dto.Id, Id = dto.id,
Type = dto.Type, Type = dto.type,
Label = dto.Label, Label = dto.label,
GeometryType = dto.GeometryType, GeometryType = dto.geometryType,
Geometry = dto.Geometry, Geometry = dto.geometry.FromDto(),
PolyColor = dto.PolyColor, PolyColor = dto.polyColor,
Icon = dto.Icon, Icon = dto.icon,
IconResourceId = dto.IconResourceId, IconResourceId = dto.iconResourceId,
//IconResource = dto.IconResource?.ToModel() //IconResource = dto.IconResource?.ToModel()
}; };
} }

View File

@ -131,8 +131,8 @@ namespace ManagerService.Data.SubSection
categorieId = CategorieId, categorieId = CategorieId,
geometry = Geometry != null ? new GeometryDTO geometry = Geometry != null ? new GeometryDTO
{ {
Type = Geometry.GeometryType, type = Geometry.GeometryType,
Coordinates = Geometry.Coordinates, coordinates = Geometry.Coordinates,
} : null, } : null,
polyColor = PolyColor, polyColor = PolyColor,
imageResourceId = ImageResourceId, imageResourceId = ImageResourceId,
@ -187,17 +187,17 @@ namespace ManagerService.Data.SubSection
{ {
return new GuidedPathDTO return new GuidedPathDTO
{ {
Id = Id, id = Id,
InstanceId = InstanceId, instanceId = InstanceId,
Title = Title, title = Title,
Description = Description, description = Description,
SectionMapId = SectionMapId, sectionMapId = SectionMapId,
SectionEventId = SectionEventId, sectionEventId = SectionEventId,
IsLinear = IsLinear, isLinear = IsLinear,
RequireSuccessToAdvance = RequireSuccessToAdvance, requireSuccessToAdvance = RequireSuccessToAdvance,
HideNextStepsUntilComplete = HideNextStepsUntilComplete, hideNextStepsUntilComplete = HideNextStepsUntilComplete,
Order = Order, order = Order,
Steps = Steps?.Select(s => s.ToDTO()).ToList() steps = Steps?.Select(s => s.ToDTO()).ToList()
}; };
} }
@ -207,16 +207,16 @@ namespace ManagerService.Data.SubSection
return new GuidedPath return new GuidedPath
{ {
Id = dto.Id, Id = dto.id,
InstanceId = dto.InstanceId, InstanceId = dto.instanceId,
Title = dto.Title ?? new List<TranslationDTO>(), Title = dto.title ?? new List<TranslationDTO>(),
Description = dto.Description ?? new List<TranslationDTO>(), Description = dto.description ?? new List<TranslationDTO>(),
SectionMapId = dto.SectionMapId, SectionMapId = dto.sectionMapId,
SectionEventId = dto.SectionEventId, SectionEventId = dto.sectionEventId,
IsLinear = dto.IsLinear, IsLinear = dto.isLinear,
RequireSuccessToAdvance = dto.RequireSuccessToAdvance, RequireSuccessToAdvance = dto.requireSuccessToAdvance,
HideNextStepsUntilComplete = dto.HideNextStepsUntilComplete, HideNextStepsUntilComplete = dto.hideNextStepsUntilComplete,
Order = dto.Order, Order = dto.order,
//Steps = dto.Steps?.Select(s => s.FromDTO()).ToList() ?? new List<GuidedStep>() // Other method //Steps = dto.Steps?.Select(s => s.FromDTO()).ToList() ?? new List<GuidedStep>() // Other method
}; };
} }
@ -276,22 +276,22 @@ namespace ManagerService.Data.SubSection
{ {
return new GuidedStepDTO return new GuidedStepDTO
{ {
Id = Id, id = Id,
GuidedPathId = GuidedPathId, guidedPathId = GuidedPathId,
Order = Order, order = Order,
Title = Title, title = Title,
Description = Description, description = Description,
Geometry = Geometry, geometry = Geometry.ToDto(),
ZoneRadiusMeters = ZoneRadiusMeters, zoneRadiusMeters = ZoneRadiusMeters,
ImageUrl = ImageUrl, imageUrl = ImageUrl,
TriggerGeoPointId = TriggerGeoPointId, triggerGeoPointId = TriggerGeoPointId,
TriggerGeoPoint = TriggerGeoPoint.ToDTO(), triggerGeoPoint = TriggerGeoPoint.ToDTO(),
IsHiddenInitially = IsHiddenInitially, isHiddenInitially = IsHiddenInitially,
IsStepTimer = IsStepTimer, isStepTimer = IsStepTimer,
IsStepLocked = IsStepLocked, isStepLocked = IsStepLocked,
TimerSeconds = TimerSeconds, timerSeconds = TimerSeconds,
TimerExpiredMessage = TimerExpiredMessage, timerExpiredMessage = TimerExpiredMessage,
QuizQuestions = QuizQuestions quizQuestions = QuizQuestions
}; };
} }
@ -301,21 +301,21 @@ namespace ManagerService.Data.SubSection
return new GuidedStep return new GuidedStep
{ {
Id = dto.Id, Id = dto.id,
GuidedPathId = dto.GuidedPathId, GuidedPathId = dto.guidedPathId,
Title = dto.Title ?? new List<TranslationDTO>(), Title = dto.title ?? new List<TranslationDTO>(),
Description = dto.Description ?? new List<TranslationDTO>(), Description = dto.description ?? new List<TranslationDTO>(),
Geometry = dto.Geometry, Geometry = dto.geometry.FromDto(),
ZoneRadiusMeters = dto.ZoneRadiusMeters, ZoneRadiusMeters = dto.zoneRadiusMeters,
ImageUrl = dto.ImageUrl, ImageUrl = dto.imageUrl,
TriggerGeoPointId = dto.TriggerGeoPointId, TriggerGeoPointId = dto.triggerGeoPointId,
IsHiddenInitially = dto.IsHiddenInitially, IsHiddenInitially = dto.isHiddenInitially,
IsStepTimer = dto.IsStepTimer, IsStepTimer = dto.isStepTimer,
IsStepLocked = dto.IsStepLocked, IsStepLocked = dto.isStepLocked,
TimerSeconds = dto.TimerSeconds, TimerSeconds = dto.timerSeconds,
TimerExpiredMessage = dto.TimerExpiredMessage ?? new List<TranslationDTO>(), TimerExpiredMessage = dto.timerExpiredMessage ?? new List<TranslationDTO>(),
Order = dto.Order, Order = dto.order,
QuizQuestions = dto.QuizQuestions QuizQuestions = dto.quizQuestions
}; };
} }

View File

@ -16,20 +16,20 @@ namespace ManagerService.Helpers
{ {
Point point => new GeometryDTO Point point => new GeometryDTO
{ {
Type = "Point", type = "Point",
Coordinates = new List<double> { point.X, point.Y } coordinates = new List<double> { point.X, point.Y }
}, },
LineString line => new GeometryDTO LineString line => new GeometryDTO
{ {
Type = "LineString", type = "LineString",
Coordinates = line.Coordinates coordinates = line.Coordinates
.Select(coord => new List<double> { coord.X, coord.Y }) .Select(coord => new List<double> { coord.X, coord.Y })
.ToList() .ToList()
}, },
Polygon polygon => new GeometryDTO Polygon polygon => new GeometryDTO
{ {
Type = "Polygon", type = "Polygon",
Coordinates = new List<List<List<double>>> coordinates = new List<List<List<double>>>
{ {
polygon.ExteriorRing.Coordinates polygon.ExteriorRing.Coordinates
.Select(coord => new List<double> { coord.X, coord.Y }) .Select(coord => new List<double> { coord.X, coord.Y })
@ -44,31 +44,31 @@ namespace ManagerService.Helpers
{ {
factory ??= NtsGeometryServices.Instance.CreateGeometryFactory(); factory ??= NtsGeometryServices.Instance.CreateGeometryFactory();
return dto.Type switch return dto.type switch
{ {
"Point" => CreatePoint(dto, factory), "Point" => CreatePoint(dto, factory),
"LineString" => CreateLineString(dto, factory), "LineString" => CreateLineString(dto, factory),
"Polygon" => CreatePolygon(dto, factory), "Polygon" => CreatePolygon(dto, factory),
_ => throw new NotSupportedException($"DTO type {dto.Type} not supported.") _ => throw new NotSupportedException($"DTO type {dto.type} not supported.")
}; };
} }
private static Point CreatePoint(GeometryDTO dto, GeometryFactory factory) private static Point CreatePoint(GeometryDTO dto, GeometryFactory factory)
{ {
var coords = ((JsonElement)dto.Coordinates).Deserialize<List<double>>(); var coords = ((JsonElement)dto.coordinates).Deserialize<List<double>>();
return factory.CreatePoint(new Coordinate(coords[0], coords[1])); return factory.CreatePoint(new Coordinate(coords[0], coords[1]));
} }
private static LineString CreateLineString(GeometryDTO dto, GeometryFactory factory) private static LineString CreateLineString(GeometryDTO dto, GeometryFactory factory)
{ {
var coords = ((JsonElement)dto.Coordinates).Deserialize<List<List<double>>>(); var coords = ((JsonElement)dto.coordinates).Deserialize<List<List<double>>>();
var coordinates = coords.Select(c => new Coordinate(c[0], c[1])).ToArray(); var coordinates = coords.Select(c => new Coordinate(c[0], c[1])).ToArray();
return factory.CreateLineString(coordinates); return factory.CreateLineString(coordinates);
} }
private static Polygon CreatePolygon(GeometryDTO dto, GeometryFactory factory) private static Polygon CreatePolygon(GeometryDTO dto, GeometryFactory factory)
{ {
var rings = ((JsonElement)dto.Coordinates).Deserialize<List<List<List<double>>>>(); var rings = ((JsonElement)dto.coordinates).Deserialize<List<List<List<double>>>>();
var exterior = rings.First().Select(c => new Coordinate(c[0], c[1])).ToArray(); var exterior = rings.First().Select(c => new Coordinate(c[0], c[1])).ToArray();
return factory.CreatePolygon(exterior); return factory.CreatePolygon(exterior);
} }