Breaking changes ! WIP new format (ApplicationInstance) + SectionEvent and updated SectionMap

This commit is contained in:
Thomas Fransolet 2025-07-09 17:37:30 +02:00
parent 3c9461211e
commit d241720102
24 changed files with 2691 additions and 318 deletions

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,30 +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.IsDate = newConfiguration.isDate; configuration.Languages = newConfiguration.Languages;
configuration.IsHour = newConfiguration.isHour;
configuration.IsSectionImageBackground = true;
configuration.RoundedValue = newConfiguration.roundedValue;
configuration.ScreenPercentageSectionsMainPage = newConfiguration.screenPercentageSectionsMainPage;
configuration.Languages = _configuration.GetSection("SupportedLanguages").Get<List<string>>();
//configuration.Languages = new List<string> { "FR", "NL", "EN", "DE" }; // by default all 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.IsMobile = newConfiguration.isMobile; configuration.IsOffline = newConfiguration.IsOffline;
configuration.IsTablet = newConfiguration.isTablet;
configuration.IsOffline = newConfiguration.isOffline;
configuration.Id = idService.GenerateHexId(); configuration.Id = idService.GenerateHexId();
@ -289,30 +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.IsMobile = updatedConfiguration.isMobile; configuration.IsOffline = updatedConfiguration.IsOffline;
configuration.IsTablet = updatedConfiguration.isTablet; configuration.LoaderImageId = updatedConfiguration.LoaderImageId;
configuration.IsOffline = updatedConfiguration.isOffline; configuration.LoaderImageUrl = updatedConfiguration.LoaderImageUrl;
configuration.LoaderImageId = updatedConfiguration.loaderImageId;
configuration.LoaderImageUrl = updatedConfiguration.loaderImageUrl;
configuration.IsDate = updatedConfiguration.isDate;
configuration.IsHour = updatedConfiguration.isHour;
configuration.IsSectionImageBackground = updatedConfiguration.isSectionImageBackground;
configuration.RoundedValue = updatedConfiguration.roundedValue;
configuration.ScreenPercentageSectionsMainPage = updatedConfiguration.screenPercentageSectionsMainPage;
//Configuration configurationModified = _configurationService.Update(updatedConfiguration.id, configuration); //Configuration configurationModified = _configurationService.Update(updatedConfiguration.id, configuration);
_myInfoMateDbContext.SaveChanges(); _myInfoMateDbContext.SaveChanges();
@ -638,44 +620,36 @@ 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.IsMobile = exportConfiguration.isMobile; configuration.IsOffline = exportConfiguration.IsOffline;
configuration.IsTablet = exportConfiguration.isTablet; configuration.LoaderImageId = exportConfiguration.LoaderImageId;
configuration.IsOffline = exportConfiguration.isOffline; configuration.LoaderImageUrl = exportConfiguration.LoaderImageUrl;
configuration.LoaderImageId = exportConfiguration.loaderImageId;
configuration.LoaderImageUrl = exportConfiguration.loaderImageUrl;
if (configuration.LoaderImageId != null) if (configuration.LoaderImageId != null)
{ {
createResource(exportConfiguration.resources.Where(r => r.id == configuration.LoaderImageId).FirstOrDefault()); createResource(exportConfiguration.resources.Where(r => r.id == configuration.LoaderImageId).FirstOrDefault());
} }
configuration.IsDate = exportConfiguration.isDate;
configuration.IsHour = exportConfiguration.isHour;
configuration.IsSectionImageBackground = exportConfiguration.isSectionImageBackground;
configuration.RoundedValue = exportConfiguration.roundedValue;
configuration.ScreenPercentageSectionsMainPage = exportConfiguration.screenPercentageSectionsMainPage;
_myInfoMateDbContext.Configurations.Add(configuration); _myInfoMateDbContext.Configurations.Add(configuration);
//_configurationService.Create(configuration); //_configurationService.Create(configuration);

View File

@ -1,5 +1,6 @@
using Manager.DTOs; using Manager.DTOs;
using Manager.Helpers; using Manager.Helpers;
using Manager.Interfaces.Models;
using Manager.Services; using Manager.Services;
using ManagerService.Data; using ManagerService.Data;
using ManagerService.Data.SubSection; using ManagerService.Data.SubSection;
@ -16,7 +17,10 @@ using NSwag.Annotations;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks;
namespace ManagerService.Controllers namespace ManagerService.Controllers
{ {
@ -135,7 +139,7 @@ namespace ManagerService.Controllers
[ProducesResponseType(typeof(string), 500)] [ProducesResponseType(typeof(string), 500)]
[ProducesResponseType(typeof(string), 400)] [ProducesResponseType(typeof(string), 400)]
[HttpGet("configuration/{id}/detail")] [HttpGet("configuration/{id}/detail")]
public ObjectResult GetFromConfigurationDetail(string id) public async Task<ObjectResult> GetFromConfigurationDetail(string id)
{ {
try try
{ {
@ -170,15 +174,16 @@ namespace ManagerService.Controllers
description = geoPoint.Description, description = geoPoint.Description,
contents = geoPoint.Contents, contents = geoPoint.Contents,
categorieId = geoPoint.CategorieId, categorieId = geoPoint.CategorieId,
latitude = geoPoint.Latitude,
longitude = geoPoint.Longitude,
imageResourceId = geoPoint.ImageResourceId, imageResourceId = geoPoint.ImageResourceId,
imageUrl = geoPoint.ImageUrl, imageUrl = geoPoint.ImageUrl,
schedules = geoPoint.Schedules, schedules = geoPoint.Schedules,
prices = geoPoint.Prices, prices = geoPoint.Prices,
phone = geoPoint.Phone, phone = geoPoint.Phone,
email = geoPoint.Email, email = geoPoint.Email,
site = geoPoint.Site site = geoPoint.Site,
geometryType = geoPoint.GeometryType,
polyColor = geoPoint.PolyColor,
coordinates = geoPoint.Coordinates,
}); });
} }
(dto as MapDTO).points = geoPointDTOs; (dto as MapDTO).points = geoPointDTOs;
@ -225,15 +230,16 @@ namespace ManagerService.Controllers
description = geoPointSub.Description, description = geoPointSub.Description,
contents = geoPointSub.Contents, contents = geoPointSub.Contents,
categorieId = geoPointSub.CategorieId, categorieId = geoPointSub.CategorieId,
latitude = geoPointSub.Latitude,
longitude = geoPointSub.Longitude,
imageResourceId = geoPointSub.ImageResourceId, imageResourceId = geoPointSub.ImageResourceId,
imageUrl = geoPointSub.ImageUrl, imageUrl = geoPointSub.ImageUrl,
schedules = geoPointSub.Schedules, schedules = geoPointSub.Schedules,
prices = geoPointSub.Prices, prices = geoPointSub.Prices,
phone = geoPointSub.Phone, phone = geoPointSub.Phone,
email = geoPointSub.Email, email = geoPointSub.Email,
site = geoPointSub.Site site = geoPointSub.Site,
geometryType = geoPointSub.GeometryType,
polyColor = geoPointSub.PolyColor,
coordinates = geoPointSub.Coordinates
}); });
} }
(subDTO as MapDTO).points = geoPointDTOsSub; (subDTO as MapDTO).points = geoPointDTOsSub;
@ -267,6 +273,71 @@ namespace ManagerService.Controllers
sectionsToReturn.Add(dto); sectionsToReturn.Add(dto);
} }
try
{
var weatherSections = _myInfoMateDbContext.Sections.OfType<SectionWeather>()
.Where(s => s.ConfigurationId == id && !s.IsSubSection)
.ToList();
foreach (var weatherSection in weatherSections)
{
if (weatherSection.WeatherCity != null && weatherSection.WeatherCity.Length >= 2 &&
(weatherSection.WeatherUpdatedDate == null || weatherSection.WeatherUpdatedDate.Value.AddHours(3) < DateTimeOffset.Now)) // Update all 4 hours
{
// Call Openweather api with token from appSettings and update result with json
var apiKey = _configuration.GetSection("OpenWeatherApiKey").Get<string>();
if (apiKey != null && apiKey.Length > 0)
{
string url = $"http://api.openweathermap.org/geo/1.0/direct?q={weatherSection.WeatherCity}&limit=1&appid={apiKey}";
using (HttpClient client = new HttpClient())
{
try
{
HttpResponseMessage response = await client.GetAsync(url);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
List<CityData> cities = JsonConvert.DeserializeObject<List<CityData>>(responseBody);
if (cities.Count > 0)
{
double lat = cities[0].Lat;
double lon = cities[0].Lon;
//string onecallUrl = $"https://api.openweathermap.org/data/3.0/onecall?lat={lat}&lon={lon}&appid={apiKey}";
string callUrl = $"https://api.openweathermap.org/data/2.5/forecast?lat={lat}&lon={lon}&units=metric&appid={apiKey}";
HttpResponseMessage callResponse = await client.GetAsync(callUrl);
callResponse.EnsureSuccessStatusCode();
string callResponseBody = await callResponse.Content.ReadAsStringAsync();
weatherSection.WeatherUpdatedDate = DateTimeOffset.Now.ToUniversalTime(); ;
weatherSection.WeatherResult = callResponseBody;
_myInfoMateDbContext.SaveChanges();
}
else
{
Console.WriteLine("Aucune ville trouvée.");
}
}
catch (HttpRequestException e)
{
Console.WriteLine($"Une erreur s'est produite lors de la requête HTTP : {e.Message}");
}
}
}
}
}
}
catch (Exception e)
{
Console.WriteLine($"Une erreur s'est produite lors de la mise à jour des sections de type météo : {e.Message}");
}
return new OkObjectResult(sectionsToReturn); return new OkObjectResult(sectionsToReturn);
} }
else else
@ -529,15 +600,17 @@ namespace ManagerService.Controllers
section.ParentId = newSection.parentId; section.ParentId = newSection.parentId;
section.Type = newSection.type; section.Type = newSection.type;
// TODO !! // TODO test that in new format
if (configuration.IsMobile) section.Order = _myInfoMateDbContext.Sections.Count(s => s.ConfigurationId == newSection.configurationId && !s.IsSubSection) + 1;
/*if (configuration.IsMobile)
{ {
section.Order = _myInfoMateDbContext.Sections.Count(s => s.ConfigurationId == newSection.configurationId && !s.IsSubSection && (s.Type == SectionType.Article || s.Type == SectionType.Quiz)) + 1; section.Order = _myInfoMateDbContext.Sections.Count(s => s.ConfigurationId == newSection.configurationId && !s.IsSubSection && (s.Type == SectionType.Article || s.Type == SectionType.Quiz)) + 1;
} }
else else
{ {
section.Order = 0; // _myInfoMateDbContext.Sections.Count(s => s.ConfigurationId == newSection.configurationId && !s.IsSubSection) + 1; section.Order = 0; // _myInfoMateDbContext.Sections.Count(s => s.ConfigurationId == newSection.configurationId && !s.IsSubSection) + 1;
} }*/
section.IsBeacon = newSection.isBeacon; section.IsBeacon = newSection.isBeacon;
section.BeaconId = newSection.beaconId; section.BeaconId = newSection.beaconId;
@ -816,30 +889,14 @@ namespace ManagerService.Controllers
var configuration = _myInfoMateDbContext.Configurations.FirstOrDefault(c => c.Id == section.ConfigurationId); var configuration = _myInfoMateDbContext.Configurations.FirstOrDefault(c => c.Id == section.ConfigurationId);
if (configuration.IsMobile) // TODO TEST that in new format
List<Section> sections = _myInfoMateDbContext.Sections.Where(s => s.ConfigurationId == section.ConfigurationId && !s.IsSubSection).ToList();
int i = 1;
List<Section> orderedSection = sections.OrderBy(s => s.Order).ToList();
foreach (var sectionDb in orderedSection)
{ {
// TODO !! sectionDb.Order = i;
// update order only with article and quiz (FOR NOW) i++;
List<Section> sections = _myInfoMateDbContext.Sections.Where(s => s.ConfigurationId == section.ConfigurationId && !s.IsSubSection && (s.Type == SectionType.Article || s.Type == SectionType.Quiz)).ToList();
int i = 1;
List<Section> orderedSection = sections.OrderBy(s => s.Order).ToList();
foreach (var sectionDb in orderedSection)
{
sectionDb.Order = i;
i++;
}
}
else {
// TODO !!
// update order from rest // TODO TEST
List<Section> sections = _myInfoMateDbContext.Sections.Where(s => s.ConfigurationId == section.ConfigurationId && !s.IsSubSection).ToList();
int i = 1;
List<Section> orderedSection = sections.OrderBy(s => s.Order).ToList();
foreach (var sectionDb in orderedSection)
{
sectionDb.Order = i;
i++;
}
} }
_myInfoMateDbContext.SaveChanges(); _myInfoMateDbContext.SaveChanges();

