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();
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)
{
@ -116,7 +116,7 @@ namespace ManagerService.Controllers
if (updatedApplicationInstanceDTO == 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)
throw new KeyNotFoundException("application instance does not exist");
@ -208,7 +208,7 @@ namespace ManagerService.Controllers
if (applicationInstance == null)
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)
throw new KeyNotFoundException("This configuration was not found");

View File

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

View File

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

View File

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

View File

@ -9,12 +9,10 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using NetTopologySuite.Geometries;
using NSwag.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using static ManagerService.Data.SubSection.SectionEvent;
namespace ManagerService.Controllers
{
@ -430,19 +428,19 @@ namespace ManagerService.Controllers
if (guidedPathDTO == 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)
throw new KeyNotFoundException("GuidedPath does not exist");
existingGuidedPath.InstanceId = guidedPathDTO.InstanceId;
existingGuidedPath.Title = guidedPathDTO.Title ?? new List<TranslationDTO>();
existingGuidedPath.Description = guidedPathDTO.Description ?? new List<TranslationDTO>();
existingGuidedPath.SectionMapId = guidedPathDTO.SectionMapId;
existingGuidedPath.SectionEventId = guidedPathDTO.SectionEventId;
existingGuidedPath.IsLinear = guidedPathDTO.IsLinear;
existingGuidedPath.RequireSuccessToAdvance = guidedPathDTO.RequireSuccessToAdvance;
existingGuidedPath.HideNextStepsUntilComplete = guidedPathDTO.HideNextStepsUntilComplete;
existingGuidedPath.Order = guidedPathDTO.Order;
existingGuidedPath.InstanceId = guidedPathDTO.instanceId;
existingGuidedPath.Title = guidedPathDTO.title ?? new List<TranslationDTO>();
existingGuidedPath.Description = guidedPathDTO.description ?? new List<TranslationDTO>();
existingGuidedPath.SectionMapId = guidedPathDTO.sectionMapId;
existingGuidedPath.SectionEventId = guidedPathDTO.sectionEventId;
existingGuidedPath.IsLinear = guidedPathDTO.isLinear;
existingGuidedPath.RequireSuccessToAdvance = guidedPathDTO.requireSuccessToAdvance;
existingGuidedPath.HideNextStepsUntilComplete = guidedPathDTO.hideNextStepsUntilComplete;
existingGuidedPath.Order = guidedPathDTO.order;
_myInfoMateDbContext.SaveChanges();
@ -597,24 +595,31 @@ namespace ManagerService.Controllers
if (guidedStepDTO == 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)
throw new KeyNotFoundException("GuidedStep does not exist");
existingGuidedStep.GuidedPathId = guidedStepDTO.GuidedPathId;
existingGuidedStep.Order = guidedStepDTO.Order;
existingGuidedStep.Title = guidedStepDTO.Title;
existingGuidedStep.Description = guidedStepDTO.Description;
existingGuidedStep.Geometry = guidedStepDTO.Geometry != null ? guidedStepDTO.Geometry : null; // TO TEST
existingGuidedStep.ZoneRadiusMeters = guidedStepDTO.ZoneRadiusMeters;
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;
existingGuidedStep.GuidedPathId = guidedStepDTO.guidedPathId;
existingGuidedStep.Order = guidedStepDTO.order;
existingGuidedStep.Title = guidedStepDTO.title;
existingGuidedStep.Description = guidedStepDTO.description;
if (guidedStepDTO.geometry != null)
{
existingGuidedStep.Geometry = guidedStepDTO.geometry.FromDto();
}
else
{
existingGuidedStep.Geometry = null;
}
existingGuidedStep.ZoneRadiusMeters = guidedStepDTO.zoneRadiusMeters;
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();

View File

@ -2,16 +2,16 @@
{
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 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 string Id { get; set; }
public string InstanceId { get; set; }
public string Label { get; set; }
public List<TranslationDTO> Title { get; set; }
public string ImageId { get; set; } // == ResourceId
public string ImageSource { get; set; } // == Image url
public string PrimaryColor { 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 DateTime DateCreation { get; set; }
public bool IsOffline { get; set; }
public string id { get; set; }
public string instanceId { get; set; }
public string label { get; set; }
public List<TranslationDTO> title { get; set; }
public string imageId { get; set; } // == ResourceId
public string imageSource { get; set; } // == Image url
public string primaryColor { 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 DateTime dateCreation { get; set; }
public bool isOffline { get; set; }
public List<string> sectionIds { get; set; }
public string LoaderImageId { get; set; } // == ResourceId
public string LoaderImageUrl { get; set; } // == Image url
public string loaderImageId { get; set; } // == ResourceId
public string loaderImageUrl { get; set; } // == Image url
}
}

View File

@ -6,57 +6,58 @@ namespace ManagerService.DTOs
{
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 SectionEventId { get; set; }
public string sectionAgendaId { get; set; }
public string sectionEventId { get; set; }
}
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 string Id { get; set; }
public string InstanceId { get; set; }
public List<TranslationDTO> Title { get; set; }
public List<TranslationDTO> Description { get; set; }
public string? SectionMapId { get; set; }
public string? SectionEventId { get; set; }
public bool IsLinear { get; set; }
public bool RequireSuccessToAdvance { get; set; }
public bool HideNextStepsUntilComplete { get; set; }
public int Order { get; set; }
public List<GuidedStepDTO> Steps { get; set; }
public string id { get; set; }
public string instanceId { get; set; }
public List<TranslationDTO> title { get; set; }
public List<TranslationDTO> description { get; set; }
public string? sectionMapId { get; set; }
public string? sectionEventId { get; set; }
public bool isLinear { get; set; }
public bool requireSuccessToAdvance { get; set; }
public bool hideNextStepsUntilComplete { get; set; }
public int order { get; set; }
public List<GuidedStepDTO> steps { get; set; }
}
}

View File

@ -1,27 +1,26 @@
using System.Collections.Generic;
using Manager.DTOs;
using ManagerService.Data.SubSection;
using NetTopologySuite.Geometries;
namespace ManagerService.DTOs
{
public class GuidedStepDTO
{
public string Id { get; set; }
public string GuidedPathId { get; set; }
public int Order { get; set; }
public List<TranslationDTO> Title { get; set; }
public List<TranslationDTO> Description { get; set; }
public Geometry Geometry { get; set; }
public double? ZoneRadiusMeters { get; set; }
public string ImageUrl { get; set; }
public int? TriggerGeoPointId { get; set; }
public GeoPointDTO? TriggerGeoPoint { get; set; }
public bool IsHiddenInitially { get; set; }
public bool IsStepTimer { get; set; }
public bool IsStepLocked { get; set; }
public int? TimerSeconds { get; set; }
public List<TranslationDTO> TimerExpiredMessage { get; set; }
public List<QuizQuestion> QuizQuestions { get; set; }
public string id { get; set; }
public string guidedPathId { get; set; }
public int order { get; set; }
public List<TranslationDTO> title { get; set; }
public List<TranslationDTO> description { get; set; }
public GeometryDTO geometry { get; set; }
public double? zoneRadiusMeters { get; set; }
public string imageUrl { get; set; }
public int? triggerGeoPointId { get; set; }
public GeoPointDTO? triggerGeoPoint { get; set; }
public bool isHiddenInitially { get; set; }
public bool isStepTimer { get; set; }
public bool isStepLocked { get; set; }
public int? timerSeconds { get; set; }
public List<TranslationDTO> timerExpiredMessage { 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 Manager.DTOs;
namespace ManagerService.DTOs
{
public class MapAnnotationDTO
{
public string Id { get; set; }
public List<TranslationDTO> Type { get; set; }
public List<TranslationDTO> Label { get; set; }
public SectionEvent.GeometryType GeometryType { get; set; }
public Geometry Geometry { get; set; }
public string PolyColor { get; set; }
public string Icon { get; set; }
public string IconResourceId { get; set; }
public ResourceDTO IconResource { get; set; }
public string id { get; set; }
public List<TranslationDTO> type { get; set; }
public List<TranslationDTO> label { get; set; }
public SectionEvent.GeometryType geometryType { get; set; }
public GeometryDTO geometry { get; set; }
public string polyColor { get; set; }
public string icon { get; set; }
public string iconResourceId { get; set; }
public ResourceDTO iconResource { get; set; }
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,20 +16,20 @@ namespace ManagerService.Helpers
{
Point point => new GeometryDTO
{
Type = "Point",
Coordinates = new List<double> { point.X, point.Y }
type = "Point",
coordinates = new List<double> { point.X, point.Y }
},
LineString line => new GeometryDTO
{
Type = "LineString",
Coordinates = line.Coordinates
type = "LineString",
coordinates = line.Coordinates
.Select(coord => new List<double> { coord.X, coord.Y })
.ToList()
},
Polygon polygon => new GeometryDTO
{
Type = "Polygon",
Coordinates = new List<List<List<double>>>
type = "Polygon",
coordinates = new List<List<List<double>>>
{
polygon.ExteriorRing.Coordinates
.Select(coord => new List<double> { coord.X, coord.Y })
@ -44,31 +44,31 @@ namespace ManagerService.Helpers
{
factory ??= NtsGeometryServices.Instance.CreateGeometryFactory();
return dto.Type switch
return dto.type switch
{
"Point" => CreatePoint(dto, factory),
"LineString" => CreateLineString(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)
{
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]));
}
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();
return factory.CreateLineString(coordinates);
}
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();
return factory.CreatePolygon(exterior);
}