View File

@ -66,8 +66,9 @@ namespace ManagerService.Controllers
description = point.Description, description = point.Description,
contents = point.Contents, contents = point.Contents,
categorieId = point.CategorieId, categorieId = point.CategorieId,
latitude = point.Latitude, geometryType = point.GeometryType,
longitude = point.Longitude, coordinates = point.Coordinates, // TODO test that
polyColor = point.PolyColor,
imageResourceId = point.ImageResourceId, imageResourceId = point.ImageResourceId,
imageUrl = point.ImageUrl, imageUrl = point.ImageUrl,
schedules = point.Schedules, schedules = point.Schedules,
@ -120,8 +121,9 @@ namespace ManagerService.Controllers
geoPoint.Description = geoPointDTO.description; geoPoint.Description = geoPointDTO.description;
geoPoint.Contents = geoPointDTO.contents; geoPoint.Contents = geoPointDTO.contents;
geoPoint.CategorieId = geoPointDTO.categorieId; geoPoint.CategorieId = geoPointDTO.categorieId;
geoPoint.Latitude = geoPointDTO.latitude; geoPoint.GeometryType = geoPointDTO.geometryType;
geoPoint.Longitude = geoPointDTO.longitude; geoPoint.Coordinates = geoPointDTO.coordinates; // TODO TEST
geoPoint.PolyColor = geoPointDTO.polyColor;
geoPoint.ImageResourceId = geoPointDTO.imageResourceId; geoPoint.ImageResourceId = geoPointDTO.imageResourceId;
geoPoint.ImageUrl = geoPointDTO.imageUrl; // TO BE TESTED ? Depends on front geoPoint.ImageUrl = geoPointDTO.imageUrl; // TO BE TESTED ? Depends on front
geoPoint.Schedules = geoPointDTO.schedules; geoPoint.Schedules = geoPointDTO.schedules;
@ -145,8 +147,9 @@ namespace ManagerService.Controllers
description = geoPoint.Description, description = geoPoint.Description,
contents = geoPoint.Contents, contents = geoPoint.Contents,
categorieId = geoPoint.CategorieId, categorieId = geoPoint.CategorieId,
latitude = geoPoint.Latitude, geometryType = geoPointDTO.geometryType,
longitude = geoPoint.Longitude, coordinates = geoPointDTO.coordinates, // TODO TEST
polyColor = geoPointDTO.polyColor,
imageResourceId = geoPoint.ImageResourceId, imageResourceId = geoPoint.ImageResourceId,
imageUrl = geoPoint.ImageUrl, imageUrl = geoPoint.ImageUrl,
schedules = geoPoint.Schedules, schedules = geoPoint.Schedules,
@ -196,8 +199,9 @@ namespace ManagerService.Controllers
existingGeoPoint.Description = geoPointDTO.description; existingGeoPoint.Description = geoPointDTO.description;
existingGeoPoint.Contents = geoPointDTO.contents; existingGeoPoint.Contents = geoPointDTO.contents;
existingGeoPoint.CategorieId = geoPointDTO.categorieId; existingGeoPoint.CategorieId = geoPointDTO.categorieId;
existingGeoPoint.Latitude = geoPointDTO.latitude; existingGeoPoint.GeometryType = geoPointDTO.geometryType;
existingGeoPoint.Longitude = geoPointDTO.longitude; existingGeoPoint.Coordinates = geoPointDTO.coordinates; // TODO TEST
existingGeoPoint.PolyColor = geoPointDTO.polyColor;
existingGeoPoint.ImageResourceId = geoPointDTO.imageResourceId; existingGeoPoint.ImageResourceId = geoPointDTO.imageResourceId;
existingGeoPoint.ImageUrl = geoPointDTO.imageUrl; existingGeoPoint.ImageUrl = geoPointDTO.imageUrl;
existingGeoPoint.Schedules = geoPointDTO.schedules; existingGeoPoint.Schedules = geoPointDTO.schedules;

View File

@ -0,0 +1,17 @@
namespace ManagerService.DTOs
{
public class AppConfigurationLinkDTO
{
public string Id { get; set; }
public string ConfigurationId { get; set; }
public string ApplicationInstanceId { get; set; }
public int? Order { get; set; }
public bool IsActive { get; set; } = true;
public int? WeightMasonryGrid { get; set; }
}
}

View File

@ -0,0 +1,40 @@
using ManagerService.Data;
using System.Collections.Generic;
namespace ManagerService.DTOs
{
public class ApplicationInstanceDTO
{
public string Id { get; set; }
public string InstanceId { get; set; }
public AppType AppType { get; set; }
public List<AppConfigurationLink> Configurations { get; set; }
public string MainImageId { get; set; }
public string MainImageUrl { get; set; }
public string LoaderImageId { get; set; }
public string LoaderImageUrl { get; set; }
public bool IsDate { get; set; }
public bool IsHour { get; set; }
public string PrimaryColor { get; set; }
public string SecondaryColor { get; set; }
public int? RoundedValue { get; set; }
public int? ScreenPercentageSectionsMainPage { get; set; }
public bool IsSectionImageBackground { get; set; }
public List<string> Languages { get; set; }
}
}

View File

@ -5,29 +5,19 @@ namespace ManagerService.DTOs
{ {
public class ConfigurationDTO public class ConfigurationDTO
{ {
public string id { get; set; } public string Id { get; set; }
public string label { get; set; } public string InstanceId { get; set; }
public List<TranslationDTO> title { get; set; } public string Label { get; set; }
public string imageId { get; set; } // == ResourceId public List<TranslationDTO> Title { get; set; }
public string imageSource { get; set; } // == Image url public string ImageId { get; set; } // == ResourceId
public string primaryColor { get; set; } public string ImageSource { get; set; } // == Image url
public string secondaryColor { get; set; } public string PrimaryColor { get; set; }
public List<string> languages { get; set; } // fr, en, de, nl => Sélection dans une liste déjà établie dans l'application ! public string SecondaryColor { get; set; }
public DateTime dateCreation { get; set; } public List<string> Languages { get; set; } // fr, en, de, nl => Sélection dans une liste déjà établie dans l'application !
public bool isMobile { get; set; } // MyVisit - True if for mobile (MyVisit) public DateTime DateCreation { get; set; }
public bool isTablet { get; set; } public bool IsOffline { get; set; }
public bool isOffline { get; set; } // MyVisit - True if MyVisit is full offline
/*public string latitude { get; set; } // MyVisit - latitude of visit ? (MyVisit)
public string longitude { get; set; } // MyVisit - True if for mobile (MyVisit)*/
public string instanceId { 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
public bool isDate { get; set; }
public bool isHour { get; set; }
public bool isSectionImageBackground { get; set; } // Use to display background for section main image (or not)
public int? roundedValue { get; set; } // Use to set rounded decoration value
public int? screenPercentageSectionsMainPage { get; set; } // Use to set percentage of screen will be used to show sections (base on center)
} }
} }

View File

@ -8,5 +8,10 @@ namespace ManagerService.DTOs
public string name { get; set; } public string name { get; set; }
public DateTime? dateCreation { get; set; } public DateTime? dateCreation { get; set; }
public string pinCode { get; set; } public string pinCode { get; set; }
public bool isPushNotification { get; set; }
public bool isStatistic { get; set; }
public bool isMobile { get; set; }
public bool isTablet { get; set; }
public bool isVR { get; set; }
} }
} }

View File

@ -9,6 +9,7 @@ namespace ManagerService.DTOs
public string label { get; set; } // use in manager public string label { get; set; } // use in manager
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 bool isActive { 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 configurationId { get; set; } public string configurationId { get; set; }

View File

@ -2,6 +2,8 @@
using ManagerService.Data.SubSection; using ManagerService.Data.SubSection;
using ManagerService.DTOs; using ManagerService.DTOs;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using static ManagerService.Data.SubSection.SectionEvent;
namespace Manager.DTOs namespace Manager.DTOs
{ {
@ -26,8 +28,6 @@ namespace Manager.DTOs
public List<TranslationDTO> description { get; set; } public List<TranslationDTO> description { get; set; }
public List<ContentDTO> contents { get; set; } public List<ContentDTO> contents { get; set; }
public int? categorieId { get; set; } public int? categorieId { get; set; }
public string latitude { get; set; }
public string longitude { get; set; }
public string imageResourceId { get; set; } public string imageResourceId { get; set; }
public string imageUrl { get; set; } public string imageUrl { get; set; }
public List<TranslationDTO> schedules { get; set; } public List<TranslationDTO> schedules { get; set; }
@ -35,6 +35,10 @@ namespace Manager.DTOs
public List<TranslationDTO> phone { get; set; } public List<TranslationDTO> phone { get; set; }
public List<TranslationDTO> email { get; set; } public List<TranslationDTO> email { get; set; }
public List<TranslationDTO> site { get; set; } public List<TranslationDTO> site { get; set; }
public GeometryType geometryType { get; set; }
[Column(TypeName = "jsonb")]
public List<Coordinate> coordinates { get; set; } = new(); // 1 point = marker, plusieurs = polyline/polygon
public string polyColor { get; set; } // color of the polyline or polygon
} }
public class CategorieDTO public class CategorieDTO

View File

@ -0,0 +1,65 @@
using ManagerService.DTOs;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ManagerService.Data
{
/// <summary>
/// Represents the association between an application instance (e.g., mobile or tablet app)
/// and a specific configuration. This link defines which configurations are used by which
/// application instances, optionally with an order or active status.
/// Useful for managing configuration assignment and display logic per app type.
/// </summary>
public class AppConfigurationLink
{
[Key]
public string Id { get; set; }
[Required]
public string ConfigurationId { get; set; }
[Required]
public string ApplicationInstanceId { get; set; }
public int? Order { get; set; }
public bool IsActive { get; set; } = true;
public int? WeightMasonryGrid { get; set; }
[ForeignKey(nameof(ConfigurationId))]
public Configuration Configuration { get; set; }
[ForeignKey(nameof(ApplicationInstanceId))]
public ApplicationInstance ApplicationInstance { get; set; }
public AppConfigurationLinkDTO ToDTO()
{
return new AppConfigurationLinkDTO()
{
Id = Id,
ConfigurationId = ConfigurationId,
ApplicationInstanceId = ApplicationInstanceId,
Order = Order,
IsActive = IsActive,
WeightMasonryGrid = WeightMasonryGrid
};
}
public AppConfigurationLink FromDTO(AppConfigurationLinkDTO appConfigurationLinkDTO)
{
return new AppConfigurationLink()
{
Id = appConfigurationLinkDTO.Id,
ConfigurationId = appConfigurationLinkDTO.ConfigurationId,
ApplicationInstanceId = appConfigurationLinkDTO.ApplicationInstanceId,
Order = appConfigurationLinkDTO.Order,
IsActive = appConfigurationLinkDTO.IsActive,
WeightMasonryGrid = appConfigurationLinkDTO?.WeightMasonryGrid,
};
}
}
}

View File

@ -0,0 +1,112 @@
using ManagerService.DTOs;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace ManagerService.Data
{
/// <summary>
/// Defines the link between an application instance and a configuration,
/// allowing apps to use one or multiple configurations.
/// </summary>
public class ApplicationInstance
{
[Key]
public string Id { get; set; }
[Required]
public string InstanceId { get; set; }
[Required]
public AppType AppType { get; set; }
public List<AppConfigurationLink> Configurations { get; set; }
public string MainImageId { get; set; }
public string MainImageUrl { get; set; }
public string LoaderImageId { get; set; }
public string LoaderImageUrl { get; set; }
public bool IsDate { get; set; }
public bool IsHour { get; set; }
public string PrimaryColor { get; set; }
public string SecondaryColor { get; set; }
public int? RoundedValue { get; set; }
public int? ScreenPercentageSectionsMainPage { get; set; }
public bool IsSectionImageBackground { get; set; } // => Chose layout of main page
public LayoutMainPageType LayoutMainPage { get; set; } = LayoutMainPageType.MasonryGrid;
public List<string> Languages { get; set; } // All app must support languages, if not, client's problem
public ApplicationInstanceDTO ToDTO()
{
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
};
}
public ApplicationInstance FromDTO(ApplicationInstanceDTO applicationInstanceDTO)
{
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,
};
}
}
public enum AppType
{
Mobile,
Tablet,
VR
}
public enum LayoutMainPageType
{
SimpleGrid,
MasonryGrid
}
}

View File

@ -1,6 +1,4 @@
using ManagerService.Data.SubSection; using ManagerService.DTOs;
using ManagerService.DTOs;
using MongoDB.Bson.Serialization.Attributes;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
@ -17,98 +15,53 @@ namespace ManagerService.Data
{ {
[Key] [Key]
[Required] [Required]
/*[BsonId]
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]*/
public string Id { get; set; } public string Id { get; set; }
/*[BsonElement("Label")] [Required]
[BsonRequired]*/ public string InstanceId { get; set; }
[Required] [Required]
public string Label { get; set; } public string Label { get; set; }
/*[BsonElement("Title")]
[BsonRequired]*/
[Required] [Required]
[Column(TypeName = "jsonb")] [Column(TypeName = "jsonb")]
public List<TranslationDTO> Title { get; set; } public List<TranslationDTO> Title { get; set; }
/*[BsonElement("ImageId")]*/
public string ImageId { get; set; } public string ImageId { get; set; }
/*[BsonElement("ImageSource")]*/
public string ImageSource { get; set; } public string ImageSource { get; set; }
/*[BsonElement("PrimaryColor")]*/ public string PrimaryColor { get; set; } // Config can have their specific colors
public string PrimaryColor { get; set; }
/*[BsonElement("SecondaryColor")]*/ public string SecondaryColor { get; set; } // Config can have their specific colors
public string SecondaryColor { get; set; }
/*[BsonElement("Languages")]*/ public List<string> Languages { get; set; } // Config can support not all the languages (help to translate step by step)
public List<string> Languages { get; set; } // fr, en, de, nl => Sélection dans une liste déjà établie dans l'application !
/*[BsonElement("DateCreation")]*/
public DateTime DateCreation { get; set; } public DateTime DateCreation { get; set; }
/*[BsonElement("IsMobile")]*/
public bool IsMobile { get; set; }
/*[BsonElement("IsTablet")]*/
public bool IsTablet { get; set; }
/*[BsonElement("IsOffline")]*/
public bool IsOffline { get; set; } public bool IsOffline { get; set; }
/*[BsonElement("InstanceId")] public string LoaderImageId { get; set; } // Config can have their specific loader if needed
[BsonRequired]*/
[Required]
public string InstanceId { get; set; }
/*[BsonElement("LoaderImageId")]*/ public string LoaderImageUrl { get; set; } // Config can have their specific loader if needed
public string LoaderImageId { get; set; }
/*[BsonElement("LoaderImageUrl")]*/
public string LoaderImageUrl { get; set; }
/*[BsonElement("IsDate")]*/
public bool IsDate { get; set; }
/*[BsonElement("IsHour")]*/
public bool IsHour { get; set; }
/*[BsonElement("IsSectionImageBackground")]*/
public bool IsSectionImageBackground { get; set; }
/*[BsonElement("RoundedValue")]*/
public int? RoundedValue { get; set; }
/*[BsonElement("ScreenPercentageSectionsMainPage")]*/
public int? ScreenPercentageSectionsMainPage { get; set; }
public ConfigurationDTO ToDTO(List<string> sectionIds) public ConfigurationDTO ToDTO(List<string> sectionIds)
{ {
return new ConfigurationDTO() return new ConfigurationDTO()
{ {
id = Id, Id = Id,
label = Label, InstanceId = InstanceId,
title = Title, Label = Label,
imageId = ImageId, Title = Title,
imageSource = ImageSource, ImageId = ImageId,
loaderImageId = LoaderImageId, ImageSource = ImageSource,
loaderImageUrl = LoaderImageUrl, LoaderImageId = LoaderImageId,
dateCreation = DateCreation, LoaderImageUrl = LoaderImageUrl,
primaryColor = PrimaryColor, DateCreation = DateCreation,
languages = Languages, PrimaryColor = PrimaryColor,
secondaryColor = SecondaryColor, Languages = Languages,
isMobile = IsMobile, SecondaryColor = SecondaryColor,
isTablet = IsTablet, IsOffline = IsOffline,
isOffline = IsOffline,
instanceId = InstanceId,
isDate = IsDate,
isHour = IsHour,
isSectionImageBackground = IsSectionImageBackground,
roundedValue = RoundedValue,
screenPercentageSectionsMainPage = ScreenPercentageSectionsMainPage,
sectionIds = sectionIds sectionIds = sectionIds
}; };
} }
@ -116,27 +69,21 @@ 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,
label = Label, InstanceId = InstanceId,
title= Title, Label = Label,
imageId = ImageId, Title = Title,
imageSource = ImageSource, ImageId = ImageId,
loaderImageId = LoaderImageId, ImageSource = ImageSource,
loaderImageUrl = LoaderImageUrl, LoaderImageId = LoaderImageId,
dateCreation = DateCreation, LoaderImageUrl = LoaderImageUrl,
primaryColor = PrimaryColor, DateCreation = DateCreation,
languages = Languages, PrimaryColor = PrimaryColor,
secondaryColor = SecondaryColor, Languages = Languages,
isMobile = IsMobile, SecondaryColor = SecondaryColor,
isTablet = IsTablet, IsOffline = IsOffline,
isOffline = IsOffline,
sections = sections, sections = sections,
resources = resources, resources = resources,
instanceId = InstanceId,
isDate = IsDate,
isSectionImageBackground = IsSectionImageBackground,
roundedValue = RoundedValue,
screenPercentageSectionsMainPage = ScreenPercentageSectionsMainPage,
sectionIds = sections.Select(s => s.id).ToList() sectionIds = sections.Select(s => s.id).ToList()
}; };
} }

View File

@ -11,21 +11,26 @@ namespace ManagerService.Data
{ {
[Key] [Key]
[Required] [Required]
/*[BsonId]
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]*/
public string Id { get; set; } public string Id { get; set; }
/*[BsonElement("Name")]
[BsonRequired]*/
[Required] [Required]
public string Name { get; set; } // UNIQUE !.. public string Name { get; set; } // UNIQUE !..
/*[BsonElement("DateCreation")]*/
public DateTime DateCreation { get; set; } public DateTime DateCreation { get; set; }
/*[BsonElement("PinCode")]*/
public string PinCode { get; set; } public string PinCode { get; set; }
public bool IsPushNotification { get; set; }
public bool IsStatistic { get; set; }
public bool IsMobile { get; set; }
public bool IsTablet { get; set; }
public bool IsVR { get; set; }
public InstanceDTO ToDTO() public InstanceDTO ToDTO()
{ {
return new InstanceDTO() return new InstanceDTO()
@ -33,7 +38,12 @@ namespace ManagerService.Data
id = Id, id = Id,
name = Name, name = Name,
dateCreation = DateCreation, dateCreation = DateCreation,
pinCode = PinCode pinCode = PinCode,
isPushNotification = IsPushNotification,
isStatistic = IsStatistic,
isMobile = IsMobile,
isTablet = IsTablet,
isVR = IsVR,
}; };
} }
@ -44,7 +54,12 @@ namespace ManagerService.Data
Id = instanceDTO.id, Id = instanceDTO.id,
Name = instanceDTO.name, Name = instanceDTO.name,
DateCreation = instanceDTO.dateCreation != null ? instanceDTO.dateCreation.Value : DateTime.Now.ToUniversalTime(), DateCreation = instanceDTO.dateCreation != null ? instanceDTO.dateCreation.Value : DateTime.Now.ToUniversalTime(),
PinCode = instanceDTO.pinCode PinCode = instanceDTO.pinCode,
IsPushNotification = instanceDTO.isPushNotification,
IsStatistic = instanceDTO.isStatistic,
IsMobile = instanceDTO.isMobile,
IsTablet = instanceDTO.isTablet,
IsVR = instanceDTO.isVR
}; };
} }

View File

@ -1,8 +1,10 @@
using ManagerService.Data.SubSection; using Manager.DTOs;
using ManagerService.Data.SubSection;
using ManagerService.DTOs; using ManagerService.DTOs;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.Json; using System.Text.Json;
using static ManagerService.Data.SubSection.SectionEvent;
namespace ManagerService.Data namespace ManagerService.Data
{ {
@ -23,6 +25,9 @@ namespace ManagerService.Data
// QUIZ // QUIZ
public DbSet<QuizQuestion> QuizQuestions { get; set; } public DbSet<QuizQuestion> QuizQuestions { get; set; }
public DbSet<GuidedPath> GuidedPaths { get; set; }
public DbSet<GuidedStep> GuidedSteps { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {
var options = new JsonSerializerOptions var options = new JsonSerializerOptions
@ -67,6 +72,140 @@ namespace ManagerService.Data
v => JsonSerializer.Serialize(v, options), v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options)); v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
modelBuilder.Entity<GeoPoint>()
.Property(s => s.Title)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
modelBuilder.Entity<GeoPoint>()
.Property(s => s.Description)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
modelBuilder.Entity<GeoPoint>()
.Property(s => s.Coordinates)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<Coordinate>>(v, options));
modelBuilder.Entity<GeoPoint>()
.Property(s => s.Contents)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<ContentDTO>>(v, options));
modelBuilder.Entity<GeoPoint>()
.Property(s => s.Schedules)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
modelBuilder.Entity<GeoPoint>()
.Property(s => s.Prices)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
modelBuilder.Entity<GeoPoint>()
.Property(s => s.Phone)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
modelBuilder.Entity<GeoPoint>()
.Property(s => s.Email)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
modelBuilder.Entity<GeoPoint>()
.Property(s => s.Site)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
// Configurations JSON pour GuidedPath
modelBuilder.Entity<GuidedPath>()
.Property(gp => gp.Title)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
modelBuilder.Entity<GuidedPath>()
.Property(gp => gp.Description)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
// Configurations JSON pour GuidedStep
modelBuilder.Entity<GuidedStep>()
.Property(gs => gs.Title)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
modelBuilder.Entity<GuidedStep>()
.Property(gs => gs.Description)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
modelBuilder.Entity<GuidedStep>()
.Property(gp => gp.ValidationQuestion)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
modelBuilder.Entity<GuidedStep>()
.Property(gp => gp.ExpectedAnswer)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
modelBuilder.Entity<GuidedStep>()
.Property(gp => gp.TimerExpiredMessage)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
modelBuilder.Entity<GuidedStep>()
.Property(gp => gp.MultipleChoiceOptions)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<ChoiceOptionDTO>>(v, options));
modelBuilder.Entity<GuidedStep>()
.Property(gp => gp.Coordinates)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<Coordinate>>(v, options));
modelBuilder.Entity<MapAnnotation>()
.Property(s => s.Coordinates)
.HasColumnType("jsonb")
.HasConversion(
v => JsonSerializer.Serialize(v, options),
v => JsonSerializer.Deserialize<List<Coordinate>>(v, options));
} }
} }
} }

View File

@ -88,26 +88,19 @@ namespace ManagerService.Data
{ {
return new ConfigurationDTO() return new ConfigurationDTO()
{ {
id = Id, Id = Id,
label = Label, InstanceId = InstanceId,
title = Title, Label = Label,
imageId = ImageId, Title = Title,
imageSource = ImageSource, ImageId = ImageId,
loaderImageId = LoaderImageId, ImageSource = ImageSource,
loaderImageUrl = LoaderImageUrl, PrimaryColor = PrimaryColor,
dateCreation = DateCreation, SecondaryColor = SecondaryColor,
primaryColor = PrimaryColor, Languages = Languages,
languages = Languages, DateCreation = DateCreation,
secondaryColor = SecondaryColor, IsOffline = IsOffline,
isMobile = IsMobile, LoaderImageId = LoaderImageId,
isTablet = IsTablet, LoaderImageUrl = LoaderImageUrl,
isOffline = IsOffline,
instanceId = InstanceId,
isDate = IsDate,
isHour = IsHour,
isSectionImageBackground = IsSectionImageBackground,
roundedValue = RoundedValue,
screenPercentageSectionsMainPage = ScreenPercentageSectionsMainPage,
sectionIds = sectionIds sectionIds = sectionIds
}; };
} }
@ -115,27 +108,21 @@ 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,
label = Label, InstanceId = InstanceId,
title= Title, Label = Label,
imageId = ImageId, Title = Title,
imageSource = ImageSource, ImageId = ImageId,
loaderImageId = LoaderImageId, ImageSource = ImageSource,
loaderImageUrl = LoaderImageUrl, PrimaryColor = PrimaryColor,
dateCreation = DateCreation, SecondaryColor = SecondaryColor,
primaryColor = PrimaryColor, Languages = Languages,
languages = Languages, DateCreation = DateCreation,
secondaryColor = SecondaryColor, IsOffline = IsOffline,
isMobile = IsMobile, LoaderImageId = LoaderImageId,
isTablet = IsTablet, LoaderImageUrl = LoaderImageUrl,
isOffline = IsOffline,
sections = sections, sections = sections,
resources = resources, resources = resources,
instanceId = InstanceId,
isDate = IsDate,
isSectionImageBackground = IsSectionImageBackground,
roundedValue = RoundedValue,
screenPercentageSectionsMainPage = ScreenPercentageSectionsMainPage,
sectionIds = sections.Select(s => s.id).ToList() sectionIds = sections.Select(s => s.id).ToList()
}; };
} }

View File

@ -60,6 +60,8 @@ namespace ManagerService.Data
public int? MeterZoneGPS { get; set; } public int? MeterZoneGPS { get; set; }
public bool isActive { get; set; } = true;
public SectionDTO ToDTO() public SectionDTO ToDTO()
{ {
return new SectionDTO() return new SectionDTO()
@ -68,6 +70,7 @@ namespace ManagerService.Data
label = Label, label = Label,
title = Title, title = Title,
description = Description, description = Description,
isActive = isActive,
order = Order, order = Order,
type = Type, type = Type,
imageId = ImageId, imageId = ImageId,

View File

@ -1,10 +1,8 @@
using Manager.DTOs; using Manager.DTOs;
using ManagerService.DTOs; using ManagerService.DTOs;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace ManagerService.Data.SubSection namespace ManagerService.Data.SubSection

View File

@ -0,0 +1,89 @@
using ManagerService.DTOs;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ManagerService.Data.SubSection
{
/// <summary>
/// Section event
/// </summary>
public class SectionEvent : Section
{
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public List<ProgrammeBlock> Programme { get; set; } = new();
[Column(TypeName = "jsonb")]
public List<string> ParcoursIds { get; set; } = new(); // Liens vers GeoPoints spécifiques
public class ProgrammeBlock
{
[Key]
public string Id { get; set; }
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Title { get; set; }
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Description { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
public List<MapAnnotation> MapAnnotations { get; set; }
}
public class MapAnnotation
{
[Key]
public string Id { get; set; }
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Type { get; set; } // "first_aid", "parking", etc.
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Label { get; set; }
public GeometryType GeometryType { get; set; }
[Column(TypeName = "jsonb")]
public List<Coordinate> Coordinates { get; set; } = new(); // 1 point = marker, plusieurs = polyline/polygon
public string Icon { get; set; } // icon material if point
public ResourceDTO IconResourceDTO { get; set; } // Icon if point
}
public enum GeometryType
{
Point,
Polyline,
Circle,
Polygon
}
public class Coordinate
{
public double Latitude { get; set; }
public double Longitude { get; set; }
}
/*public EventDTO ToDTO()
{
return new EventDTO()
{
id = Id,
label = Label,
title = Title.ToList(),
description = Description.ToList(),
order = Order,
type = Type,
imageId = ImageId,
imageSource = ImageSource,
configurationId = ConfigurationId,
isSubSection = IsSubSection,
parentId = ParentId,
dateCreation = DateCreation,
instanceId = InstanceId,
isBeacon = IsBeacon,
beaconId = BeaconId,
latitude = Latitude,
longitude = Longitude,
meterZoneGPS = MeterZoneGPS,
};
}*/
}
}

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using static ManagerService.Data.SubSection.SectionEvent;
namespace ManagerService.Data.SubSection namespace ManagerService.Data.SubSection
@ -81,9 +82,12 @@ namespace ManagerService.Data.SubSection
public int? CategorieId { get; set; } public int? CategorieId { get; set; }
public string Latitude { get; set; } public GeometryType GeometryType { get; set; }
public string Longitude { get; set; } [Column(TypeName = "jsonb")]
public List<Coordinate> Coordinates { get; set; } = new(); // 1 point = marker, plusieurs = polyline/polygon
public string PolyColor { get; set; } // color of the polyline or polygon
public string ImageResourceId { get; set; } public string ImageResourceId { get; set; }
@ -109,9 +113,182 @@ namespace ManagerService.Data.SubSection
[Column(TypeName = "jsonb")] [Column(TypeName = "jsonb")]
public List<TranslationDTO> Site { get; set; } public List<TranslationDTO> Site { get; set; }
public string SectionMapId { get; set; } public string? SectionMapId { get; set; }
[ForeignKey("SectionMapId")] [ForeignKey(nameof(SectionMapId))]
public SectionMap SectionMap { get; set; } public SectionMap? SectionMap { get; set; }
public string? SectionEventId { get; set; }
[ForeignKey(nameof(SectionEventId))]
public SectionEvent? SectionEvent { get; set; }
} }
public class GuidedPath // Parcours
{
[Key]
public string Id { get; set; }
[Required]
public string InstanceId { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Title { get; set; }
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Description { get; set; }
// Lié à une carte (optionnel)
public string? SectionMapId { get; set; }
[ForeignKey("SectionMapId")]
public SectionMap? SectionMap { get; set; }
// Lié à un événement (optionnel)
public string? SectionEventId { get; set; }
[ForeignKey("SectionEventId")]
public SectionEvent? SectionEvent { get; set; }
// Type de parcours
public bool IsLinear { get; set; } = true; // Avancer dans lordre - Ordre obligatoire
public bool RequireSuccessToAdvance { get; set; } = false; // Par exemple: résoudre une énigme
public bool HideNextStepsUntilComplete { get; set; } = false; // Étapes cachées tant que non terminées
public int Order { get; set; }
public List<GuidedStep> Steps { get; set; } = new();
}
public class GuidedStep // Étape dun parcours
{
[Key]
public string Id { get; set; }
[Required]
public string GuidedPathId { get; set; }
[ForeignKey("GuidedPathId")]
public GuidedPath GuidedPath { get; set; }
public int Order { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Title { get; set; }
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Description { get; set; }
public GeometryType GeometryType { get; set; } = GeometryType.Point; // Polygon, Circle, Point
[Column(TypeName = "jsonb")]
public List<Coordinate> Coordinates { get; set; } = new(); // Polygon ou centre du cercle
public double? ZoneRadiusMeters { get; set; } // Optionnel, utile si zone cercle ou point
public string ImageUrl { get; set; }
public int? TriggerGeoPointId { get; set; } // Lieu lié à l'étape et genre si on veut plus d'info ou pourrait afficher les infos du geopoint.
[ForeignKey("TriggerGeoPointId")]
public GeoPoint TriggerGeoPoint { get; set; }
public bool IsHiddenInitially { get; set; } = false;
public QuestionType ValidationQuestionType { get; set; } = QuestionType.Simple;
// Exemple pour escape game
[Column(TypeName = "jsonb")]
public List<TranslationDTO> ValidationQuestion { get; set; } // TODO type of question ? choix multiple ou direct ?
[Column(TypeName = "jsonb")]
public List<TranslationDTO> ExpectedAnswer { get; set; }
[Column(TypeName = "jsonb")]
public List<ChoiceOptionDTO> MultipleChoiceOptions { get; set; } // Pour choix multiples
// Option : si true, cette étape a un compte à rebourds, false sinon
public bool IsStepTimer { get; set; } = false;
// Option : si true, cette étape doit être validée avant de passer à la suivante
public bool IsStepLocked { get; set; } = true;
// Timer en secondes (durée max pour valider cette étape, optionnel)
public int? TimerSeconds { get; set; }
// Option : message ou action à effectuer si timer expire (ex: afficher aide, fin du jeu...)
[Column(TypeName = "jsonb")]
public List<TranslationDTO> TimerExpiredMessage { get; set; }
}
public class ChoiceOptionDTO
{
public string Id { get; set; } // Identifiant unique pour la réponse
public List<TranslationDTO> Label { get; set; } // Texte à afficher
public bool IsCorrect { get; set; } // Indique si cest une bonne réponse
}
public enum QuestionType
{
Simple, // Réponse texte libre
MultipleChoice // Choix parmi plusieurs options
}
// parcours libre
/*{
"IsLinear": false,
"RequireSuccessToAdvance": false,
"HideNextStepsUntilComplete": false,
"Steps": [
{ "Title": "La tour", "GeoPointId": "...", "IsOptional": false },
{ "Title": "Les jardins", "GeoPointId": "...", "IsOptional": false }
]
}*/
// Parcours escape game
/*{
"IsLinear": true,
"RequireSuccessToAdvance": true,
"HideNextStepsUntilComplete": true,
"Steps": [
{ "Title": "Enigme 1", "RiddleQuestion": "Quel est le code ?", "RiddleAnswer": "1234" },
{ "Title": "Enigme 2", "RiddleQuestion": "Combien de colonnes ?", "RiddleAnswer": "6" }
]
}*/
/*
* {
"Id": "escape001",
"IsLinear": true,
"RequireSuccessToAdvance": true,
"HideNextStepsUntilComplete": true,
"Steps": [
{
"Id": "step1",
"Title": [{ "Lang": "fr", "Text": "Enigme 1" }],
"TriggerGeoPoint": {
"GeometryType": "Circle",
"Coordinates": [{ "Latitude": 49.5, "Longitude": 5.9 }],
"ZoneRadiusMeters": 30
},
"ValidationQuestion": [{ "Lang": "fr", "Text": "Quel est le code secret ?" }],
"ExpectedAnswer": [{ "Lang": "fr", "Text": "1234" }],
"IsStepTimer": true,
"TimerSeconds": 300,
"IsStepLocked": true
},
{
"Id": "step2",
"Title": [{ "Lang": "fr", "Text": "Enigme 2" }],
"TriggerGeoPoint": {
"GeometryType": "Point",
"Coordinates": [{ "Latitude": 49.51, "Longitude": 5.91 }]
},
"ValidationQuestion": [{ "Lang": "fr", "Text": "Combien de colonnes ?" }],
"ExpectedAnswer": [{ "Lang": "fr", "Text": "6" }],
"IsStepTimer": false,
"IsStepLocked": true
}
]
}
*/
} }

View File

@ -31,6 +31,8 @@ namespace ManagerService.Data.SubSection
[Required] [Required]
public int PuzzleCols { get; set; } = 3; public int PuzzleCols { get; set; } = 3;
public bool IsSlidingPuzzle { get; set; } = false;
public PuzzleDTO ToDTO() public PuzzleDTO ToDTO()
{ {

View File

@ -0,0 +1,978 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using Manager.DTOs;
using ManagerService.DTOs;
using ManagerService.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace ManagerService.Migrations
{
[DbContext(typeof(MyInfoMateDbContext))]
[Migration("20250709151627_AddedApplicationInstanceAndMisc")]
partial class AddedApplicationInstanceAndMisc
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ManagerService.DTOs.ResourceDTO", b =>
{
b.Property<string>("id")
.HasColumnType("text");
b.Property<DateTime>("dateCreation")
.HasColumnType("timestamp with time zone");
b.Property<string>("instanceId")
.HasColumnType("text");
b.Property<string>("label")
.HasColumnType("text");
b.Property<int>("type")
.HasColumnType("integer");
b.Property<string>("url")
.HasColumnType("text");
b.HasKey("id");
b.ToTable("ResourceDTO");
});
modelBuilder.Entity("ManagerService.Data.Configuration", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<DateTime>("DateCreation")
.HasColumnType("timestamp with time zone");
b.Property<string>("ImageId")
.HasColumnType("text");
b.Property<string>("ImageSource")
.HasColumnType("text");
b.Property<string>("InstanceId")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsOffline")
.HasColumnType("boolean");
b.Property<string>("Label")
.IsRequired()
.HasColumnType("text");
b.PrimitiveCollection<List<string>>("Languages")
.HasColumnType("text[]");
b.Property<string>("LoaderImageId")
.HasColumnType("text");
b.Property<string>("LoaderImageUrl")
.HasColumnType("text");
b.Property<string>("PrimaryColor")
.HasColumnType("text");
b.Property<string>("SecondaryColor")
.HasColumnType("text");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.ToTable("Configurations");
});
modelBuilder.Entity("ManagerService.Data.Device", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("BatteryLevel")
.HasColumnType("text");
b.Property<string>("ConfigurationId")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("Connected")
.HasColumnType("boolean");
b.Property<string>("ConnectionLevel")
.HasColumnType("text");
b.Property<DateTime>("DateCreation")
.HasColumnType("timestamp with time zone");
b.Property<DateTime>("DateUpdate")
.HasColumnType("timestamp with time zone");
b.Property<string>("Identifier")
.HasColumnType("text");
b.Property<string>("InstanceId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("IpAddressETH")
.HasColumnType("text");
b.Property<string>("IpAddressWLAN")
.HasColumnType("text");
b.Property<DateTime>("LastBatteryLevel")
.HasColumnType("timestamp with time zone");
b.Property<DateTime>("LastConnectionLevel")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ConfigurationId");
b.ToTable("Devices");
});
modelBuilder.Entity("ManagerService.Data.Instance", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<DateTime>("DateCreation")
.HasColumnType("timestamp with time zone");
b.Property<bool>("IsMobile")
.HasColumnType("boolean");
b.Property<bool>("IsPushNotification")
.HasColumnType("boolean");
b.Property<bool>("IsStatistic")
.HasColumnType("boolean");
b.Property<bool>("IsTablet")
.HasColumnType("boolean");
b.Property<bool>("IsVR")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PinCode")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Instances");
});
modelBuilder.Entity("ManagerService.Data.Resource", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<DateTime>("DateCreation")
.HasColumnType("timestamp with time zone");
b.Property<string>("InstanceId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Label")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Type")
.HasColumnType("integer");
b.Property<string>("Url")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Resources");
});
modelBuilder.Entity("ManagerService.Data.Section", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int?>("BeaconId")
.HasColumnType("integer");
b.Property<string>("ConfigurationId")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("DateCreation")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("jsonb");
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(13)
.HasColumnType("character varying(13)");
b.Property<string>("ImageId")
.HasColumnType("text");
b.Property<string>("ImageSource")
.HasColumnType("text");
b.Property<string>("InstanceId")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsBeacon")
.HasColumnType("boolean");
b.Property<bool>("IsSubSection")
.HasColumnType("boolean");
b.Property<string>("Label")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Latitude")
.HasColumnType("text");
b.Property<string>("Longitude")
.HasColumnType("text");
b.Property<int?>("MeterZoneGPS")
.HasColumnType("integer");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("ParentId")
.HasColumnType("text");
b.Property<string>("SectionMenuId")
.HasColumnType("text");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int>("Type")
.HasColumnType("integer");
b.Property<bool>("isActive")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("SectionMenuId");
b.ToTable("Sections");
b.HasDiscriminator().HasValue("Base");
b.UseTphMappingStrategy();
});
modelBuilder.Entity("ManagerService.Data.SubSection.GeoPoint", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("CategorieId")
.HasColumnType("integer");
b.Property<string>("Contents")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("Coordinates")
.HasColumnType("jsonb");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int>("GeometryType")
.HasColumnType("integer");
b.Property<string>("ImageResourceId")
.HasColumnType("text");
b.Property<string>("ImageUrl")
.HasColumnType("text");
b.Property<string>("Phone")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("PolyColor")
.HasColumnType("text");
b.Property<string>("Prices")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("Schedules")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("SectionEventId")
.HasColumnType("text");
b.Property<string>("SectionMapId")
.HasColumnType("text");
b.Property<string>("Site")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("SectionEventId");
b.HasIndex("SectionMapId");
b.ToTable("GeoPoints");
});
modelBuilder.Entity("ManagerService.Data.SubSection.GuidedPath", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("Description")
.HasColumnType("jsonb");
b.Property<bool>("HideNextStepsUntilComplete")
.HasColumnType("boolean");
b.Property<string>("InstanceId")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsLinear")
.HasColumnType("boolean");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<bool>("RequireSuccessToAdvance")
.HasColumnType("boolean");
b.Property<string>("SectionEventId")
.HasColumnType("text");
b.Property<string>("SectionMapId")
.HasColumnType("text");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("SectionEventId");
b.HasIndex("SectionMapId");
b.ToTable("GuidedPaths");
});
modelBuilder.Entity("ManagerService.Data.SubSection.GuidedStep", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("Coordinates")
.HasColumnType("jsonb");
b.Property<string>("Description")
.HasColumnType("jsonb");
b.Property<string>("ExpectedAnswer")
.HasColumnType("jsonb");
b.Property<int>("GeometryType")
.HasColumnType("integer");
b.Property<string>("GuidedPathId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ImageUrl")
.HasColumnType("text");
b.Property<bool>("IsHiddenInitially")
.HasColumnType("boolean");
b.Property<bool>("IsStepLocked")
.HasColumnType("boolean");
b.Property<bool>("IsStepTimer")
.HasColumnType("boolean");
b.Property<string>("MultipleChoiceOptions")
.HasColumnType("jsonb");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("TimerExpiredMessage")
.HasColumnType("jsonb");
b.Property<int?>("TimerSeconds")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int?>("TriggerGeoPointId")
.HasColumnType("integer");
b.Property<string>("ValidationQuestion")
.HasColumnType("jsonb");
b.Property<int>("ValidationQuestionType")
.HasColumnType("integer");
b.Property<double?>("ZoneRadiusMeters")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("GuidedPathId");
b.HasIndex("TriggerGeoPointId");
b.ToTable("GuidedSteps");
});
modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<List<TranslationAndResourceDTO>>("Label")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("ResourceId")
.HasColumnType("text");
b.Property<List<ResponseDTO>>("Responses")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("SectionQuizId")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ResourceId");
b.HasIndex("SectionQuizId");
b.ToTable("QuizQuestions");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+MapAnnotation", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("Coordinates")
.HasColumnType("jsonb");
b.Property<int>("GeometryType")
.HasColumnType("integer");
b.Property<string>("Icon")
.HasColumnType("text");
b.Property<string>("IconResourceDTOid")
.HasColumnType("text");
b.Property<List<TranslationDTO>>("Label")
.HasColumnType("jsonb");
b.Property<string>("ProgrammeBlockId")
.HasColumnType("text");
b.Property<List<TranslationDTO>>("Type")
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("IconResourceDTOid");
b.HasIndex("ProgrammeBlockId");
b.ToTable("MapAnnotation");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+ProgrammeBlock", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<List<TranslationDTO>>("Description")
.HasColumnType("jsonb");
b.Property<DateTime>("EndTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("SectionEventId")
.HasColumnType("text");
b.Property<DateTime>("StartTime")
.HasColumnType("timestamp with time zone");
b.Property<List<TranslationDTO>>("Title")
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("SectionEventId");
b.ToTable("ProgrammeBlock");
});
modelBuilder.Entity("ManagerService.Data.User", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<DateTime>("DateCreation")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FirstName")
.HasColumnType("text");
b.Property<string>("InstanceId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Token")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionAgenda", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<int?>("AgendaMapProvider")
.HasColumnType("integer");
b.Property<List<TranslationDTO>>("AgendaResourceIds")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("Agenda");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionArticle", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<TranslationDTO>>("ArticleAudioIds")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationDTO>>("ArticleContent")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<ContentDTO>>("ArticleContents")
.IsRequired()
.HasColumnType("jsonb");
b.Property<bool>("ArticleIsContentTop")
.HasColumnType("boolean");
b.Property<bool>("ArticleIsReadAudioAuto")
.HasColumnType("boolean");
b.HasDiscriminator().HasValue("Article");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp with time zone");
b.Property<List<string>>("ParcoursIds")
.HasColumnType("jsonb");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp with time zone");
b.HasDiscriminator().HasValue("SectionEvent");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<CategorieDTO>>("MapCategories")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("MapCenterLatitude")
.HasColumnType("text");
b.Property<string>("MapCenterLongitude")
.HasColumnType("text");
b.Property<int?>("MapMapProvider")
.HasColumnType("integer");
b.Property<int?>("MapMapType")
.HasColumnType("integer");
b.Property<string>("MapResourceId")
.HasColumnType("text");
b.Property<int?>("MapTypeMapbox")
.HasColumnType("integer");
b.Property<int>("MapZoom")
.HasColumnType("integer");
b.HasIndex("MapResourceId");
b.HasDiscriminator().HasValue("Map");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMenu", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.HasDiscriminator().HasValue("Menu");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionPdf", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<OrderedTranslationAndResourceDTO>>("PDFOrderedTranslationAndResources")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("PDF");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionPuzzle", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<bool>("IsSlidingPuzzle")
.HasColumnType("boolean");
b.Property<int>("PuzzleCols")
.HasColumnType("integer");
b.Property<string>("PuzzleImageId")
.HasColumnType("text");
b.Property<List<TranslationAndResourceDTO>>("PuzzleMessageDebut")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResourceDTO>>("PuzzleMessageFin")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int>("PuzzleRows")
.HasColumnType("integer");
b.HasIndex("PuzzleImageId");
b.HasDiscriminator().HasValue("Puzzle");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionQuiz", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<TranslationAndResourceDTO>>("QuizBadLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResourceDTO>>("QuizGoodLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResourceDTO>>("QuizGreatLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResourceDTO>>("QuizMediumLevel")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("Quiz");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionSlider", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<ContentDTO>>("SliderContents")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("Slider");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionVideo", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<string>("VideoSource")
.IsRequired()
.HasColumnType("text");
b.HasDiscriminator().HasValue("Video");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionWeather", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<string>("WeatherCity")
.HasColumnType("text");
b.Property<string>("WeatherResult")
.HasColumnType("text");
b.Property<DateTimeOffset?>("WeatherUpdatedDate")
.HasColumnType("timestamp with time zone");
b.HasDiscriminator().HasValue("Weather");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionWeb", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<string>("WebSource")
.IsRequired()
.HasColumnType("text");
b.HasDiscriminator().HasValue("Web");
});
modelBuilder.Entity("ManagerService.Data.Device", b =>
{
b.HasOne("ManagerService.Data.Configuration", "Configuration")
.WithMany()
.HasForeignKey("ConfigurationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Configuration");
});
modelBuilder.Entity("ManagerService.Data.Section", b =>
{
b.HasOne("ManagerService.Data.SubSection.SectionMenu", null)
.WithMany("MenuSections")
.HasForeignKey("SectionMenuId");
});
modelBuilder.Entity("ManagerService.Data.SubSection.GeoPoint", b =>
{
b.HasOne("ManagerService.Data.SubSection.SectionEvent", "SectionEvent")
.WithMany()
.HasForeignKey("SectionEventId");
b.HasOne("ManagerService.Data.SubSection.SectionMap", "SectionMap")
.WithMany("MapPoints")
.HasForeignKey("SectionMapId");
b.Navigation("SectionEvent");
b.Navigation("SectionMap");
});
modelBuilder.Entity("ManagerService.Data.SubSection.GuidedPath", b =>
{
b.HasOne("ManagerService.Data.SubSection.SectionEvent", "SectionEvent")
.WithMany()
.HasForeignKey("SectionEventId");
b.HasOne("ManagerService.Data.SubSection.SectionMap", "SectionMap")
.WithMany()
.HasForeignKey("SectionMapId");
b.Navigation("SectionEvent");
b.Navigation("SectionMap");
});
modelBuilder.Entity("ManagerService.Data.SubSection.GuidedStep", b =>
{
b.HasOne("ManagerService.Data.SubSection.GuidedPath", "GuidedPath")
.WithMany("Steps")
.HasForeignKey("GuidedPathId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ManagerService.Data.SubSection.GeoPoint", "TriggerGeoPoint")
.WithMany()
.HasForeignKey("TriggerGeoPointId");
b.Navigation("GuidedPath");
b.Navigation("TriggerGeoPoint");
});
modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b =>
{
b.HasOne("ManagerService.Data.Resource", "Resource")
.WithMany()
.HasForeignKey("ResourceId");
b.HasOne("ManagerService.Data.SubSection.SectionQuiz", "SectionQuiz")
.WithMany("QuizQuestions")
.HasForeignKey("SectionQuizId");
b.Navigation("Resource");
b.Navigation("SectionQuiz");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+MapAnnotation", b =>
{
b.HasOne("ManagerService.DTOs.ResourceDTO", "IconResourceDTO")
.WithMany()
.HasForeignKey("IconResourceDTOid");
b.HasOne("ManagerService.Data.SubSection.SectionEvent+ProgrammeBlock", null)
.WithMany("MapAnnotations")
.HasForeignKey("ProgrammeBlockId");
b.Navigation("IconResourceDTO");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+ProgrammeBlock", b =>
{
b.HasOne("ManagerService.Data.SubSection.SectionEvent", null)
.WithMany("Programme")
.HasForeignKey("SectionEventId");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b =>
{
b.HasOne("ManagerService.Data.Resource", "MapResource")
.WithMany()
.HasForeignKey("MapResourceId");
b.Navigation("MapResource");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionPuzzle", b =>
{
b.HasOne("ManagerService.Data.Resource", "PuzzleImage")
.WithMany()
.HasForeignKey("PuzzleImageId");
b.Navigation("PuzzleImage");
});
modelBuilder.Entity("ManagerService.Data.SubSection.GuidedPath", b =>
{
b.Navigation("Steps");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+ProgrammeBlock", b =>
{
b.Navigation("MapAnnotations");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent", b =>
{
b.Navigation("Programme");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b =>
{
b.Navigation("MapPoints");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMenu", b =>
{
b.Navigation("MenuSections");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionQuiz", b =>
{
b.Navigation("QuizQuestions");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,473 @@
using System;
using System.Collections.Generic;
using ManagerService.DTOs;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ManagerService.Migrations
{
/// <inheritdoc />
public partial class AddedApplicationInstanceAndMisc : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsDate",
table: "Configurations");
migrationBuilder.DropColumn(
name: "IsHour",
table: "Configurations");
migrationBuilder.DropColumn(
name: "IsMobile",
table: "Configurations");
migrationBuilder.DropColumn(
name: "IsSectionImageBackground",
table: "Configurations");
migrationBuilder.DropColumn(
name: "IsTablet",
table: "Configurations");
migrationBuilder.DropColumn(
name: "RoundedValue",
table: "Configurations");
migrationBuilder.DropColumn(
name: "ScreenPercentageSectionsMainPage",
table: "Configurations");
migrationBuilder.DropColumn(
name: "Longitude",
table: "GeoPoints");
migrationBuilder.AddColumn<string>(
name: "SectionEventId",
table: "GeoPoints",
type: "text",
nullable: true);
migrationBuilder.RenameColumn(
name: "Latitude",
table: "GeoPoints",
newName: "PolyColor");
migrationBuilder.AlterColumn<string>(
name: "Discriminator",
table: "Sections",
type: "character varying(13)",
maxLength: 13,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(8)",
oldMaxLength: 8);
migrationBuilder.AddColumn<DateTime>(
name: "EndDate",
table: "Sections",
type: "timestamp with time zone",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsSlidingPuzzle",
table: "Sections",
type: "boolean",
nullable: true);
migrationBuilder.AddColumn<List<string>>(
name: "ParcoursIds",
table: "Sections",
type: "jsonb",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "StartDate",
table: "Sections",
type: "timestamp with time zone",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "isActive",
table: "Sections",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsMobile",
table: "Instances",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsPushNotification",
table: "Instances",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsStatistic",
table: "Instances",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsTablet",
table: "Instances",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsVR",
table: "Instances",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<string>(
name: "Coordinates",
table: "GeoPoints",
type: "jsonb",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "GeometryType",
table: "GeoPoints",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateTable(
name: "GuidedPaths",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
InstanceId = table.Column<string>(type: "text", nullable: false),
Title = table.Column<string>(type: "jsonb", nullable: false),
Description = table.Column<string>(type: "jsonb", nullable: true),
SectionMapId = table.Column<string>(type: "text", nullable: true),
SectionEventId = table.Column<string>(type: "text", nullable: true),
IsLinear = table.Column<bool>(type: "boolean", nullable: false),
RequireSuccessToAdvance = table.Column<bool>(type: "boolean", nullable: false),
HideNextStepsUntilComplete = table.Column<bool>(type: "boolean", nullable: false),
Order = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GuidedPaths", x => x.Id);
table.ForeignKey(
name: "FK_GuidedPaths_Sections_SectionEventId",
column: x => x.SectionEventId,
principalTable: "Sections",
principalColumn: "Id");
table.ForeignKey(
name: "FK_GuidedPaths_Sections_SectionMapId",
column: x => x.SectionMapId,
principalTable: "Sections",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "ProgrammeBlock",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Title = table.Column<List<TranslationDTO>>(type: "jsonb", nullable: true),
Description = table.Column<List<TranslationDTO>>(type: "jsonb", nullable: true),
StartTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
EndTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
SectionEventId = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ProgrammeBlock", x => x.Id);
table.ForeignKey(
name: "FK_ProgrammeBlock_Sections_SectionEventId",
column: x => x.SectionEventId,
principalTable: "Sections",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "ResourceDTO",
columns: table => new
{
id = table.Column<string>(type: "text", nullable: false),
type = table.Column<int>(type: "integer", nullable: false),
label = table.Column<string>(type: "text", nullable: true),
url = table.Column<string>(type: "text", nullable: true),
dateCreation = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
instanceId = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ResourceDTO", x => x.id);
});
migrationBuilder.CreateTable(
name: "GuidedSteps",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
GuidedPathId = table.Column<string>(type: "text", nullable: false),
Order = table.Column<int>(type: "integer", nullable: false),
Title = table.Column<string>(type: "jsonb", nullable: false),
Description = table.Column<string>(type: "jsonb", nullable: true),
GeometryType = table.Column<int>(type: "integer", nullable: false),
Coordinates = table.Column<string>(type: "jsonb", nullable: true),
ZoneRadiusMeters = table.Column<double>(type: "double precision", nullable: true),
ImageUrl = table.Column<string>(type: "text", nullable: true),
TriggerGeoPointId = table.Column<int>(type: "integer", nullable: true),
IsHiddenInitially = table.Column<bool>(type: "boolean", nullable: false),
ValidationQuestionType = table.Column<int>(type: "integer", nullable: false),
ValidationQuestion = table.Column<string>(type: "jsonb", nullable: true),
ExpectedAnswer = table.Column<string>(type: "jsonb", nullable: true),
MultipleChoiceOptions = table.Column<string>(type: "jsonb", nullable: true),
IsStepTimer = table.Column<bool>(type: "boolean", nullable: false),
IsStepLocked = table.Column<bool>(type: "boolean", nullable: false),
TimerSeconds = table.Column<int>(type: "integer", nullable: true),
TimerExpiredMessage = table.Column<string>(type: "jsonb", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_GuidedSteps", x => x.Id);
table.ForeignKey(
name: "FK_GuidedSteps_GeoPoints_TriggerGeoPointId",
column: x => x.TriggerGeoPointId,
principalTable: "GeoPoints",
principalColumn: "Id");
table.ForeignKey(
name: "FK_GuidedSteps_GuidedPaths_GuidedPathId",
column: x => x.GuidedPathId,
principalTable: "GuidedPaths",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "MapAnnotation",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Type = table.Column<List<TranslationDTO>>(type: "jsonb", nullable: true),
Label = table.Column<List<TranslationDTO>>(type: "jsonb", nullable: true),
GeometryType = table.Column<int>(type: "integer", nullable: false),
Coordinates = table.Column<string>(type: "jsonb", nullable: true),
Icon = table.Column<string>(type: "text", nullable: true),
IconResourceDTOid = table.Column<string>(type: "text", nullable: true),
ProgrammeBlockId = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MapAnnotation", x => x.Id);
table.ForeignKey(
name: "FK_MapAnnotation_ProgrammeBlock_ProgrammeBlockId",
column: x => x.ProgrammeBlockId,
principalTable: "ProgrammeBlock",
principalColumn: "Id");
table.ForeignKey(
name: "FK_MapAnnotation_ResourceDTO_IconResourceDTOid",
column: x => x.IconResourceDTOid,
principalTable: "ResourceDTO",
principalColumn: "id");
});
migrationBuilder.CreateIndex(
name: "IX_GeoPoints_SectionEventId",
table: "GeoPoints",
column: "SectionEventId");
migrationBuilder.CreateIndex(
name: "IX_GuidedPaths_SectionEventId",
table: "GuidedPaths",
column: "SectionEventId");
migrationBuilder.CreateIndex(
name: "IX_GuidedPaths_SectionMapId",
table: "GuidedPaths",
column: "SectionMapId");
migrationBuilder.CreateIndex(
name: "IX_GuidedSteps_GuidedPathId",
table: "GuidedSteps",
column: "GuidedPathId");
migrationBuilder.CreateIndex(
name: "IX_GuidedSteps_TriggerGeoPointId",
table: "GuidedSteps",
column: "TriggerGeoPointId");
migrationBuilder.CreateIndex(
name: "IX_MapAnnotation_IconResourceDTOid",
table: "MapAnnotation",
column: "IconResourceDTOid");
migrationBuilder.CreateIndex(
name: "IX_MapAnnotation_ProgrammeBlockId",
table: "MapAnnotation",
column: "ProgrammeBlockId");
migrationBuilder.CreateIndex(
name: "IX_ProgrammeBlock_SectionEventId",
table: "ProgrammeBlock",
column: "SectionEventId");
migrationBuilder.AddForeignKey(
name: "FK_GeoPoints_Sections_SectionEventId",
table: "GeoPoints",
column: "SectionEventId",
principalTable: "Sections",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_GeoPoints_Sections_SectionEventId",
table: "GeoPoints");
migrationBuilder.DropTable(
name: "GuidedSteps");
migrationBuilder.DropTable(
name: "MapAnnotation");
migrationBuilder.DropTable(
name: "GuidedPaths");
migrationBuilder.DropTable(
name: "ProgrammeBlock");
migrationBuilder.DropTable(
name: "ResourceDTO");
migrationBuilder.DropIndex(
name: "IX_GeoPoints_SectionEventId",
table: "GeoPoints");
migrationBuilder.DropColumn(
name: "EndDate",
table: "Sections");
migrationBuilder.DropColumn(
name: "IsSlidingPuzzle",
table: "Sections");
migrationBuilder.DropColumn(
name: "ParcoursIds",
table: "Sections");
migrationBuilder.DropColumn(
name: "StartDate",
table: "Sections");
migrationBuilder.DropColumn(
name: "isActive",
table: "Sections");
migrationBuilder.DropColumn(
name: "IsMobile",
table: "Instances");
migrationBuilder.DropColumn(
name: "IsPushNotification",
table: "Instances");
migrationBuilder.DropColumn(
name: "IsStatistic",
table: "Instances");
migrationBuilder.DropColumn(
name: "IsTablet",
table: "Instances");
migrationBuilder.DropColumn(
name: "IsVR",
table: "Instances");
migrationBuilder.DropColumn(
name: "Coordinates",
table: "GeoPoints");
migrationBuilder.DropColumn(
name: "GeometryType",
table: "GeoPoints");
migrationBuilder.RenameColumn(
name: "SectionEventId",
table: "GeoPoints",
newName: "Longitude");
migrationBuilder.RenameColumn(
name: "PolyColor",
table: "GeoPoints",
newName: "Latitude");
migrationBuilder.AlterColumn<string>(
name: "Discriminator",
table: "Sections",
type: "character varying(8)",
maxLength: 8,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(13)",
oldMaxLength: 13);
migrationBuilder.AddColumn<bool>(
name: "IsDate",
table: "Configurations",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsHour",
table: "Configurations",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsMobile",
table: "Configurations",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsSectionImageBackground",
table: "Configurations",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsTablet",
table: "Configurations",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<int>(
name: "RoundedValue",
table: "Configurations",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ScreenPercentageSectionsMainPage",
table: "Configurations",
type: "integer",
nullable: true);
}
}
}

View File

@ -4,7 +4,6 @@ using System.Collections.Generic;
using Manager.DTOs; using Manager.DTOs;
using ManagerService.DTOs; using ManagerService.DTOs;
using ManagerService.Data; using ManagerService.Data;
using ManagerService.Data.SubSection;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
@ -26,6 +25,31 @@ namespace ManagerService.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ManagerService.DTOs.ResourceDTO", b =>
{
b.Property<string>("id")
.HasColumnType("text");
b.Property<DateTime>("dateCreation")
.HasColumnType("timestamp with time zone");
b.Property<string>("instanceId")
.HasColumnType("text");
b.Property<string>("label")
.HasColumnType("text");
b.Property<int>("type")
.HasColumnType("integer");
b.Property<string>("url")
.HasColumnType("text");
b.HasKey("id");
b.ToTable("ResourceDTO");
});
modelBuilder.Entity("ManagerService.Data.Configuration", b => modelBuilder.Entity("ManagerService.Data.Configuration", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
@ -44,24 +68,9 @@ namespace ManagerService.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<bool>("IsDate")
.HasColumnType("boolean");
b.Property<bool>("IsHour")
.HasColumnType("boolean");
b.Property<bool>("IsMobile")
.HasColumnType("boolean");
b.Property<bool>("IsOffline") b.Property<bool>("IsOffline")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<bool>("IsSectionImageBackground")
.HasColumnType("boolean");
b.Property<bool>("IsTablet")
.HasColumnType("boolean");
b.Property<string>("Label") b.Property<string>("Label")
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
@ -78,12 +87,6 @@ namespace ManagerService.Migrations
b.Property<string>("PrimaryColor") b.Property<string>("PrimaryColor")
.HasColumnType("text"); .HasColumnType("text");
b.Property<int?>("RoundedValue")
.HasColumnType("integer");
b.Property<int?>("ScreenPercentageSectionsMainPage")
.HasColumnType("integer");
b.Property<string>("SecondaryColor") b.Property<string>("SecondaryColor")
.HasColumnType("text"); .HasColumnType("text");
@ -157,6 +160,21 @@ namespace ManagerService.Migrations
b.Property<DateTime>("DateCreation") b.Property<DateTime>("DateCreation")
.HasColumnType("timestamp with time zone"); .HasColumnType("timestamp with time zone");
b.Property<bool>("IsMobile")
.HasColumnType("boolean");
b.Property<bool>("IsPushNotification")
.HasColumnType("boolean");
b.Property<bool>("IsStatistic")
.HasColumnType("boolean");
b.Property<bool>("IsTablet")
.HasColumnType("boolean");
b.Property<bool>("IsVR")
.HasColumnType("boolean");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
@ -216,8 +234,8 @@ namespace ManagerService.Migrations
b.Property<string>("Discriminator") b.Property<string>("Discriminator")
.IsRequired() .IsRequired()
.HasMaxLength(8) .HasMaxLength(13)
.HasColumnType("character varying(8)"); .HasColumnType("character varying(13)");
b.Property<string>("ImageId") b.Property<string>("ImageId")
.HasColumnType("text"); .HasColumnType("text");
@ -264,6 +282,9 @@ namespace ManagerService.Migrations
b.Property<int>("Type") b.Property<int>("Type")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<bool>("isActive")
.HasColumnType("boolean");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("SectionMenuId"); b.HasIndex("SectionMenuId");
@ -286,60 +307,181 @@ namespace ManagerService.Migrations
b.Property<int?>("CategorieId") b.Property<int?>("CategorieId")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<List<ContentDTO>>("Contents") b.Property<string>("Contents")
.IsRequired() .IsRequired()
.HasColumnType("jsonb"); .HasColumnType("jsonb");
b.Property<List<TranslationDTO>>("Description") b.Property<string>("Coordinates")
.HasColumnType("jsonb");
b.Property<string>("Description")
.IsRequired() .IsRequired()
.HasColumnType("jsonb"); .HasColumnType("jsonb");
b.Property<List<TranslationDTO>>("Email") b.Property<string>("Email")
.IsRequired() .IsRequired()
.HasColumnType("jsonb"); .HasColumnType("jsonb");
b.Property<int>("GeometryType")
.HasColumnType("integer");
b.Property<string>("ImageResourceId") b.Property<string>("ImageResourceId")
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("ImageUrl") b.Property<string>("ImageUrl")
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Latitude") b.Property<string>("Phone")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("PolyColor")
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Longitude") b.Property<string>("Prices")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("Schedules")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("SectionEventId")
.HasColumnType("text"); .HasColumnType("text");
b.Property<List<TranslationDTO>>("Phone")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationDTO>>("Prices")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationDTO>>("Schedules")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("SectionMapId") b.Property<string>("SectionMapId")
.HasColumnType("text"); .HasColumnType("text");
b.Property<List<TranslationDTO>>("Site") b.Property<string>("Site")
.IsRequired() .IsRequired()
.HasColumnType("jsonb"); .HasColumnType("jsonb");
b.Property<List<TranslationDTO>>("Title") b.Property<string>("Title")
.IsRequired() .IsRequired()
.HasColumnType("jsonb"); .HasColumnType("jsonb");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("SectionEventId");
b.HasIndex("SectionMapId"); b.HasIndex("SectionMapId");
b.ToTable("GeoPoints"); b.ToTable("GeoPoints");
}); });
modelBuilder.Entity("ManagerService.Data.SubSection.GuidedPath", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("Description")
.HasColumnType("jsonb");
b.Property<bool>("HideNextStepsUntilComplete")
.HasColumnType("boolean");
b.Property<string>("InstanceId")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsLinear")
.HasColumnType("boolean");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<bool>("RequireSuccessToAdvance")
.HasColumnType("boolean");
b.Property<string>("SectionEventId")
.HasColumnType("text");
b.Property<string>("SectionMapId")
.HasColumnType("text");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("SectionEventId");
b.HasIndex("SectionMapId");
b.ToTable("GuidedPaths");
});
modelBuilder.Entity("ManagerService.Data.SubSection.GuidedStep", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("Coordinates")
.HasColumnType("jsonb");
b.Property<string>("Description")
.HasColumnType("jsonb");
b.Property<string>("ExpectedAnswer")
.HasColumnType("jsonb");
b.Property<int>("GeometryType")
.HasColumnType("integer");
b.Property<string>("GuidedPathId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ImageUrl")
.HasColumnType("text");
b.Property<bool>("IsHiddenInitially")
.HasColumnType("boolean");
b.Property<bool>("IsStepLocked")
.HasColumnType("boolean");
b.Property<bool>("IsStepTimer")
.HasColumnType("boolean");
b.Property<string>("MultipleChoiceOptions")
.HasColumnType("jsonb");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("TimerExpiredMessage")
.HasColumnType("jsonb");
b.Property<int?>("TimerSeconds")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int?>("TriggerGeoPointId")
.HasColumnType("integer");
b.Property<string>("ValidationQuestion")
.HasColumnType("jsonb");
b.Property<int>("ValidationQuestionType")
.HasColumnType("integer");
b.Property<double?>("ZoneRadiusMeters")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("GuidedPathId");
b.HasIndex("TriggerGeoPointId");
b.ToTable("GuidedSteps");
});
modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b => modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -374,6 +516,68 @@ namespace ManagerService.Migrations
b.ToTable("QuizQuestions"); b.ToTable("QuizQuestions");
}); });
modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+MapAnnotation", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("Coordinates")
.HasColumnType("jsonb");
b.Property<int>("GeometryType")
.HasColumnType("integer");
b.Property<string>("Icon")
.HasColumnType("text");
b.Property<string>("IconResourceDTOid")
.HasColumnType("text");
b.Property<List<TranslationDTO>>("Label")
.HasColumnType("jsonb");
b.Property<string>("ProgrammeBlockId")
.HasColumnType("text");
b.Property<List<TranslationDTO>>("Type")
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("IconResourceDTOid");
b.HasIndex("ProgrammeBlockId");
b.ToTable("MapAnnotation");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+ProgrammeBlock", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<List<TranslationDTO>>("Description")
.HasColumnType("jsonb");
b.Property<DateTime>("EndTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("SectionEventId")
.HasColumnType("text");
b.Property<DateTime>("StartTime")
.HasColumnType("timestamp with time zone");
b.Property<List<TranslationDTO>>("Title")
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("SectionEventId");
b.ToTable("ProgrammeBlock");
});
modelBuilder.Entity("ManagerService.Data.User", b => modelBuilder.Entity("ManagerService.Data.User", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
@ -449,6 +653,22 @@ namespace ManagerService.Migrations
b.HasDiscriminator().HasValue("Article"); b.HasDiscriminator().HasValue("Article");
}); });
modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<DateTime>("EndDate")
.HasColumnType("timestamp with time zone");
b.Property<List<string>>("ParcoursIds")
.HasColumnType("jsonb");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp with time zone");
b.HasDiscriminator().HasValue("SectionEvent");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b => modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b =>
{ {
b.HasBaseType("ManagerService.Data.Section"); b.HasBaseType("ManagerService.Data.Section");
@ -505,17 +725,20 @@ namespace ManagerService.Migrations
{ {
b.HasBaseType("ManagerService.Data.Section"); b.HasBaseType("ManagerService.Data.Section");
b.Property<bool>("IsSlidingPuzzle")
.HasColumnType("boolean");
b.Property<int>("PuzzleCols") b.Property<int>("PuzzleCols")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<string>("PuzzleImageId") b.Property<string>("PuzzleImageId")
.HasColumnType("text"); .HasColumnType("text");
b.Property<List<TranslationAndResource>>("PuzzleMessageDebut") b.Property<List<TranslationAndResourceDTO>>("PuzzleMessageDebut")
.IsRequired() .IsRequired()
.HasColumnType("jsonb"); .HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("PuzzleMessageFin") b.Property<List<TranslationAndResourceDTO>>("PuzzleMessageFin")
.IsRequired() .IsRequired()
.HasColumnType("jsonb"); .HasColumnType("jsonb");
@ -619,13 +842,51 @@ namespace ManagerService.Migrations
modelBuilder.Entity("ManagerService.Data.SubSection.GeoPoint", b => modelBuilder.Entity("ManagerService.Data.SubSection.GeoPoint", b =>
{ {
b.HasOne("ManagerService.Data.SubSection.SectionEvent", "SectionEvent")
.WithMany()
.HasForeignKey("SectionEventId");
b.HasOne("ManagerService.Data.SubSection.SectionMap", "SectionMap") b.HasOne("ManagerService.Data.SubSection.SectionMap", "SectionMap")
.WithMany("MapPoints") .WithMany("MapPoints")
.HasForeignKey("SectionMapId"); .HasForeignKey("SectionMapId");
b.Navigation("SectionEvent");
b.Navigation("SectionMap"); b.Navigation("SectionMap");
}); });
modelBuilder.Entity("ManagerService.Data.SubSection.GuidedPath", b =>
{
b.HasOne("ManagerService.Data.SubSection.SectionEvent", "SectionEvent")
.WithMany()
.HasForeignKey("SectionEventId");
b.HasOne("ManagerService.Data.SubSection.SectionMap", "SectionMap")
.WithMany()
.HasForeignKey("SectionMapId");
b.Navigation("SectionEvent");
b.Navigation("SectionMap");
});
modelBuilder.Entity("ManagerService.Data.SubSection.GuidedStep", b =>
{
b.HasOne("ManagerService.Data.SubSection.GuidedPath", "GuidedPath")
.WithMany("Steps")
.HasForeignKey("GuidedPathId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ManagerService.Data.SubSection.GeoPoint", "TriggerGeoPoint")
.WithMany()
.HasForeignKey("TriggerGeoPointId");
b.Navigation("GuidedPath");
b.Navigation("TriggerGeoPoint");
});
modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b => modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b =>
{ {
b.HasOne("ManagerService.Data.Resource", "Resource") b.HasOne("ManagerService.Data.Resource", "Resource")
@ -641,6 +902,26 @@ namespace ManagerService.Migrations
b.Navigation("SectionQuiz"); b.Navigation("SectionQuiz");
}); });
modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+MapAnnotation", b =>
{
b.HasOne("ManagerService.DTOs.ResourceDTO", "IconResourceDTO")
.WithMany()
.HasForeignKey("IconResourceDTOid");
b.HasOne("ManagerService.Data.SubSection.SectionEvent+ProgrammeBlock", null)
.WithMany("MapAnnotations")
.HasForeignKey("ProgrammeBlockId");
b.Navigation("IconResourceDTO");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+ProgrammeBlock", b =>
{
b.HasOne("ManagerService.Data.SubSection.SectionEvent", null)
.WithMany("Programme")
.HasForeignKey("SectionEventId");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b => modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b =>
{ {
b.HasOne("ManagerService.Data.Resource", "MapResource") b.HasOne("ManagerService.Data.Resource", "MapResource")
@ -659,6 +940,21 @@ namespace ManagerService.Migrations
b.Navigation("PuzzleImage"); b.Navigation("PuzzleImage");
}); });
modelBuilder.Entity("ManagerService.Data.SubSection.GuidedPath", b =>
{
b.Navigation("Steps");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+ProgrammeBlock", b =>
{
b.Navigation("MapAnnotations");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent", b =>
{
b.Navigation("Programme");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b => modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b =>
{ {
b.Navigation("MapPoints"); b.Navigation("MapPoints");

View File

@ -188,7 +188,7 @@ namespace ManagerService
app.UseCors( app.UseCors(
#if DEBUG #if DEBUG
options => options options => options
.SetIsOriginAllowed(origin => string.IsNullOrEmpty(origin) || origin == "http://localhost:49430") .SetIsOriginAllowed(origin => string.IsNullOrEmpty(origin) || origin == "http://localhost:52444")
.AllowAnyMethod() .AllowAnyMethod()
.AllowAnyHeader() .AllowAnyHeader()
.AllowCredentials() .AllowCredentials()