section (to be tested when front) + section map controller + section quiz controller + update useless entities to DTO

This commit is contained in:
Thomas Fransolet 2025-03-24 17:18:59 +01:00
parent a4bde1a8f4
commit cef69a61df
40 changed files with 6212 additions and 321 deletions

View File

@ -230,7 +230,7 @@ namespace ManagerService.Controllers
Configuration configuration = new Configuration();
configuration.InstanceId = newConfiguration.instanceId;
configuration.Label = newConfiguration.label;
configuration.Title = new List<Translation>();
configuration.Title = new List<TranslationDTO>();
configuration.ImageId = newConfiguration.imageId;
configuration.ImageSource = newConfiguration.imageSource;
configuration.PrimaryColor = newConfiguration.primaryColor;
@ -301,7 +301,7 @@ namespace ManagerService.Controllers
// Todo add some verification ?
configuration.InstanceId = updatedConfiguration.instanceId;
configuration.Label = updatedConfiguration.label;
configuration.Title = updatedConfiguration.title.Select(t => new Translation().FromDTO(t)).ToList(); // TO CHEECK !
configuration.Title = updatedConfiguration.title;
configuration.ImageId = updatedConfiguration.imageId;
configuration.ImageSource = updatedConfiguration.imageSource;
configuration.PrimaryColor = updatedConfiguration.primaryColor;
@ -649,7 +649,7 @@ namespace ManagerService.Controllers
configuration.Id = exportConfiguration.id;
configuration.InstanceId = exportConfiguration.instanceId;
configuration.Label = exportConfiguration.label;
configuration.Title = exportConfiguration.title.Select(t => new Translation().FromDTO(t)).ToList(); // TO CHEECK !
configuration.Title = exportConfiguration.title;
configuration.ImageId = exportConfiguration.imageId;
configuration.ImageSource = exportConfiguration.imageSource;
@ -683,15 +683,15 @@ namespace ManagerService.Controllers
//_configurationService.Create(configuration);
var sectionsAlreadyInDB = _myInfoMateDbContext.Sections.Where(s => !exportConfiguration.sections.Select(s => s.id).Contains(s.Id)).Select(s => s.Id).ToList();
// TODO TEST
foreach (var section in exportConfiguration.sections.Where(s => !sectionsAlreadyInDB.Contains(s.id)))
{
Section newSection = new Section();
newSection.Id = section.id;
newSection.InstanceId = section.instanceId;
newSection.Label = section.label;
newSection.Title = section.title.Select(t => new Translation().FromDTO(t)).ToList(); // TODO TEST
newSection.Description = section.description.Select(t => new Translation().FromDTO(t)).ToList(); // TODO TEST
newSection.Title = section.title;
newSection.Description = section.description;
newSection.Order = section.order.GetValueOrDefault(); // if one day we can use same section in multiple configuration, need to change that
newSection.Type = section.type;
newSection.ImageId = section.imageId;

View File

@ -445,8 +445,8 @@ namespace ManagerService.Controllers
point.ImageResourceId = point.ImageResourceId == id ? null : point.ImageResourceId;
foreach (var content in point.Contents)
{
content.Url = content.Id == id ? null : content.Url;
content.Id = content.Id == id ? null : content.Id;
content.resource.url = content.resourceId == id ? null : content.resource.url;
content.resourceId = content.resourceId == id ? null : content.resourceId;
}
}
@ -467,7 +467,7 @@ namespace ManagerService.Controllers
contentsToKeep.Add(content);
}*/
// TODO TEST
slider.SliderContents = slider.SliderContents.Where(c => c.ResourceId != id).ToList();
slider.SliderContents = slider.SliderContents;
//section.Data = JsonConvert.SerializeObject(sliderDTO);
break;
// TODO
@ -556,7 +556,7 @@ namespace ManagerService.Controllers
}*/
// TODO TEEEEEEEEEEESST
//articleDTO.contents = contentsArticleToKeep;
article.ArticleContents = article.ArticleContents.Where(c => c.ResourceId != id).ToList();
article.ArticleContents = article.ArticleContents;
//section.Data = JsonConvert.SerializeObject(articleDTO);
break;
}

View File

@ -0,0 +1,292 @@
using Manager.DTOs;
using Manager.Helpers;
using ManagerService.Data;
using ManagerService.Data.SubSection;
using ManagerService.DTOs;
using ManagerService.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Mqtt.Client.AspNetCore.Services;
using Newtonsoft.Json;
using NSwag.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
namespace ManagerService.Controllers
{
[Authorize] // TODO Add ROLES (Roles = "Admin")
[ApiController, Route("api/[controller]")]
[OpenApiTag("Section agenda", Description = "Section agenda management")]
public class SectionAgendaController : ControllerBase
{
private readonly MyInfoMateDbContext _myInfoMateDbContext;
private readonly ILogger<SectionController> _logger;
private readonly IConfiguration _configuration;
IHexIdGeneratorService idService = new HexIdGeneratorService();
public SectionAgendaController(IConfiguration configuration, ILogger<SectionController> logger, MyInfoMateDbContext myInfoMateDbContext)
{
_logger = logger;
_configuration = configuration;
_myInfoMateDbContext = myInfoMateDbContext;
}
/// <summary>
/// Create a new section
/// </summary>
/// <param name="newSection">New section info</param>
/*[ProducesResponseType(typeof(SectionDTO), 200)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 409)]
[ProducesResponseType(typeof(string), 500)]
[HttpPost()]
public ObjectResult Create([FromBody] SectionDTO newSection)
{
try
{
if (newSection == null)
throw new ArgumentNullException("Section param is null");
if (newSection.configurationId == null)
throw new ArgumentNullException("Configuration param is null");
var configuration = _myInfoMateDbContext.Configurations.FirstOrDefault(c => c.Id == newSection.configurationId);
if (configuration == null)
throw new KeyNotFoundException("Configuration does not exist");
// Todo add some verification ?
Section section = new Section();
// Preparation
List<string> languages = _configuration.GetSection("SupportedLanguages").Get<List<string>>();
switch (newSection.type)
{
case SectionType.Map:
section = new SectionMap
{
MapMapType = MapTypeApp.hybrid,
MapTypeMapbox = MapTypeMapBox.standard,
MapMapProvider = MapProvider.Google,
MapZoom = 18,
MapPoints = new List<GeoPoint>(),
MapCategories = new List<Categorie>()
};
break;
case SectionType.Slider:
section = new SectionSlider
{
SliderContents = new List<Content>()
};
break;
case SectionType.Video:
section = new SectionVideo
{
VideoSource = "",
};
break;
case SectionType.Web:
section = new SectionWeb
{
WebSource = "",
};
break;
case SectionType.Menu:
section = new SectionMenu
{
MenuSections = new List<Section>(),
};
break;
case SectionType.Quiz:
section = new SectionQuiz
{
QuizQuestions = new List<QuizQuestion>(),
// TODO levels ?
};
break;
case SectionType.Article:
section = new SectionArticle
{
ArticleContents = new List<Content>(),
ArticleContent = LanguageInit.Init("Content", languages),
ArticleAudioIds = LanguageInit.Init("Audio", languages, true)
};
break;
case SectionType.PDF:
section = new SectionPdf
{
PDFOrderedTranslationAndResources = []
};
break;
case SectionType.Puzzle:
section = new SectionPuzzle
{
PuzzleMessageDebut = [],
PuzzleMessageFin = []
};
break;
case SectionType.Agenda:
section = new SectionAgenda
{
AgendaResourceIds = new List<Translation>()
};
break;
case SectionType.Weather:
section = new SectionWeather();
break;
}
section.InstanceId = newSection.instanceId;
section.Label = newSection.label;
section.ImageId = newSection.imageId;
section.ImageSource = newSection.imageSource;
section.ConfigurationId = newSection.configurationId;
section.DateCreation = DateTime.Now.ToUniversalTime();
section.IsSubSection = newSection.isSubSection;
section.ParentId = newSection.parentId;
section.Type = newSection.type;
section.Order = _myInfoMateDbContext.Sections.Count(s => s.ConfigurationId == newSection.configurationId && !s.IsSubSection) + 1;
section.IsBeacon = newSection.isBeacon;
section.BeaconId = newSection.beaconId;
section.Latitude = newSection.latitude;
section.Longitude = newSection.longitude;
section.MeterZoneGPS = newSection.meterZoneGPS;
section.Title = LanguageInit.Init("Title", languages);
section.Description = LanguageInit.Init("Description", languages);
section.Id = idService.GenerateHexId();
//_sectionService.Create(section);
_myInfoMateDbContext.Add(section);
_myInfoMateDbContext.SaveChanges();
return new OkObjectResult(section.ToDTO());
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) { };
}
catch (InvalidOperationException ex)
{
return new ConflictObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}*/
/// <summary>
/// Update sections order
/// </summary>
/// <param name="updatedSectionsOrder">New sections order</param>
/*[ProducesResponseType(typeof(string), 200)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpPut("order")]
public ObjectResult UpdateOrder([FromBody] List<SectionDTO> updatedSectionsOrder)
{
// TODO REWRITE LOGIC..
try
{
if (updatedSectionsOrder == null)
throw new ArgumentNullException("Sections param is null");
foreach (var section in updatedSectionsOrder)
{
var sectionDB = _myInfoMateDbContext.Sections.FirstOrDefault(s => s.Id == section.id);
if (sectionDB == null)
throw new KeyNotFoundException($"Section {section.label} with id {section.id} does not exist");
}
foreach (var updatedSection in updatedSectionsOrder)
{
var section = _myInfoMateDbContext.Sections.FirstOrDefault(s => s.Id == updatedSection.id);
//OldSection section = _sectionService.GetById(updatedSection.id);
section.Order = updatedSection.order.GetValueOrDefault();
_myInfoMateDbContext.SaveChanges();
//_sectionService.Update(section.Id, section);
}
if (updatedSectionsOrder.Count > 0) {
MqttClientService.PublishMessage($"config/{updatedSectionsOrder[0].configurationId}", JsonConvert.SerializeObject(new PlayerMessageDTO() { configChanged = true }));
}
return new ObjectResult("Sections order has been successfully modified") { StatusCode = 200 };
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) { };
}
catch (KeyNotFoundException ex)
{
return new NotFoundObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}*/
/// <summary>
/// Delete a section
/// </summary>
/// <param name="id">Id of section to delete</param>
/*[ProducesResponseType(typeof(string), 202)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpDelete("{id}")]
public ObjectResult Delete(string id)
{
try
{
if (id == null)
throw new ArgumentNullException("Section param is null");
var section = _myInfoMateDbContext.Sections.FirstOrDefault(s => s.Id == id);
if (section == null)
throw new KeyNotFoundException("Section does not exist");
_myInfoMateDbContext.Remove(section);
//_sectionService.Remove(id);
// update order from rest // TODO TEST
List<Section> sections = _myInfoMateDbContext.Sections.Where(s => s.ConfigurationId == section.ConfigurationId && !s.IsSubSection).ToList();
int i = 1;
foreach (var sectionDb in sections.OrderBy(s => s.Order))
{
sectionDb.Order = i;
i++;
}
_myInfoMateDbContext.SaveChanges();
return new ObjectResult("The section has been deleted") { StatusCode = 202 };
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) { };
}
catch (KeyNotFoundException ex)
{
return new NotFoundObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}*/
}
}

View File

@ -323,13 +323,13 @@ namespace ManagerService.Controllers
MapMapProvider = MapProvider.Google,
MapZoom = 18,
MapPoints = new List<GeoPoint>(),
MapCategories = new List<Categorie>()
MapCategories = new List<CategorieDTO>()
};
break;
case SectionType.Slider:
section = new SectionSlider
{
SliderContents = new List<Content>()
SliderContents = new List<ContentDTO>()
};
break;
case SectionType.Video:
@ -360,7 +360,7 @@ namespace ManagerService.Controllers
case SectionType.Article:
section = new SectionArticle
{
ArticleContents = new List<Content>(),
ArticleContents = new List<ContentDTO>(),
ArticleContent = LanguageInit.Init("Content", languages),
ArticleAudioIds = LanguageInit.Init("Audio", languages, true)
};
@ -381,7 +381,7 @@ namespace ManagerService.Controllers
case SectionType.Agenda:
section = new SectionAgenda
{
AgendaResourceIds = new List<Translation>()
AgendaResourceIds = new List<TranslationDTO>()
};
break;
case SectionType.Weather:
@ -543,20 +543,25 @@ namespace ManagerService.Controllers
switch (updatedSectionDB)
{
case SectionAgenda agenda:
// TODO in future events
break;
case SectionMap map:
// TODO specific
// TODO Endpoint categories
// TODO Endpoint points
/*map.Categories = [];
map.Points = [];*/
//weather.Latitude = updatedSection.latitude;
break;
case SectionMenu menu:
// TODO Endpoint Sections menu
//menu.Sections = new List<Section>();
break;
case SectionQuiz quiz:
// TODO Endpoint QuizQuestions
quiz.QuizQuestions = [];
break;
@ -568,7 +573,7 @@ namespace ManagerService.Controllers
MqttClientService.PublishMessage($"config/{existingSection.ConfigurationId}", JsonConvert.SerializeObject(new PlayerMessageDTO() { configChanged = true }));
return new OkObjectResult(updatedSectionDB.ToDTO());
return new OkObjectResult(SectionFactory.ToDTO(existingSection));
}
catch (ArgumentNullException ex)
{

View File

@ -0,0 +1,299 @@
using Manager.DTOs;
using ManagerService.Data;
using ManagerService.Data.SubSection;
using ManagerService.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using NSwag.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
namespace ManagerService.Controllers
{
[Authorize] // TODO Add ROLES (Roles = "Admin")
[ApiController, Route("api/[controller]")]
[OpenApiTag("Section map", Description = "Section map management")]
public class SectionMapController : ControllerBase
{
private readonly MyInfoMateDbContext _myInfoMateDbContext;
private readonly ILogger<SectionController> _logger;
private readonly IConfiguration _configuration;
IHexIdGeneratorService idService = new HexIdGeneratorService();
public SectionMapController(IConfiguration configuration, ILogger<SectionController> logger, MyInfoMateDbContext myInfoMateDbContext)
{
_logger = logger;
_configuration = configuration;
_myInfoMateDbContext = myInfoMateDbContext;
}
/// <summary>
/// Get all points from section
/// </summary>
/// <param name="sectionId">Section id</param>
[AllowAnonymous]
[ProducesResponseType(typeof(List<GeoPointDTO>), 200)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpGet("{sectionId}/points")]
public ObjectResult GetAllGeoPointsFromSection(string sectionId)
{
try
{
SectionMap sectionMap = _myInfoMateDbContext.Sections.OfType<SectionMap>().Include(sm => sm.MapPoints).FirstOrDefault(sm => sm.Id == sectionId);
List<GeoPointDTO> geoPointDTOs = new List<GeoPointDTO>();
foreach (var point in sectionMap.MapPoints)
{
foreach (var content in point.Contents) {
var resource = _myInfoMateDbContext.Resources.FirstOrDefault(r => r.Id == content.resourceId);
if (resource != null)
{
content.resource = resource.ToDTO();
}
}
geoPointDTOs.Add(new GeoPointDTO()
{
id = point.Id,
title = point.Title,
description = point.Description,
contents = point.Contents,
categorieId = point.CategorieId,
latitude = point.Latitude,
longitude = point.Longitude,
imageResourceId = point.ImageResourceId,
imageUrl = point.ImageUrl,
schedules = point.Schedules,
prices = point.Prices,
phone = point.Phone,
email = point.Email,
site = point.Site
});
}
return new OkObjectResult(geoPointDTOs);
}
catch (KeyNotFoundException ex)
{
return new NotFoundObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}
/// <summary>
/// Create new point
/// </summary>
/// <param name="sectionId">Section Id</param>
/// <param name="geoPointDTO">geoPoint</param>
[ProducesResponseType(typeof(GeoPoint), 200)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 409)]
[ProducesResponseType(typeof(string), 500)]
[HttpPost("{sectionId}/points")]
public ObjectResult Create(string sectionId, [FromBody] GeoPointDTO geoPointDTO)
{
try
{
if (sectionId == null)
throw new ArgumentNullException("Section param is null");
if (geoPointDTO == null)
throw new ArgumentNullException("GeoPoint is null");
var existingSection = _myInfoMateDbContext.Sections.OfType<SectionMap>().Include(s => s.MapPoints).FirstOrDefault(s => s.Id == sectionId);
if (existingSection == null)
throw new KeyNotFoundException("Section map does not exist");
// TODO verification ?
GeoPoint geoPoint = new GeoPoint();
geoPoint.Title = geoPointDTO.title;
geoPoint.Description = geoPointDTO.description;
geoPoint.Contents = geoPointDTO.contents;
geoPoint.CategorieId = geoPointDTO.categorieId;
geoPoint.Latitude = geoPointDTO.latitude;
geoPoint.Longitude = geoPointDTO.longitude;
geoPoint.ImageResourceId = geoPointDTO.imageResourceId;
geoPoint.ImageUrl = geoPointDTO.imageUrl;
geoPoint.Schedules = geoPointDTO.schedules;
geoPoint.Prices = geoPointDTO.prices;
geoPoint.Phone = geoPointDTO.phone;
geoPoint.Email = geoPointDTO.email;
geoPoint.Site = geoPointDTO.site;
if (existingSection.MapPoints == null)
{
existingSection.MapPoints = [];
}
existingSection.MapPoints.Add(geoPoint);
_myInfoMateDbContext.SaveChanges();
return new OkObjectResult(geoPoint);
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) { };
}
catch (InvalidOperationException ex)
{
return new ConflictObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}
/// <summary>
/// Update a geo point
/// </summary>
/// <param name="updatedGeoPoint">GeoPoint to update</param>
[ProducesResponseType(typeof(GeoPoint), 200)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpPut]
public ObjectResult Update([FromBody] GeoPointDTO geoPointDTO)
{
try
{
if (geoPointDTO == null)
throw new ArgumentNullException("GeoPoint param is null");
var existingGeoPoint = _myInfoMateDbContext.GeoPoints.FirstOrDefault(gp => gp.Id == geoPointDTO.id);
if (existingGeoPoint == null)
throw new KeyNotFoundException("GeoPoint does not exist");
existingGeoPoint.Title = geoPointDTO.title;
existingGeoPoint.Description = geoPointDTO.description;
existingGeoPoint.Contents = geoPointDTO.contents;
existingGeoPoint.CategorieId = geoPointDTO.categorieId;
existingGeoPoint.Latitude = geoPointDTO.latitude;
existingGeoPoint.Longitude = geoPointDTO.longitude;
existingGeoPoint.ImageResourceId = geoPointDTO.imageResourceId;
existingGeoPoint.ImageUrl = geoPointDTO.imageUrl;
existingGeoPoint.Schedules = geoPointDTO.schedules;
existingGeoPoint.Prices = geoPointDTO.prices;
existingGeoPoint.Phone = geoPointDTO.phone;
existingGeoPoint.Email = geoPointDTO.email;
existingGeoPoint.Site = geoPointDTO.site;
_myInfoMateDbContext.SaveChanges();
return new OkObjectResult(existingGeoPoint);
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) { };
}
catch (KeyNotFoundException ex)
{
return new NotFoundObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}
/// <summary>
/// Update sections order
/// </summary>
/// <param name="updatedSectionsOrder">New sections order</param>
/*[ProducesResponseType(typeof(string), 200)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpPut("order")]
public ObjectResult UpdateOrder([FromBody] List<SectionDTO> updatedSectionsOrder)
{
// TODO REWRITE LOGIC..
try
{
if (updatedSectionsOrder == null)
throw new ArgumentNullException("Sections param is null");
foreach (var section in updatedSectionsOrder)
{
var sectionDB = _myInfoMateDbContext.Sections.FirstOrDefault(s => s.Id == section.id);
if (sectionDB == null)
throw new KeyNotFoundException($"Section {section.label} with id {section.id} does not exist");
}
foreach (var updatedSection in updatedSectionsOrder)
{
var section = _myInfoMateDbContext.Sections.FirstOrDefault(s => s.Id == updatedSection.id);
//OldSection section = _sectionService.GetById(updatedSection.id);
section.Order = updatedSection.order.GetValueOrDefault();
_myInfoMateDbContext.SaveChanges();
//_sectionService.Update(section.Id, section);
}
if (updatedSectionsOrder.Count > 0) {
MqttClientService.PublishMessage($"config/{updatedSectionsOrder[0].configurationId}", JsonConvert.SerializeObject(new PlayerMessageDTO() { configChanged = true }));
}
return new ObjectResult("Sections order has been successfully modified") { StatusCode = 200 };
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) { };
}
catch (KeyNotFoundException ex)
{
return new NotFoundObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}*/
/// <summary>
/// Delete a geopoint
/// </summary>
/// <param name="geoPointId">Id of geopoint to delete</param>
[ProducesResponseType(typeof(string), 202)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpDelete("points/delete/{geoPointId}")]
public ObjectResult Delete(int geoPointId)
{
try
{
var geoPoint = _myInfoMateDbContext.GeoPoints.FirstOrDefault(gp => gp.Id == geoPointId);
if (geoPoint == null)
throw new KeyNotFoundException("GeoPoint does not exist");
_myInfoMateDbContext.Remove(geoPoint);
_myInfoMateDbContext.SaveChanges();
return new ObjectResult("The geopoint has been deleted") { StatusCode = 202 };
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) { };
}
catch (KeyNotFoundException ex)
{
return new NotFoundObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}
}
}

View File

@ -0,0 +1,292 @@
using Manager.DTOs;
using Manager.Helpers;
using ManagerService.Data;
using ManagerService.Data.SubSection;
using ManagerService.DTOs;
using ManagerService.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Mqtt.Client.AspNetCore.Services;
using Newtonsoft.Json;
using NSwag.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
namespace ManagerService.Controllers
{
[Authorize] // TODO Add ROLES (Roles = "Admin")
[ApiController, Route("api/[controller]")]
[OpenApiTag("Section menu", Description = "Section menu management")]
public class SectionMenuController : ControllerBase
{
private readonly MyInfoMateDbContext _myInfoMateDbContext;
private readonly ILogger<SectionController> _logger;
private readonly IConfiguration _configuration;
IHexIdGeneratorService idService = new HexIdGeneratorService();
public SectionMenuController(IConfiguration configuration, ILogger<SectionController> logger, MyInfoMateDbContext myInfoMateDbContext)
{
_logger = logger;
_configuration = configuration;
_myInfoMateDbContext = myInfoMateDbContext;
}
/// <summary>
/// Create a new section
/// </summary>
/// <param name="newSection">New section info</param>
/*[ProducesResponseType(typeof(SectionDTO), 200)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 409)]
[ProducesResponseType(typeof(string), 500)]
[HttpPost()]
public ObjectResult Create([FromBody] SectionDTO newSection)
{
try
{
if (newSection == null)
throw new ArgumentNullException("Section param is null");
if (newSection.configurationId == null)
throw new ArgumentNullException("Configuration param is null");
var configuration = _myInfoMateDbContext.Configurations.FirstOrDefault(c => c.Id == newSection.configurationId);
if (configuration == null)
throw new KeyNotFoundException("Configuration does not exist");
// Todo add some verification ?
Section section = new Section();
// Preparation
List<string> languages = _configuration.GetSection("SupportedLanguages").Get<List<string>>();
switch (newSection.type)
{
case SectionType.Map:
section = new SectionMap
{
MapMapType = MapTypeApp.hybrid,
MapTypeMapbox = MapTypeMapBox.standard,
MapMapProvider = MapProvider.Google,
MapZoom = 18,
MapPoints = new List<GeoPoint>(),
MapCategories = new List<Categorie>()
};
break;
case SectionType.Slider:
section = new SectionSlider
{
SliderContents = new List<Content>()
};
break;
case SectionType.Video:
section = new SectionVideo
{
VideoSource = "",
};
break;
case SectionType.Web:
section = new SectionWeb
{
WebSource = "",
};
break;
case SectionType.Menu:
section = new SectionMenu
{
MenuSections = new List<Section>(),
};
break;
case SectionType.Quiz:
section = new SectionQuiz
{
QuizQuestions = new List<QuizQuestion>(),
// TODO levels ?
};
break;
case SectionType.Article:
section = new SectionArticle
{
ArticleContents = new List<Content>(),
ArticleContent = LanguageInit.Init("Content", languages),
ArticleAudioIds = LanguageInit.Init("Audio", languages, true)
};
break;
case SectionType.PDF:
section = new SectionPdf
{
PDFOrderedTranslationAndResources = []
};
break;
case SectionType.Puzzle:
section = new SectionPuzzle
{
PuzzleMessageDebut = [],
PuzzleMessageFin = []
};
break;
case SectionType.Agenda:
section = new SectionAgenda
{
AgendaResourceIds = new List<Translation>()
};
break;
case SectionType.Weather:
section = new SectionWeather();
break;
}
section.InstanceId = newSection.instanceId;
section.Label = newSection.label;
section.ImageId = newSection.imageId;
section.ImageSource = newSection.imageSource;
section.ConfigurationId = newSection.configurationId;
section.DateCreation = DateTime.Now.ToUniversalTime();
section.IsSubSection = newSection.isSubSection;
section.ParentId = newSection.parentId;
section.Type = newSection.type;
section.Order = _myInfoMateDbContext.Sections.Count(s => s.ConfigurationId == newSection.configurationId && !s.IsSubSection) + 1;
section.IsBeacon = newSection.isBeacon;
section.BeaconId = newSection.beaconId;
section.Latitude = newSection.latitude;
section.Longitude = newSection.longitude;
section.MeterZoneGPS = newSection.meterZoneGPS;
section.Title = LanguageInit.Init("Title", languages);
section.Description = LanguageInit.Init("Description", languages);
section.Id = idService.GenerateHexId();
//_sectionService.Create(section);
_myInfoMateDbContext.Add(section);
_myInfoMateDbContext.SaveChanges();
return new OkObjectResult(section.ToDTO());
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) { };
}
catch (InvalidOperationException ex)
{
return new ConflictObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}*/
/// <summary>
/// Update sections order
/// </summary>
/// <param name="updatedSectionsOrder">New sections order</param>
/*[ProducesResponseType(typeof(string), 200)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpPut("order")]
public ObjectResult UpdateOrder([FromBody] List<SectionDTO> updatedSectionsOrder)
{
// TODO REWRITE LOGIC..
try
{
if (updatedSectionsOrder == null)
throw new ArgumentNullException("Sections param is null");
foreach (var section in updatedSectionsOrder)
{
var sectionDB = _myInfoMateDbContext.Sections.FirstOrDefault(s => s.Id == section.id);
if (sectionDB == null)
throw new KeyNotFoundException($"Section {section.label} with id {section.id} does not exist");
}
foreach (var updatedSection in updatedSectionsOrder)
{
var section = _myInfoMateDbContext.Sections.FirstOrDefault(s => s.Id == updatedSection.id);
//OldSection section = _sectionService.GetById(updatedSection.id);
section.Order = updatedSection.order.GetValueOrDefault();
_myInfoMateDbContext.SaveChanges();
//_sectionService.Update(section.Id, section);
}
if (updatedSectionsOrder.Count > 0) {
MqttClientService.PublishMessage($"config/{updatedSectionsOrder[0].configurationId}", JsonConvert.SerializeObject(new PlayerMessageDTO() { configChanged = true }));
}
return new ObjectResult("Sections order has been successfully modified") { StatusCode = 200 };
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) { };
}
catch (KeyNotFoundException ex)
{
return new NotFoundObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}*/
/// <summary>
/// Delete a section
/// </summary>
/// <param name="id">Id of section to delete</param>
/*[ProducesResponseType(typeof(string), 202)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpDelete("{id}")]
public ObjectResult Delete(string id)
{
try
{
if (id == null)
throw new ArgumentNullException("Section param is null");
var section = _myInfoMateDbContext.Sections.FirstOrDefault(s => s.Id == id);
if (section == null)
throw new KeyNotFoundException("Section does not exist");
_myInfoMateDbContext.Remove(section);
//_sectionService.Remove(id);
// update order from rest // TODO TEST
List<Section> sections = _myInfoMateDbContext.Sections.Where(s => s.ConfigurationId == section.ConfigurationId && !s.IsSubSection).ToList();
int i = 1;
foreach (var sectionDb in sections.OrderBy(s => s.Order))
{
sectionDb.Order = i;
i++;
}
_myInfoMateDbContext.SaveChanges();
return new ObjectResult("The section has been deleted") { StatusCode = 202 };
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) { };
}
catch (KeyNotFoundException ex)
{
return new NotFoundObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}*/
}
}

View File

@ -0,0 +1,267 @@
using Manager.DTOs;
using Manager.Helpers;
using ManagerService.Data;
using ManagerService.Data.SubSection;
using ManagerService.DTOs;
using ManagerService.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Mqtt.Client.AspNetCore.Services;
using Newtonsoft.Json;
using NSwag.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text.Json;
namespace ManagerService.Controllers
{
[Authorize] // TODO Add ROLES (Roles = "Admin")
[ApiController, Route("api/[controller]")]
[OpenApiTag("Section quiz", Description = "Section quiz management")]
public class SectionQuizController : ControllerBase
{
private readonly MyInfoMateDbContext _myInfoMateDbContext;
private readonly ILogger<SectionController> _logger;
private readonly IConfiguration _configuration;
IHexIdGeneratorService idService = new HexIdGeneratorService();
public SectionQuizController(IConfiguration configuration, ILogger<SectionController> logger, MyInfoMateDbContext myInfoMateDbContext)
{
_logger = logger;
_configuration = configuration;
_myInfoMateDbContext = myInfoMateDbContext;
}
/// <summary>
/// Get all quiz questions from section
/// </summary>
/// <param name="sectionId">Section id</param>
[AllowAnonymous]
[ProducesResponseType(typeof(List<QuestionDTO>), 200)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpGet("{sectionId}/questions")]
public ObjectResult GetAllQuizQuestionFromSection(string sectionId)
{
try
{
SectionQuiz sectionQuiz = _myInfoMateDbContext.Sections.OfType<SectionQuiz>().Include(sq => sq.QuizQuestions).ThenInclude(qq => qq.Resource).FirstOrDefault(sq => sq.Id == sectionId);
List<QuestionDTO> questionDTOs = new List<QuestionDTO>();
foreach (var question in sectionQuiz.QuizQuestions)
{
questionDTOs.Add(new QuestionDTO()
{
id = question.Id,
label = question.Label,
responses = question.Responses,
imageBackgroundResourceId = question.ResourceId,
imageBackgroundResourceType = question.Resource.Type,
imageBackgroundResourceUrl = question.Resource.Url,
order = question.Order
});
}
return new OkObjectResult(questionDTOs);
}
catch (KeyNotFoundException ex)
{
return new NotFoundObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}
/// <summary>
/// Create new question
/// </summary>
/// <param name="sectionId">Section Id</param>
/// <param name="questionDTO">question</param>
[ProducesResponseType(typeof(QuizQuestion), 200)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 409)]
[ProducesResponseType(typeof(string), 500)]
[HttpPost("{sectionId}/questions")]
public ObjectResult Create(string sectionId, [FromBody] QuestionDTO questionDTO)
{
try
{
if (sectionId == null)
throw new ArgumentNullException("Section param is null");
if (questionDTO == null)
throw new ArgumentNullException("Question is null");
var existingSection = _myInfoMateDbContext.Sections.OfType<SectionQuiz>().Include(sq => sq.QuizQuestions).ThenInclude(qq => qq.Resource).FirstOrDefault(sq => sq.Id == sectionId);
if (existingSection == null)
throw new KeyNotFoundException("Section quiz does not exist");
// TODO verification ?
QuizQuestion quizQuestion = new QuizQuestion();
quizQuestion.Label = questionDTO.label;
quizQuestion.Responses = questionDTO.responses;
quizQuestion.ResourceId = questionDTO.imageBackgroundResourceId;
quizQuestion.Order = questionDTO.order;
existingSection.QuizQuestions.Add(quizQuestion);
_myInfoMateDbContext.SaveChanges();
return new OkObjectResult(quizQuestion);
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) { };
}
catch (InvalidOperationException ex)
{
return new ConflictObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}
/// <summary>
/// Update a quiz question
/// </summary>
/// <param name="updatedQuizQuestion">QuizQuestion to update</param>
[ProducesResponseType(typeof(QuizQuestion), 200)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpPut]
public ObjectResult Update([FromBody] QuestionDTO questionDTO)
{
try
{
if (questionDTO == null)
throw new ArgumentNullException("Question param is null");
var existingQuestion = _myInfoMateDbContext.QuizQuestions.FirstOrDefault(qq => qq.Id == questionDTO.id);
if (existingQuestion == null)
throw new KeyNotFoundException("Question quiz does not exist");
existingQuestion.Label = questionDTO.label;
existingQuestion.Responses = questionDTO.responses;
existingQuestion.Order = questionDTO.order;
existingQuestion.ResourceId = questionDTO.imageBackgroundResourceId;
_myInfoMateDbContext.SaveChanges();
return new OkObjectResult(existingQuestion);
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) { };
}
catch (KeyNotFoundException ex)
{
return new NotFoundObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}
/// <summary>
/// Update sections order
/// </summary>
/// <param name="updatedSectionsOrder">New sections order</param>
/*[ProducesResponseType(typeof(string), 200)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpPut("order")]
public ObjectResult UpdateOrder([FromBody] List<SectionDTO> updatedSectionsOrder)
{
// TODO REWRITE LOGIC..
try
{
if (updatedSectionsOrder == null)
throw new ArgumentNullException("Sections param is null");
foreach (var section in updatedSectionsOrder)
{
var sectionDB = _myInfoMateDbContext.Sections.FirstOrDefault(s => s.Id == section.id);
if (sectionDB == null)
throw new KeyNotFoundException($"Section {section.label} with id {section.id} does not exist");
}
foreach (var updatedSection in updatedSectionsOrder)
{
var section = _myInfoMateDbContext.Sections.FirstOrDefault(s => s.Id == updatedSection.id);
//OldSection section = _sectionService.GetById(updatedSection.id);
section.Order = updatedSection.order.GetValueOrDefault();
_myInfoMateDbContext.SaveChanges();
//_sectionService.Update(section.Id, section);
}
if (updatedSectionsOrder.Count > 0) {
MqttClientService.PublishMessage($"config/{updatedSectionsOrder[0].configurationId}", JsonConvert.SerializeObject(new PlayerMessageDTO() { configChanged = true }));
}
return new ObjectResult("Sections order has been successfully modified") { StatusCode = 200 };
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) { };
}
catch (KeyNotFoundException ex)
{
return new NotFoundObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}*/
/// <summary>
/// Delete a quiz question
/// </summary>
/// <param name="quizQuestionId">Id of quizQuestion to delete</param>
[ProducesResponseType(typeof(string), 202)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpDelete("questions/delete/{quizQuestionId}")]
public ObjectResult Delete(int quizQuestionId)
{
try
{
var quizQuestion = _myInfoMateDbContext.QuizQuestions.FirstOrDefault(qq => qq.Id == quizQuestionId);
if (quizQuestion == null)
throw new KeyNotFoundException("QuizQuestion does not exist");
_myInfoMateDbContext.Remove(quizQuestion);
_myInfoMateDbContext.SaveChanges();
return new ObjectResult("The quiz question has been deleted") { StatusCode = 202 };
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) { };
}
catch (KeyNotFoundException ex)
{
return new NotFoundObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}
}
}

View File

@ -1,4 +1,5 @@
using ManagerService.Data;
using ManagerService.Data.SubSection;
using ManagerService.DTOs;
using System.Collections.Generic;
@ -23,8 +24,7 @@ namespace Manager.DTOs
public int? id { get; set; }
public List<TranslationDTO> title { get; set; }
public List<TranslationDTO> description { get; set; }
public List<ContentGeoPoint> contents { get; set; }
public CategorieDTO categorie { get; set; } // TO DELETE IN FUTURE
public List<ContentDTO> contents { get; set; }
public int? categorieId { get; set; }
public string latitude { get; set; }
public string longitude { get; set; }
@ -46,13 +46,13 @@ namespace Manager.DTOs
public int? order { get; set; } // Order to show
}
public class ContentGeoPoint
/*public class ContentGeoPoint
{
public string resourceId { get; set; }
public ResourceType resourceType { get; set; }
public string resourceUrl { get; set; } // url to firebase storage or on internet
public string resourceName { get; set; }
}
}*/
public enum MapTypeApp
{

View File

@ -1,6 +1,6 @@
using ManagerService.DTOs;
using ManagerService.Data;
using ManagerService.DTOs;
using System.Collections.Generic;
using System.Security.AccessControl;
namespace Manager.DTOs
{
@ -15,6 +15,7 @@ namespace Manager.DTOs
public class QuestionDTO
{
public int id { get; set; }
public List<TranslationAndResourceDTO> label { get; set; }
public List<ResponseDTO> responses { get; set; }
public string imageBackgroundResourceId { get; set; } // question image background

View File

@ -30,7 +30,7 @@ namespace ManagerService.Data
[BsonRequired]*/
[Required]
[Column(TypeName = "jsonb")]
public List<Translation> Title { get; set; }
public List<TranslationDTO> Title { get; set; }
/*[BsonElement("ImageId")]*/
public string ImageId { get; set; }
@ -91,7 +91,7 @@ namespace ManagerService.Data
{
id = Id,
label = Label,
title = Title.Select(c => c.ToDTO()).ToList(),
title = Title,
imageId = ImageId,
imageSource = ImageSource,
loaderImageId = LoaderImageId,
@ -118,7 +118,7 @@ namespace ManagerService.Data
{
id = Id,
label = Label,
title= Title.Select(c => c.ToDTO()).ToList(),
title= Title,
imageId = ImageId,
imageSource = ImageSource,
loaderImageId = LoaderImageId,

View File

@ -14,6 +14,12 @@ namespace ManagerService.Data
public DbSet<Resource> Resources { get; set; }
public DbSet<User> Users { get; set; }
// MAP
public DbSet<GeoPoint> GeoPoints { get; set; }
// QUIZ
public DbSet<QuizQuestion> QuizQuestions { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);

View File

@ -23,10 +23,10 @@ namespace ManagerService.Data
[Required]
[Column(TypeName = "jsonb")]
public List<Translation> Title { get; set; }
public List<TranslationDTO> Title { get; set; }
[Column(TypeName = "jsonb")]
public List<Translation> Description { get; set; }
public List<TranslationDTO> Description { get; set; }
public int Order { get; set; }
@ -66,8 +66,8 @@ namespace ManagerService.Data
{
id = Id,
label = Label,
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
description = Description.OrderBy(d => d.Language).Select(l => l.ToDTO()).ToList(),
title = Title,
description = Description,
order = Order,
type = Type,
imageId = ImageId,

View File

@ -19,11 +19,11 @@ namespace ManagerService.Data.SubSection
[Required]
[Column(TypeName = "jsonb")]
public List<Translation> Title { get; set; }
public List<TranslationDTO> Title { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<Translation> Description { get; set; }
public List<TranslationDTO> Description { get; set; }
public string ResourceId { get; set; }
public Resource Resource { get; set; }
@ -34,8 +34,8 @@ namespace ManagerService.Data.SubSection
{
return new ContentDTO()
{
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
description = Description.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
title = Title.ToList(),
description = Description,
order = Order,
resourceId = ResourceId,
resource = Resource.ToDTO()
@ -46,8 +46,8 @@ namespace ManagerService.Data.SubSection
{
return new Content()
{
Title = contentDTO.title.Select(t => new Translation().FromDTO(t)).ToList(),
Description = contentDTO.description.Select(t => new Translation().FromDTO(t)).ToList(),
Title = contentDTO.title,
Description = contentDTO.description,
Order = contentDTO.order,
ResourceId = contentDTO.resourceId
};

View File

@ -16,7 +16,7 @@ namespace ManagerService.Data.SubSection
{
[Required]
[Column(TypeName = "jsonb")]
public List<Translation> AgendaResourceIds { get; set; } // All json files for all languages
public List<TranslationDTO> AgendaResourceIds { get; set; } // All json files for all languages
public MapProvider? AgendaMapProvider { get; set; } // Default = Google
@ -26,8 +26,8 @@ namespace ManagerService.Data.SubSection
{
id = Id,
label = Label,
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
description = Description.OrderBy(d => d.Language).Select(l => l.ToDTO()).ToList(),
title = Title.ToList(),
description = Description.ToList(),
order = Order,
type = Type,
imageId = ImageId,
@ -42,7 +42,7 @@ namespace ManagerService.Data.SubSection
latitude = Latitude,
longitude = Longitude,
meterZoneGPS = MeterZoneGPS,
resourceIds = AgendaResourceIds.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
resourceIds = AgendaResourceIds,
agendaMapProvider = AgendaMapProvider
};
}

View File

@ -16,18 +16,19 @@ namespace ManagerService.Data.SubSection
{
[Required]
[Column(TypeName = "jsonb")]
public List<Translation> ArticleContent { get; set; }
public List<TranslationDTO> ArticleContent { get; set; }
public bool ArticleIsContentTop { get; set; } // MyVisit - True if content is displayed at top, false otherwise
[Required]
[Column(TypeName = "jsonb")]
public List<Translation> ArticleAudioIds { get; set; }
public List<TranslationDTO> ArticleAudioIds { get; set; }
public bool ArticleIsReadAudioAuto { get; set; } // MyVisit - True for audio play when open the article / false otherwise
[Required]
public List<Content> ArticleContents { get; set; }
[Column(TypeName = "jsonb")]
public List<ContentDTO> ArticleContents { get; set; }
public ArticleDTO ToDTO()
{
@ -35,8 +36,8 @@ namespace ManagerService.Data.SubSection
{
id = Id,
label = Label,
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
description = Description.OrderBy(d => d.Language).Select(l => l.ToDTO()).ToList(),
title = Title,
description = Description,
order = Order,
type = Type,
imageId = ImageId,
@ -51,11 +52,11 @@ namespace ManagerService.Data.SubSection
latitude = Latitude,
longitude = Longitude,
meterZoneGPS = MeterZoneGPS,
content = ArticleContent.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
content = ArticleContent,
isContentTop = ArticleIsContentTop,
audioIds = ArticleAudioIds.Select(a=> a.ToDTO()).ToList(),
audioIds = ArticleAudioIds,
isReadAudioAuto = ArticleIsReadAudioAuto,
contents = ArticleContents.Select(c => c.ToDTO()).ToList(),
contents = ArticleContents,
};
}
}

View File

@ -21,7 +21,9 @@ namespace ManagerService.Data.SubSection
public List<GeoPoint> MapPoints { get; set; }
public string MapResourceId { get; set; }
public Resource MapResource { get; set; } // Icon
public List<Categorie> MapCategories { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<CategorieDTO> MapCategories { get; set; }
public string MapCenterLatitude { get; set; } // Center on
public string MapCenterLongitude { get; set; } // Center on
@ -32,8 +34,8 @@ namespace ManagerService.Data.SubSection
{
id = Id,
label = Label,
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
description = Description.OrderBy(d => d.Language).Select(l => l.ToDTO()).ToList(),
title = Title.ToList(),
description = Description.ToList(),
order = Order,
type = Type,
imageId = ImageId,
@ -52,9 +54,8 @@ namespace ManagerService.Data.SubSection
mapType = MapMapType,
mapTypeMapbox = MapTypeMapbox,
mapProvider = MapMapProvider,
//points = Points.Select(p => p.ToDTO()).ToList(), // TODO
iconResourceId = MapResourceId,
categories = MapCategories.Select(c => c.ToDTO()).ToList(),
categories = MapCategories,
centerLatitude = MapCenterLatitude,
centerLongitude = MapCenterLongitude
};
@ -68,16 +69,15 @@ namespace ManagerService.Data.SubSection
[Required]
[Column(TypeName = "jsonb")]
public List<Translation> Title { get; set; }
public List<TranslationDTO> Title { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<Translation> Description { get; set; }
public List<TranslationDTO> Description { get; set; }
//TODO
[Required]
[Column(TypeName = "jsonb")]
public List<Resource> Contents { get; set; } // Contentsgeopoint
public List<ContentDTO> Contents { get; set; }
public int? CategorieId { get; set; }

View File

@ -23,8 +23,8 @@ namespace ManagerService.Data.SubSection
{
id = Id,
label = Label,
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
description = Description.OrderBy(d => d.Language).Select(l => l.ToDTO()).ToList(),
title = Title.ToList(),
description = Description.ToList(),
order = Order,
type = Type,
imageId = ImageId,

View File

@ -1,6 +1,8 @@
using Manager.DTOs;
using ManagerService.DTOs;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
@ -12,7 +14,8 @@ namespace ManagerService.Data.SubSection
public class SectionPdf : Section
{
[Required]
public List<OrderedTranslationAndResource> PDFOrderedTranslationAndResources { get; set; } // All json files for all languages
[Column(TypeName = "jsonb")]
public List<OrderedTranslationAndResourceDTO> PDFOrderedTranslationAndResources { get; set; } // All json files for all languages
public PdfDTO ToDTO()
{
@ -20,8 +23,8 @@ namespace ManagerService.Data.SubSection
{
id = Id,
label = Label,
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
description = Description.OrderBy(d => d.Language).Select(l => l.ToDTO()).ToList(),
title = Title.ToList(),
description = Description.ToList(),
order = Order,
type = Type,
imageId = ImageId,
@ -36,7 +39,7 @@ namespace ManagerService.Data.SubSection
latitude = Latitude,
longitude = Longitude,
meterZoneGPS = MeterZoneGPS,
pdfs = PDFOrderedTranslationAndResources.Select(otar => otar.ToDTO()).ToList()
pdfs = PDFOrderedTranslationAndResources
};
}
}

View File

@ -38,8 +38,8 @@ namespace ManagerService.Data.SubSection
{
id = Id,
label = Label,
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
description = Description.OrderBy(d => d.Language).Select(l => l.ToDTO()).ToList(),
title = Title.ToList(),
description = Description.ToList(),
order = Order,
type = Type,
imageId = ImageId,

View File

@ -19,19 +19,19 @@ namespace ManagerService.Data.SubSection
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationAndResource> QuizBadLevel { get; set; }
public List<TranslationAndResourceDTO> QuizBadLevel { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationAndResource> QuizMediumLevel { get; set; }
public List<TranslationAndResourceDTO> QuizMediumLevel { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationAndResource> QuizGoodLevel { get; set; }
public List<TranslationAndResourceDTO> QuizGoodLevel { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationAndResource> QuizGreatLevel { get; set; }
public List<TranslationAndResourceDTO> QuizGreatLevel { get; set; }
public QuizDTO ToDTO()
@ -40,8 +40,8 @@ namespace ManagerService.Data.SubSection
{
id = Id,
label = Label,
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
description = Description.OrderBy(d => d.Language).Select(l => l.ToDTO()).ToList(),
title = Title.ToList(),
description = Description.ToList(),
order = Order,
type = Type,
imageId = ImageId,
@ -56,8 +56,10 @@ namespace ManagerService.Data.SubSection
latitude = Latitude,
longitude = Longitude,
meterZoneGPS = MeterZoneGPS,
//questions = Questions.Select(q => q.tod)
// TODO
bad_level = QuizBadLevel.ToList(),
medium_level = QuizMediumLevel.ToList(),
good_level = QuizGoodLevel.ToList(),
great_level = QuizGreatLevel.ToList()
};
}
}

View File

@ -15,7 +15,8 @@ namespace ManagerService.Data.SubSection
public class SectionSlider : Section
{
[Required]
public List<Content> SliderContents { get; set; } // TODO check
[Column(TypeName = "jsonb")]
public List<ContentDTO> SliderContents { get; set; } // TODO check
public SliderDTO ToDTO()
{
@ -23,8 +24,8 @@ namespace ManagerService.Data.SubSection
{
id = Id,
label = Label,
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
description = Description.OrderBy(d => d.Language).Select(l => l.ToDTO()).ToList(),
title = Title,
description = Description,
order = Order,
type = Type,
imageId = ImageId,
@ -39,7 +40,7 @@ namespace ManagerService.Data.SubSection
latitude = Latitude,
longitude = Longitude,
meterZoneGPS = MeterZoneGPS,
contents = SliderContents.Select(c => c.ToDTO()).ToList(),
contents = SliderContents,
};
}
}

View File

@ -18,8 +18,8 @@ namespace ManagerService.Data.SubSection
{
id = Id,
label = Label,
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
description = Description.OrderBy(d => d.Language).Select(l => l.ToDTO()).ToList(),
title = Title.ToList(),
description = Description.ToList(),
order = Order,
type = Type,
imageId = ImageId,

View File

@ -26,8 +26,8 @@ namespace ManagerService.Data.SubSection
{
id = Id,
label = Label,
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
description = Description.OrderBy(d => d.Language).Select(l => l.ToDTO()).ToList(),
title = Title.ToList(),
description = Description.ToList(),
order = Order,
type = Type,
imageId = ImageId,

View File

@ -19,8 +19,8 @@ namespace ManagerService.Data.SubSection
{
id = Id,
label = Label,
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
description = Description.OrderBy(d => d.Language).Select(l => l.ToDTO()).ToList(),
title = Title.ToList(),
description = Description.ToList(),
order = Order,
type = Type,
imageId = ImageId,

View File

@ -1,5 +1,4 @@
using ManagerService.DTOs;
using System;
using System.ComponentModel.DataAnnotations;
namespace ManagerService.Data.SubSection

View File

@ -1,18 +1,18 @@
using System.Collections.Generic;
using ManagerService.Data.SubSection;
using ManagerService.DTOs;
namespace Manager.Helpers
{
public class LanguageInit
{
public static List<Translation> Init(string label, List<string> languages, bool toNull = false)
public static List<TranslationDTO> Init(string label, List<string> languages, bool toNull = false)
{
List<Translation> translations = new List<Translation>();
List<TranslationDTO> translations = new List<TranslationDTO>();
foreach (var language in languages)
{
var value = toNull ? null : $"{language} - {label}";
translations.Add(new Translation() { Language = language.ToUpper(), Value = value });
translations.Add(new TranslationDTO() { language = language.ToUpper(), value = value });
}
return translations;
}

View File

@ -0,0 +1,828 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using Manager.DTOs;
using ManagerService.DTOs;
using ManagerService.Data;
using ManagerService.Data.SubSection;
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("20250324140608_UpdateMix2")]
partial class UpdateMix2
{
/// <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.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>("IsDate")
.HasColumnType("boolean");
b.Property<bool>("IsHour")
.HasColumnType("boolean");
b.Property<bool>("IsMobile")
.HasColumnType("boolean");
b.Property<bool>("IsOffline")
.HasColumnType("boolean");
b.Property<bool>("IsSectionImageBackground")
.HasColumnType("boolean");
b.Property<bool>("IsTablet")
.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<int?>("RoundedValue")
.HasColumnType("integer");
b.Property<int?>("ScreenPercentageSectionsMainPage")
.HasColumnType("integer");
b.Property<string>("SecondaryColor")
.HasColumnType("text");
b.Property<List<Translation>>("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")
.IsRequired()
.HasColumnType("text");
b.Property<string>("IpAddressWLAN")
.IsRequired()
.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<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<int?>("GeoPointId")
.HasColumnType("integer");
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.HasIndex("GeoPointId");
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<List<Translation>>("Description")
.HasColumnType("jsonb");
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("character varying(8)");
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<List<Translation>>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int>("Type")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("SectionMenuId");
b.ToTable("Sections");
b.HasDiscriminator().HasValue("Base");
b.UseTphMappingStrategy();
});
modelBuilder.Entity("ManagerService.Data.SubSection.Categorie", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Icon")
.HasColumnType("text");
b.Property<List<Translation>>("Label")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int?>("Order")
.HasColumnType("integer");
b.Property<string>("ResourceId")
.HasColumnType("text");
b.Property<string>("SectionMapId")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ResourceId");
b.HasIndex("SectionMapId");
b.ToTable("Categorie");
});
modelBuilder.Entity("ManagerService.Data.SubSection.Content", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<List<Translation>>("Description")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("ResourceId")
.HasColumnType("text");
b.Property<string>("SectionArticleId")
.HasColumnType("text");
b.Property<string>("SectionSliderId")
.HasColumnType("text");
b.Property<List<Translation>>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("ResourceId");
b.HasIndex("SectionArticleId");
b.HasIndex("SectionSliderId");
b.ToTable("Content");
});
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<List<Translation>>("Description")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationDTO>>("Email")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("ImageResourceId")
.HasColumnType("text");
b.Property<string>("ImageUrl")
.HasColumnType("text");
b.Property<string>("Latitude")
.HasColumnType("text");
b.Property<string>("Longitude")
.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")
.HasColumnType("text");
b.Property<List<TranslationDTO>>("Site")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("SectionMapId");
b.ToTable("GeoPoint");
});
modelBuilder.Entity("ManagerService.Data.SubSection.OrderedTranslationAndResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("SectionPdfId")
.HasColumnType("text");
b.Property<List<TranslationAndResource>>("TranslationAndResources")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("SectionPdfId");
b.ToTable("OrderedTranslationAndResource");
});
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("QuizQuestion");
});
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<Translation>>("AgendaResourceIds")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("Agenda");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionArticle", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<Translation>>("ArticleAudioIds")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("ArticleContent")
.IsRequired()
.HasColumnType("jsonb");
b.Property<bool>("ArticleIsContentTop")
.HasColumnType("boolean");
b.Property<bool>("ArticleIsReadAudioAuto")
.HasColumnType("boolean");
b.HasDiscriminator().HasValue("Article");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b =>
{
b.HasBaseType("ManagerService.Data.Section");
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.HasDiscriminator().HasValue("PDF");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionPuzzle", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<int>("PuzzleCols")
.HasColumnType("integer");
b.Property<string>("PuzzleImageId")
.HasColumnType("text");
b.Property<List<TranslationAndResource>>("PuzzleMessageDebut")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("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<TranslationAndResource>>("QuizBadLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizGoodLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizGreatLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizMediumLevel")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("Quiz");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionSlider", b =>
{
b.HasBaseType("ManagerService.Data.Section");
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.Resource", b =>
{
b.HasOne("ManagerService.Data.SubSection.GeoPoint", null)
.WithMany("Contents")
.HasForeignKey("GeoPointId");
});
modelBuilder.Entity("ManagerService.Data.Section", b =>
{
b.HasOne("ManagerService.Data.SubSection.SectionMenu", null)
.WithMany("MenuSections")
.HasForeignKey("SectionMenuId");
});
modelBuilder.Entity("ManagerService.Data.SubSection.Categorie", b =>
{
b.HasOne("ManagerService.Data.Resource", "Resource")
.WithMany()
.HasForeignKey("ResourceId");
b.HasOne("ManagerService.Data.SubSection.SectionMap", null)
.WithMany("MapCategories")
.HasForeignKey("SectionMapId");
b.Navigation("Resource");
});
modelBuilder.Entity("ManagerService.Data.SubSection.Content", b =>
{
b.HasOne("ManagerService.Data.Resource", "Resource")
.WithMany()
.HasForeignKey("ResourceId");
b.HasOne("ManagerService.Data.SubSection.SectionArticle", null)
.WithMany("ArticleContents")
.HasForeignKey("SectionArticleId");
b.HasOne("ManagerService.Data.SubSection.SectionSlider", null)
.WithMany("SliderContents")
.HasForeignKey("SectionSliderId");
b.Navigation("Resource");
});
modelBuilder.Entity("ManagerService.Data.SubSection.GeoPoint", b =>
{
b.HasOne("ManagerService.Data.SubSection.SectionMap", null)
.WithMany("MapPoints")
.HasForeignKey("SectionMapId");
});
modelBuilder.Entity("ManagerService.Data.SubSection.OrderedTranslationAndResource", b =>
{
b.HasOne("ManagerService.Data.SubSection.SectionPdf", null)
.WithMany("PDFOrderedTranslationAndResources")
.HasForeignKey("SectionPdfId");
});
modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b =>
{
b.HasOne("ManagerService.Data.Resource", "Resource")
.WithMany()
.HasForeignKey("ResourceId");
b.HasOne("ManagerService.Data.SubSection.SectionQuiz", null)
.WithMany("QuizQuestions")
.HasForeignKey("SectionQuizId");
b.Navigation("Resource");
});
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.GeoPoint", b =>
{
b.Navigation("Contents");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionArticle", b =>
{
b.Navigation("ArticleContents");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b =>
{
b.Navigation("MapCategories");
b.Navigation("MapPoints");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMenu", b =>
{
b.Navigation("MenuSections");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionPdf", b =>
{
b.Navigation("PDFOrderedTranslationAndResources");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionQuiz", b =>
{
b.Navigation("QuizQuestions");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionSlider", b =>
{
b.Navigation("SliderContents");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,60 @@
using System.Collections.Generic;
using ManagerService.Data;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ManagerService.Migrations
{
/// <inheritdoc />
public partial class UpdateMix2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Contents",
table: "GeoPoint");
migrationBuilder.AddColumn<int>(
name: "GeoPointId",
table: "Resources",
type: "integer",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Resources_GeoPointId",
table: "Resources",
column: "GeoPointId");
migrationBuilder.AddForeignKey(
name: "FK_Resources_GeoPoint_GeoPointId",
table: "Resources",
column: "GeoPointId",
principalTable: "GeoPoint",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Resources_GeoPoint_GeoPointId",
table: "Resources");
migrationBuilder.DropIndex(
name: "IX_Resources_GeoPointId",
table: "Resources");
migrationBuilder.DropColumn(
name: "GeoPointId",
table: "Resources");
migrationBuilder.AddColumn<List<Resource>>(
name: "Contents",
table: "GeoPoint",
type: "jsonb",
nullable: false);
}
}
}

View File

@ -0,0 +1,757 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using Manager.DTOs;
using ManagerService.DTOs;
using ManagerService.Data;
using ManagerService.Data.SubSection;
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("20250324144502_UpdateMix3")]
partial class UpdateMix3
{
/// <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.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>("IsDate")
.HasColumnType("boolean");
b.Property<bool>("IsHour")
.HasColumnType("boolean");
b.Property<bool>("IsMobile")
.HasColumnType("boolean");
b.Property<bool>("IsOffline")
.HasColumnType("boolean");
b.Property<bool>("IsSectionImageBackground")
.HasColumnType("boolean");
b.Property<bool>("IsTablet")
.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<int?>("RoundedValue")
.HasColumnType("integer");
b.Property<int?>("ScreenPercentageSectionsMainPage")
.HasColumnType("integer");
b.Property<string>("SecondaryColor")
.HasColumnType("text");
b.Property<List<Translation>>("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")
.IsRequired()
.HasColumnType("text");
b.Property<string>("IpAddressWLAN")
.IsRequired()
.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<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<List<Translation>>("Description")
.HasColumnType("jsonb");
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("character varying(8)");
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<List<Translation>>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int>("Type")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("SectionMenuId");
b.ToTable("Sections");
b.HasDiscriminator().HasValue("Base");
b.UseTphMappingStrategy();
});
modelBuilder.Entity("ManagerService.Data.SubSection.Categorie", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Icon")
.HasColumnType("text");
b.Property<List<Translation>>("Label")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int?>("Order")
.HasColumnType("integer");
b.Property<string>("ResourceId")
.HasColumnType("text");
b.Property<string>("SectionMapId")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ResourceId");
b.HasIndex("SectionMapId");
b.ToTable("Categorie");
});
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<List<Content>>("Contents")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("Description")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationDTO>>("Email")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("ImageResourceId")
.HasColumnType("text");
b.Property<string>("ImageUrl")
.HasColumnType("text");
b.Property<string>("Latitude")
.HasColumnType("text");
b.Property<string>("Longitude")
.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")
.HasColumnType("text");
b.Property<List<TranslationDTO>>("Site")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("SectionMapId");
b.ToTable("GeoPoints");
});
modelBuilder.Entity("ManagerService.Data.SubSection.OrderedTranslationAndResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("SectionPdfId")
.HasColumnType("text");
b.Property<List<TranslationAndResource>>("TranslationAndResources")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("SectionPdfId");
b.ToTable("OrderedTranslationAndResource");
});
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("QuizQuestion");
});
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<Translation>>("AgendaResourceIds")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("Agenda");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionArticle", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<Translation>>("ArticleAudioIds")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("ArticleContent")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Content>>("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.SectionMap", b =>
{
b.HasBaseType("ManagerService.Data.Section");
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.HasDiscriminator().HasValue("PDF");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionPuzzle", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<int>("PuzzleCols")
.HasColumnType("integer");
b.Property<string>("PuzzleImageId")
.HasColumnType("text");
b.Property<List<TranslationAndResource>>("PuzzleMessageDebut")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("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<TranslationAndResource>>("QuizBadLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizGoodLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizGreatLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizMediumLevel")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("Quiz");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionSlider", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<Content>>("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.Categorie", b =>
{
b.HasOne("ManagerService.Data.Resource", "Resource")
.WithMany()
.HasForeignKey("ResourceId");
b.HasOne("ManagerService.Data.SubSection.SectionMap", null)
.WithMany("MapCategories")
.HasForeignKey("SectionMapId");
b.Navigation("Resource");
});
modelBuilder.Entity("ManagerService.Data.SubSection.GeoPoint", b =>
{
b.HasOne("ManagerService.Data.SubSection.SectionMap", null)
.WithMany("MapPoints")
.HasForeignKey("SectionMapId");
});
modelBuilder.Entity("ManagerService.Data.SubSection.OrderedTranslationAndResource", b =>
{
b.HasOne("ManagerService.Data.SubSection.SectionPdf", null)
.WithMany("PDFOrderedTranslationAndResources")
.HasForeignKey("SectionPdfId");
});
modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b =>
{
b.HasOne("ManagerService.Data.Resource", "Resource")
.WithMany()
.HasForeignKey("ResourceId");
b.HasOne("ManagerService.Data.SubSection.SectionQuiz", null)
.WithMany("QuizQuestions")
.HasForeignKey("SectionQuizId");
b.Navigation("Resource");
});
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.SectionMap", b =>
{
b.Navigation("MapCategories");
b.Navigation("MapPoints");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMenu", b =>
{
b.Navigation("MenuSections");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionPdf", b =>
{
b.Navigation("PDFOrderedTranslationAndResources");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionQuiz", b =>
{
b.Navigation("QuizQuestions");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,190 @@
using System.Collections.Generic;
using ManagerService.Data.SubSection;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace ManagerService.Migrations
{
/// <inheritdoc />
public partial class UpdateMix3 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_GeoPoint_Sections_SectionMapId",
table: "GeoPoint");
migrationBuilder.DropForeignKey(
name: "FK_Resources_GeoPoint_GeoPointId",
table: "Resources");
migrationBuilder.DropTable(
name: "Content");
migrationBuilder.DropIndex(
name: "IX_Resources_GeoPointId",
table: "Resources");
migrationBuilder.DropPrimaryKey(
name: "PK_GeoPoint",
table: "GeoPoint");
migrationBuilder.DropColumn(
name: "GeoPointId",
table: "Resources");
migrationBuilder.RenameTable(
name: "GeoPoint",
newName: "GeoPoints");
migrationBuilder.RenameIndex(
name: "IX_GeoPoint_SectionMapId",
table: "GeoPoints",
newName: "IX_GeoPoints_SectionMapId");
migrationBuilder.AddColumn<List<Content>>(
name: "ArticleContents",
table: "Sections",
type: "jsonb",
nullable: true);
migrationBuilder.AddColumn<List<Content>>(
name: "SliderContents",
table: "Sections",
type: "jsonb",
nullable: true);
migrationBuilder.AddColumn<List<Content>>(
name: "Contents",
table: "GeoPoints",
type: "jsonb",
nullable: false);
migrationBuilder.AddPrimaryKey(
name: "PK_GeoPoints",
table: "GeoPoints",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_GeoPoints_Sections_SectionMapId",
table: "GeoPoints",
column: "SectionMapId",
principalTable: "Sections",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_GeoPoints_Sections_SectionMapId",
table: "GeoPoints");
migrationBuilder.DropPrimaryKey(
name: "PK_GeoPoints",
table: "GeoPoints");
migrationBuilder.DropColumn(
name: "ArticleContents",
table: "Sections");
migrationBuilder.DropColumn(
name: "SliderContents",
table: "Sections");
migrationBuilder.DropColumn(
name: "Contents",
table: "GeoPoints");
migrationBuilder.RenameTable(
name: "GeoPoints",
newName: "GeoPoint");
migrationBuilder.RenameIndex(
name: "IX_GeoPoints_SectionMapId",
table: "GeoPoint",
newName: "IX_GeoPoint_SectionMapId");
migrationBuilder.AddColumn<int>(
name: "GeoPointId",
table: "Resources",
type: "integer",
nullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_GeoPoint",
table: "GeoPoint",
column: "Id");
migrationBuilder.CreateTable(
name: "Content",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ResourceId = table.Column<string>(type: "text", nullable: true),
Description = table.Column<List<Translation>>(type: "jsonb", nullable: false),
Order = table.Column<int>(type: "integer", nullable: false),
SectionArticleId = table.Column<string>(type: "text", nullable: true),
SectionSliderId = table.Column<string>(type: "text", nullable: true),
Title = table.Column<List<Translation>>(type: "jsonb", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Content", x => x.Id);
table.ForeignKey(
name: "FK_Content_Resources_ResourceId",
column: x => x.ResourceId,
principalTable: "Resources",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Content_Sections_SectionArticleId",
column: x => x.SectionArticleId,
principalTable: "Sections",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Content_Sections_SectionSliderId",
column: x => x.SectionSliderId,
principalTable: "Sections",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Resources_GeoPointId",
table: "Resources",
column: "GeoPointId");
migrationBuilder.CreateIndex(
name: "IX_Content_ResourceId",
table: "Content",
column: "ResourceId");
migrationBuilder.CreateIndex(
name: "IX_Content_SectionArticleId",
table: "Content",
column: "SectionArticleId");
migrationBuilder.CreateIndex(
name: "IX_Content_SectionSliderId",
table: "Content",
column: "SectionSliderId");
migrationBuilder.AddForeignKey(
name: "FK_GeoPoint_Sections_SectionMapId",
table: "GeoPoint",
column: "SectionMapId",
principalTable: "Sections",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Resources_GeoPoint_GeoPointId",
table: "Resources",
column: "GeoPointId",
principalTable: "GeoPoint",
principalColumn: "Id");
}
}
}

View File

@ -0,0 +1,713 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using Manager.DTOs;
using ManagerService.DTOs;
using ManagerService.Data;
using ManagerService.Data.SubSection;
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("20250324150634_UpdateMix4")]
partial class UpdateMix4
{
/// <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.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>("IsDate")
.HasColumnType("boolean");
b.Property<bool>("IsHour")
.HasColumnType("boolean");
b.Property<bool>("IsMobile")
.HasColumnType("boolean");
b.Property<bool>("IsOffline")
.HasColumnType("boolean");
b.Property<bool>("IsSectionImageBackground")
.HasColumnType("boolean");
b.Property<bool>("IsTablet")
.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<int?>("RoundedValue")
.HasColumnType("integer");
b.Property<int?>("ScreenPercentageSectionsMainPage")
.HasColumnType("integer");
b.Property<string>("SecondaryColor")
.HasColumnType("text");
b.Property<List<Translation>>("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")
.IsRequired()
.HasColumnType("text");
b.Property<string>("IpAddressWLAN")
.IsRequired()
.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<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<List<Translation>>("Description")
.HasColumnType("jsonb");
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("character varying(8)");
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<List<Translation>>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int>("Type")
.HasColumnType("integer");
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<List<Content>>("Contents")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("Description")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationDTO>>("Email")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("ImageResourceId")
.HasColumnType("text");
b.Property<string>("ImageUrl")
.HasColumnType("text");
b.Property<string>("Latitude")
.HasColumnType("text");
b.Property<string>("Longitude")
.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")
.HasColumnType("text");
b.Property<List<TranslationDTO>>("Site")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("SectionMapId");
b.ToTable("GeoPoints");
});
modelBuilder.Entity("ManagerService.Data.SubSection.OrderedTranslationAndResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("SectionPdfId")
.HasColumnType("text");
b.Property<List<TranslationAndResource>>("TranslationAndResources")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("SectionPdfId");
b.ToTable("OrderedTranslationAndResource");
});
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("QuizQuestion");
});
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<Translation>>("AgendaResourceIds")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("Agenda");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionArticle", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<Translation>>("ArticleAudioIds")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("ArticleContent")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Content>>("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.SectionMap", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<Categorie>>("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.HasDiscriminator().HasValue("PDF");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionPuzzle", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<int>("PuzzleCols")
.HasColumnType("integer");
b.Property<string>("PuzzleImageId")
.HasColumnType("text");
b.Property<List<TranslationAndResource>>("PuzzleMessageDebut")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("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<TranslationAndResource>>("QuizBadLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizGoodLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizGreatLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizMediumLevel")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("Quiz");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionSlider", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<Content>>("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.SectionMap", null)
.WithMany("MapPoints")
.HasForeignKey("SectionMapId");
});
modelBuilder.Entity("ManagerService.Data.SubSection.OrderedTranslationAndResource", b =>
{
b.HasOne("ManagerService.Data.SubSection.SectionPdf", null)
.WithMany("PDFOrderedTranslationAndResources")
.HasForeignKey("SectionPdfId");
});
modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b =>
{
b.HasOne("ManagerService.Data.Resource", "Resource")
.WithMany()
.HasForeignKey("ResourceId");
b.HasOne("ManagerService.Data.SubSection.SectionQuiz", null)
.WithMany("QuizQuestions")
.HasForeignKey("SectionQuizId");
b.Navigation("Resource");
});
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.SectionMap", b =>
{
b.Navigation("MapPoints");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMenu", b =>
{
b.Navigation("MenuSections");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionPdf", b =>
{
b.Navigation("PDFOrderedTranslationAndResources");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionQuiz", b =>
{
b.Navigation("QuizQuestions");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,71 @@
using System.Collections.Generic;
using ManagerService.Data.SubSection;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace ManagerService.Migrations
{
/// <inheritdoc />
public partial class UpdateMix4 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Categorie");
migrationBuilder.AddColumn<List<Categorie>>(
name: "MapCategories",
table: "Sections",
type: "jsonb",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "MapCategories",
table: "Sections");
migrationBuilder.CreateTable(
name: "Categorie",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ResourceId = table.Column<string>(type: "text", nullable: true),
Icon = table.Column<string>(type: "text", nullable: true),
Label = table.Column<List<Translation>>(type: "jsonb", nullable: false),
Order = table.Column<int>(type: "integer", nullable: true),
SectionMapId = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Categorie", x => x.Id);
table.ForeignKey(
name: "FK_Categorie_Resources_ResourceId",
column: x => x.ResourceId,
principalTable: "Resources",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Categorie_Sections_SectionMapId",
column: x => x.SectionMapId,
principalTable: "Sections",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Categorie_ResourceId",
table: "Categorie",
column: "ResourceId");
migrationBuilder.CreateIndex(
name: "IX_Categorie_SectionMapId",
table: "Categorie",
column: "SectionMapId");
}
}
}

View File

@ -0,0 +1,680 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using Manager.DTOs;
using ManagerService.DTOs;
using ManagerService.Data;
using ManagerService.Data.SubSection;
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("20250324151019_UpdateMix5")]
partial class UpdateMix5
{
/// <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.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>("IsDate")
.HasColumnType("boolean");
b.Property<bool>("IsHour")
.HasColumnType("boolean");
b.Property<bool>("IsMobile")
.HasColumnType("boolean");
b.Property<bool>("IsOffline")
.HasColumnType("boolean");
b.Property<bool>("IsSectionImageBackground")
.HasColumnType("boolean");
b.Property<bool>("IsTablet")
.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<int?>("RoundedValue")
.HasColumnType("integer");
b.Property<int?>("ScreenPercentageSectionsMainPage")
.HasColumnType("integer");
b.Property<string>("SecondaryColor")
.HasColumnType("text");
b.Property<List<Translation>>("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")
.IsRequired()
.HasColumnType("text");
b.Property<string>("IpAddressWLAN")
.IsRequired()
.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<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<List<Translation>>("Description")
.HasColumnType("jsonb");
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("character varying(8)");
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<List<Translation>>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int>("Type")
.HasColumnType("integer");
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<List<Content>>("Contents")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("Description")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationDTO>>("Email")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("ImageResourceId")
.HasColumnType("text");
b.Property<string>("ImageUrl")
.HasColumnType("text");
b.Property<string>("Latitude")
.HasColumnType("text");
b.Property<string>("Longitude")
.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")
.HasColumnType("text");
b.Property<List<TranslationDTO>>("Site")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("SectionMapId");
b.ToTable("GeoPoints");
});
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("QuizQuestion");
});
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<Translation>>("AgendaResourceIds")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("Agenda");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionArticle", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<Translation>>("ArticleAudioIds")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("ArticleContent")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Content>>("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.SectionMap", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<Categorie>>("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<OrderedTranslationAndResource>>("PDFOrderedTranslationAndResources")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("PDF");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionPuzzle", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<int>("PuzzleCols")
.HasColumnType("integer");
b.Property<string>("PuzzleImageId")
.HasColumnType("text");
b.Property<List<TranslationAndResource>>("PuzzleMessageDebut")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("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<TranslationAndResource>>("QuizBadLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizGoodLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizGreatLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizMediumLevel")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("Quiz");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionSlider", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<Content>>("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.SectionMap", null)
.WithMany("MapPoints")
.HasForeignKey("SectionMapId");
});
modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b =>
{
b.HasOne("ManagerService.Data.Resource", "Resource")
.WithMany()
.HasForeignKey("ResourceId");
b.HasOne("ManagerService.Data.SubSection.SectionQuiz", null)
.WithMany("QuizQuestions")
.HasForeignKey("SectionQuizId");
b.Navigation("Resource");
});
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.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,59 @@
using System.Collections.Generic;
using ManagerService.Data.SubSection;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace ManagerService.Migrations
{
/// <inheritdoc />
public partial class UpdateMix5 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "OrderedTranslationAndResource");
migrationBuilder.AddColumn<List<OrderedTranslationAndResource>>(
name: "PDFOrderedTranslationAndResources",
table: "Sections",
type: "jsonb",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PDFOrderedTranslationAndResources",
table: "Sections");
migrationBuilder.CreateTable(
name: "OrderedTranslationAndResource",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Order = table.Column<int>(type: "integer", nullable: false),
SectionPdfId = table.Column<string>(type: "text", nullable: true),
TranslationAndResources = table.Column<List<TranslationAndResource>>(type: "jsonb", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrderedTranslationAndResource", x => x.Id);
table.ForeignKey(
name: "FK_OrderedTranslationAndResource_Sections_SectionPdfId",
column: x => x.SectionPdfId,
principalTable: "Sections",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_OrderedTranslationAndResource_SectionPdfId",
table: "OrderedTranslationAndResource",
column: "SectionPdfId");
}
}
}

View File

@ -0,0 +1,680 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using Manager.DTOs;
using ManagerService.DTOs;
using ManagerService.Data;
using ManagerService.Data.SubSection;
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("20250324152734_UpdateMix6")]
partial class UpdateMix6
{
/// <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.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>("IsDate")
.HasColumnType("boolean");
b.Property<bool>("IsHour")
.HasColumnType("boolean");
b.Property<bool>("IsMobile")
.HasColumnType("boolean");
b.Property<bool>("IsOffline")
.HasColumnType("boolean");
b.Property<bool>("IsSectionImageBackground")
.HasColumnType("boolean");
b.Property<bool>("IsTablet")
.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<int?>("RoundedValue")
.HasColumnType("integer");
b.Property<int?>("ScreenPercentageSectionsMainPage")
.HasColumnType("integer");
b.Property<string>("SecondaryColor")
.HasColumnType("text");
b.Property<List<Translation>>("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")
.IsRequired()
.HasColumnType("text");
b.Property<string>("IpAddressWLAN")
.IsRequired()
.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<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<List<Translation>>("Description")
.HasColumnType("jsonb");
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("character varying(8)");
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<List<Translation>>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int>("Type")
.HasColumnType("integer");
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<List<Content>>("Contents")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("Description")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationDTO>>("Email")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("ImageResourceId")
.HasColumnType("text");
b.Property<string>("ImageUrl")
.HasColumnType("text");
b.Property<string>("Latitude")
.HasColumnType("text");
b.Property<string>("Longitude")
.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")
.HasColumnType("text");
b.Property<List<TranslationDTO>>("Site")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("SectionMapId");
b.ToTable("GeoPoints");
});
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.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<Translation>>("AgendaResourceIds")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("Agenda");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionArticle", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<Translation>>("ArticleAudioIds")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("ArticleContent")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Content>>("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.SectionMap", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<Categorie>>("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<OrderedTranslationAndResource>>("PDFOrderedTranslationAndResources")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("PDF");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionPuzzle", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<int>("PuzzleCols")
.HasColumnType("integer");
b.Property<string>("PuzzleImageId")
.HasColumnType("text");
b.Property<List<TranslationAndResource>>("PuzzleMessageDebut")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("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<TranslationAndResource>>("QuizBadLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizGoodLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizGreatLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizMediumLevel")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("Quiz");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionSlider", b =>
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<Content>>("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.SectionMap", null)
.WithMany("MapPoints")
.HasForeignKey("SectionMapId");
});
modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b =>
{
b.HasOne("ManagerService.Data.Resource", "Resource")
.WithMany()
.HasForeignKey("ResourceId");
b.HasOne("ManagerService.Data.SubSection.SectionQuiz", null)
.WithMany("QuizQuestions")
.HasForeignKey("SectionQuizId");
b.Navigation("Resource");
});
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.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,108 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ManagerService.Migrations
{
/// <inheritdoc />
public partial class UpdateMix6 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_QuizQuestion_Resources_ResourceId",
table: "QuizQuestion");
migrationBuilder.DropForeignKey(
name: "FK_QuizQuestion_Sections_SectionQuizId",
table: "QuizQuestion");
migrationBuilder.DropPrimaryKey(
name: "PK_QuizQuestion",
table: "QuizQuestion");
migrationBuilder.RenameTable(
name: "QuizQuestion",
newName: "QuizQuestions");
migrationBuilder.RenameIndex(
name: "IX_QuizQuestion_SectionQuizId",
table: "QuizQuestions",
newName: "IX_QuizQuestions_SectionQuizId");
migrationBuilder.RenameIndex(
name: "IX_QuizQuestion_ResourceId",
table: "QuizQuestions",
newName: "IX_QuizQuestions_ResourceId");
migrationBuilder.AddPrimaryKey(
name: "PK_QuizQuestions",
table: "QuizQuestions",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_QuizQuestions_Resources_ResourceId",
table: "QuizQuestions",
column: "ResourceId",
principalTable: "Resources",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_QuizQuestions_Sections_SectionQuizId",
table: "QuizQuestions",
column: "SectionQuizId",
principalTable: "Sections",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_QuizQuestions_Resources_ResourceId",
table: "QuizQuestions");
migrationBuilder.DropForeignKey(
name: "FK_QuizQuestions_Sections_SectionQuizId",
table: "QuizQuestions");
migrationBuilder.DropPrimaryKey(
name: "PK_QuizQuestions",
table: "QuizQuestions");
migrationBuilder.RenameTable(
name: "QuizQuestions",
newName: "QuizQuestion");
migrationBuilder.RenameIndex(
name: "IX_QuizQuestions_SectionQuizId",
table: "QuizQuestion",
newName: "IX_QuizQuestion_SectionQuizId");
migrationBuilder.RenameIndex(
name: "IX_QuizQuestions_ResourceId",
table: "QuizQuestion",
newName: "IX_QuizQuestion_ResourceId");
migrationBuilder.AddPrimaryKey(
name: "PK_QuizQuestion",
table: "QuizQuestion",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_QuizQuestion_Resources_ResourceId",
table: "QuizQuestion",
column: "ResourceId",
principalTable: "Resources",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_QuizQuestion_Sections_SectionQuizId",
table: "QuizQuestion",
column: "SectionQuizId",
principalTable: "Sections",
principalColumn: "Id");
}
}
}

View File

@ -0,0 +1,680 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using Manager.DTOs;
using ManagerService.DTOs;
using ManagerService.Data;
using ManagerService.Data.SubSection;
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("20250324154921_UpdateMix7")]
partial class UpdateMix7
{
/// <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.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>("IsDate")
.HasColumnType("boolean");
b.Property<bool>("IsHour")
.HasColumnType("boolean");
b.Property<bool>("IsMobile")
.HasColumnType("boolean");
b.Property<bool>("IsOffline")
.HasColumnType("boolean");
b.Property<bool>("IsSectionImageBackground")
.HasColumnType("boolean");
b.Property<bool>("IsTablet")
.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<int?>("RoundedValue")
.HasColumnType("integer");
b.Property<int?>("ScreenPercentageSectionsMainPage")
.HasColumnType("integer");
b.Property<string>("SecondaryColor")
.HasColumnType("text");
b.Property<List<TranslationDTO>>("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")
.IsRequired()
.HasColumnType("text");
b.Property<string>("IpAddressWLAN")
.IsRequired()
.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<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<List<TranslationDTO>>("Description")
.HasColumnType("jsonb");
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("character varying(8)");
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<List<TranslationDTO>>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int>("Type")
.HasColumnType("integer");
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<List<Content>>("Contents")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationDTO>>("Description")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationDTO>>("Email")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("ImageResourceId")
.HasColumnType("text");
b.Property<string>("ImageUrl")
.HasColumnType("text");
b.Property<string>("Latitude")
.HasColumnType("text");
b.Property<string>("Longitude")
.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")
.HasColumnType("text");
b.Property<List<TranslationDTO>>("Site")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationDTO>>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("SectionMapId");
b.ToTable("GeoPoints");
});
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.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.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<int>("PuzzleCols")
.HasColumnType("integer");
b.Property<string>("PuzzleImageId")
.HasColumnType("text");
b.Property<List<TranslationAndResource>>("PuzzleMessageDebut")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("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.SectionMap", null)
.WithMany("MapPoints")
.HasForeignKey("SectionMapId");
});
modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b =>
{
b.HasOne("ManagerService.Data.Resource", "Resource")
.WithMany()
.HasForeignKey("ResourceId");
b.HasOne("ManagerService.Data.SubSection.SectionQuiz", null)
.WithMany("QuizQuestions")
.HasForeignKey("SectionQuizId");
b.Navigation("Resource");
});
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.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,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ManagerService.Migrations
{
/// <inheritdoc />
public partial class UpdateMix7 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@ -87,7 +87,7 @@ namespace ManagerService.Migrations
b.Property<string>("SecondaryColor")
.HasColumnType("text");
b.Property<List<Translation>>("Title")
b.Property<List<TranslationDTO>>("Title")
.IsRequired()
.HasColumnType("jsonb");
@ -213,7 +213,7 @@ namespace ManagerService.Migrations
b.Property<DateTime>("DateCreation")
.HasColumnType("timestamp with time zone");
b.Property<List<Translation>>("Description")
b.Property<List<TranslationDTO>>("Description")
.HasColumnType("jsonb");
b.Property<string>("Discriminator")
@ -259,7 +259,7 @@ namespace ManagerService.Migrations
b.Property<string>("SectionMenuId")
.HasColumnType("text");
b.Property<List<Translation>>("Title")
b.Property<List<TranslationDTO>>("Title")
.IsRequired()
.HasColumnType("jsonb");
@ -277,78 +277,6 @@ namespace ManagerService.Migrations
b.UseTphMappingStrategy();
});
modelBuilder.Entity("ManagerService.Data.SubSection.Categorie", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Icon")
.HasColumnType("text");
b.Property<List<Translation>>("Label")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int?>("Order")
.HasColumnType("integer");
b.Property<string>("ResourceId")
.HasColumnType("text");
b.Property<string>("SectionMapId")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ResourceId");
b.HasIndex("SectionMapId");
b.ToTable("Categorie");
});
modelBuilder.Entity("ManagerService.Data.SubSection.Content", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<List<Translation>>("Description")
.IsRequired()
.HasColumnType("jsonb");
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("ResourceId")
.HasColumnType("text");
b.Property<string>("SectionArticleId")
.HasColumnType("text");
b.Property<string>("SectionSliderId")
.HasColumnType("text");
b.Property<List<Translation>>("Title")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("ResourceId");
b.HasIndex("SectionArticleId");
b.HasIndex("SectionSliderId");
b.ToTable("Content");
});
modelBuilder.Entity("ManagerService.Data.SubSection.GeoPoint", b =>
{
b.Property<int>("Id")
@ -360,11 +288,11 @@ namespace ManagerService.Migrations
b.Property<int?>("CategorieId")
.HasColumnType("integer");
b.Property<List<Resource>>("Contents")
b.Property<List<Content>>("Contents")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("Description")
b.Property<List<TranslationDTO>>("Description")
.IsRequired()
.HasColumnType("jsonb");
@ -403,7 +331,7 @@ namespace ManagerService.Migrations
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("Title")
b.Property<List<TranslationDTO>>("Title")
.IsRequired()
.HasColumnType("jsonb");
@ -411,32 +339,7 @@ namespace ManagerService.Migrations
b.HasIndex("SectionMapId");
b.ToTable("GeoPoint");
});
modelBuilder.Entity("ManagerService.Data.SubSection.OrderedTranslationAndResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Order")
.HasColumnType("integer");
b.Property<string>("SectionPdfId")
.HasColumnType("text");
b.Property<List<TranslationAndResource>>("TranslationAndResources")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("SectionPdfId");
b.ToTable("OrderedTranslationAndResource");
b.ToTable("GeoPoints");
});
modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b =>
@ -470,7 +373,7 @@ namespace ManagerService.Migrations
b.HasIndex("SectionQuizId");
b.ToTable("QuizQuestion");
b.ToTable("QuizQuestions");
});
modelBuilder.Entity("ManagerService.Data.User", b =>
@ -516,7 +419,7 @@ namespace ManagerService.Migrations
b.Property<int?>("AgendaMapProvider")
.HasColumnType("integer");
b.Property<List<Translation>>("AgendaResourceIds")
b.Property<List<TranslationDTO>>("AgendaResourceIds")
.IsRequired()
.HasColumnType("jsonb");
@ -527,11 +430,15 @@ namespace ManagerService.Migrations
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<Translation>>("ArticleAudioIds")
b.Property<List<TranslationDTO>>("ArticleAudioIds")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<Translation>>("ArticleContent")
b.Property<List<TranslationDTO>>("ArticleContent")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<ContentDTO>>("ArticleContents")
.IsRequired()
.HasColumnType("jsonb");
@ -548,6 +455,10 @@ namespace ManagerService.Migrations
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<CategorieDTO>>("MapCategories")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("MapCenterLatitude")
.HasColumnType("text");
@ -585,6 +496,10 @@ namespace ManagerService.Migrations
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<OrderedTranslationAndResourceDTO>>("PDFOrderedTranslationAndResources")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("PDF");
});
@ -618,19 +533,19 @@ namespace ManagerService.Migrations
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<TranslationAndResource>>("QuizBadLevel")
b.Property<List<TranslationAndResourceDTO>>("QuizBadLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizGoodLevel")
b.Property<List<TranslationAndResourceDTO>>("QuizGoodLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizGreatLevel")
b.Property<List<TranslationAndResourceDTO>>("QuizGreatLevel")
.IsRequired()
.HasColumnType("jsonb");
b.Property<List<TranslationAndResource>>("QuizMediumLevel")
b.Property<List<TranslationAndResourceDTO>>("QuizMediumLevel")
.IsRequired()
.HasColumnType("jsonb");
@ -641,6 +556,10 @@ namespace ManagerService.Migrations
{
b.HasBaseType("ManagerService.Data.Section");
b.Property<List<ContentDTO>>("SliderContents")
.IsRequired()
.HasColumnType("jsonb");
b.HasDiscriminator().HasValue("Slider");
});
@ -700,36 +619,6 @@ namespace ManagerService.Migrations
.HasForeignKey("SectionMenuId");
});
modelBuilder.Entity("ManagerService.Data.SubSection.Categorie", b =>
{
b.HasOne("ManagerService.Data.Resource", "Resource")
.WithMany()
.HasForeignKey("ResourceId");
b.HasOne("ManagerService.Data.SubSection.SectionMap", null)
.WithMany("MapCategories")
.HasForeignKey("SectionMapId");
b.Navigation("Resource");
});
modelBuilder.Entity("ManagerService.Data.SubSection.Content", b =>
{
b.HasOne("ManagerService.Data.Resource", "Resource")
.WithMany()
.HasForeignKey("ResourceId");
b.HasOne("ManagerService.Data.SubSection.SectionArticle", null)
.WithMany("ArticleContents")
.HasForeignKey("SectionArticleId");
b.HasOne("ManagerService.Data.SubSection.SectionSlider", null)
.WithMany("SliderContents")
.HasForeignKey("SectionSliderId");
b.Navigation("Resource");
});
modelBuilder.Entity("ManagerService.Data.SubSection.GeoPoint", b =>
{
b.HasOne("ManagerService.Data.SubSection.SectionMap", null)
@ -737,13 +626,6 @@ namespace ManagerService.Migrations
.HasForeignKey("SectionMapId");
});
modelBuilder.Entity("ManagerService.Data.SubSection.OrderedTranslationAndResource", b =>
{
b.HasOne("ManagerService.Data.SubSection.SectionPdf", null)
.WithMany("PDFOrderedTranslationAndResources")
.HasForeignKey("SectionPdfId");
});
modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b =>
{
b.HasOne("ManagerService.Data.Resource", "Resource")
@ -775,15 +657,8 @@ namespace ManagerService.Migrations
b.Navigation("PuzzleImage");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionArticle", b =>
{
b.Navigation("ArticleContents");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b =>
{
b.Navigation("MapCategories");
b.Navigation("MapPoints");
});
@ -792,20 +667,10 @@ namespace ManagerService.Migrations
b.Navigation("MenuSections");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionPdf", b =>
{
b.Navigation("PDFOrderedTranslationAndResources");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionQuiz", b =>
{
b.Navigation("QuizQuestions");
});
modelBuilder.Entity("ManagerService.Data.SubSection.SectionSlider", b =>
{
b.Navigation("SliderContents");
});
#pragma warning restore 612, 618
}
}

View File

@ -71,8 +71,8 @@ namespace ManagerService.Services
ConfigurationId = dto.configurationId,
InstanceId = dto.instanceId,
Label = dto.label,
Title = dto.title.Select(t => new Translation().FromDTO(t)).ToList(),
Description = dto.description.Select(d => new Translation().FromDTO(d)).ToList(),
Title = dto.title,
Description = dto.description,
Order = dto.order.Value,
ImageId = dto.imageId,
ImageSource = dto.imageSource,
@ -84,7 +84,7 @@ namespace ManagerService.Services
Longitude = dto.longitude,
MeterZoneGPS = dto.meterZoneGPS,
Type = dto.type,
AgendaResourceIds = agendaDTO.resourceIds.Select(r => new Translation().FromDTO(r)).ToList(),
AgendaResourceIds = agendaDTO.resourceIds,
AgendaMapProvider = agendaDTO.agendaMapProvider
},
SectionType.Article => new SectionArticle
@ -93,8 +93,8 @@ namespace ManagerService.Services
ConfigurationId = dto.configurationId,
InstanceId = dto.instanceId,
Label = dto.label,
Title = dto.title.Select(t => new Translation().FromDTO(t)).ToList(),
Description = dto.description.Select(d => new Translation().FromDTO(d)).ToList(),
Title = dto.title,
Description = dto.description,
Order = dto.order.Value,
ImageId = dto.imageId,
ImageSource = dto.imageSource,
@ -106,11 +106,11 @@ namespace ManagerService.Services
Longitude = dto.longitude,
MeterZoneGPS = dto.meterZoneGPS,
Type = dto.type,
ArticleContent = articleDTO.content.Select(r => new Translation().FromDTO(r)).ToList(),
ArticleContent = articleDTO.content,
ArticleIsContentTop = articleDTO.isContentTop,
ArticleAudioIds = articleDTO.audioIds.Select(a => new Translation().FromDTO(a)).ToList(),
ArticleAudioIds = articleDTO.audioIds,
ArticleIsReadAudioAuto = articleDTO.isReadAudioAuto,
ArticleContents = articleDTO.contents.Select(c => new Content().FromDTO(c)).ToList()
ArticleContents = articleDTO.contents
},
SectionType.Map => new SectionMap
{
@ -118,8 +118,8 @@ namespace ManagerService.Services
ConfigurationId = dto.configurationId,
InstanceId = dto.instanceId,
Label = dto.label,
Title = dto.title.Select(t => new Translation().FromDTO(t)).ToList(),
Description = dto.description.Select(d => new Translation().FromDTO(d)).ToList(),
Title = dto.title,
Description = dto.description,
Order = dto.order.Value,
ImageId = dto.imageId,
ImageSource = dto.imageSource,
@ -147,8 +147,8 @@ namespace ManagerService.Services
ConfigurationId = dto.configurationId,
InstanceId = dto.instanceId,
Label = dto.label,
Title = dto.title.Select(t => new Translation().FromDTO(t)).ToList(),
Description = dto.description.Select(d => new Translation().FromDTO(d)).ToList(),
Title = dto.title,
Description = dto.description,
Order = dto.order.Value,
ImageId = dto.imageId,
ImageSource = dto.imageSource,
@ -168,8 +168,8 @@ namespace ManagerService.Services
ConfigurationId = dto.configurationId,
InstanceId = dto.instanceId,
Label = dto.label,
Title = dto.title.Select(t => new Translation().FromDTO(t)).ToList(),
Description = dto.description.Select(d => new Translation().FromDTO(d)).ToList(),
Title = dto.title,
Description = dto.description,
Order = dto.order.Value,
ImageId = dto.imageId,
ImageSource = dto.imageSource,
@ -181,7 +181,7 @@ namespace ManagerService.Services
Longitude = dto.longitude,
MeterZoneGPS = dto.meterZoneGPS,
Type = dto.type,
PDFOrderedTranslationAndResources = pdfDTO.pdfs.Select(p => new OrderedTranslationAndResource().FromDTO(p)).ToList()
PDFOrderedTranslationAndResources = pdfDTO.pdfs
},
SectionType.Puzzle => new SectionPuzzle
{
@ -189,8 +189,8 @@ namespace ManagerService.Services
ConfigurationId = dto.configurationId,
InstanceId = dto.instanceId,
Label = dto.label,
Title = dto.title.Select(t => new Translation().FromDTO(t)).ToList(),
Description = dto.description.Select(d => new Translation().FromDTO(d)).ToList(),
Title = dto.title,
Description = dto.description,
Order = dto.order.Value,
ImageId = dto.imageId,
ImageSource = dto.imageSource,
@ -214,8 +214,8 @@ namespace ManagerService.Services
ConfigurationId = dto.configurationId,
InstanceId = dto.instanceId,
Label = dto.label,
Title = dto.title.Select(t => new Translation().FromDTO(t)).ToList(),
Description = dto.description.Select(d => new Translation().FromDTO(d)).ToList(),
Title = dto.title,
Description = dto.description,
Order = dto.order.Value,
ImageId = dto.imageId,
ImageSource = dto.imageSource,
@ -227,10 +227,10 @@ namespace ManagerService.Services
Longitude = dto.longitude,
MeterZoneGPS = dto.meterZoneGPS,
Type = dto.type,
QuizBadLevel = quizDTO.bad_level.Select(bl => new TranslationAndResource().FromDTO(bl)).ToList(),
QuizMediumLevel = quizDTO.medium_level.Select(ml => new TranslationAndResource().FromDTO(ml)).ToList(),
QuizGoodLevel = quizDTO.good_level.Select(gol => new TranslationAndResource().FromDTO(gol)).ToList(),
QuizGreatLevel = quizDTO.great_level.Select(gl => new TranslationAndResource().FromDTO(gl)).ToList(),
QuizBadLevel = quizDTO.bad_level,
QuizMediumLevel = quizDTO.medium_level,
QuizGoodLevel = quizDTO.good_level,
QuizGreatLevel = quizDTO.great_level,
//Questions = ((QuizDTO)dto).questions, // TODO specific
},
SectionType.Slider => new SectionSlider
@ -239,8 +239,8 @@ namespace ManagerService.Services
ConfigurationId = dto.configurationId,
InstanceId = dto.instanceId,
Label = dto.label,
Title = dto.title.Select(t => new Translation().FromDTO(t)).ToList(),
Description = dto.description.Select(d => new Translation().FromDTO(d)).ToList(),
Title = dto.title,
Description = dto.description,
Order = dto.order.Value,
ImageId = dto.imageId,
ImageSource = dto.imageSource,
@ -252,7 +252,7 @@ namespace ManagerService.Services
Longitude = dto.longitude,
MeterZoneGPS = dto.meterZoneGPS,
Type = dto.type,
SliderContents = sliderDTO.contents.Select(c => new Content().FromDTO(c)).ToList(), // TODO TEST
SliderContents = sliderDTO.contents, // TODO TEST
},
SectionType.Video => new SectionVideo
{
@ -260,8 +260,8 @@ namespace ManagerService.Services
ConfigurationId = dto.configurationId,
InstanceId = dto.instanceId,
Label = dto.label,
Title = dto.title.Select(t => new Translation().FromDTO(t)).ToList(),
Description = dto.description.Select(d => new Translation().FromDTO(d)).ToList(),
Title = dto.title,
Description = dto.description,
Order = dto.order.Value,
ImageId = dto.imageId,
ImageSource = dto.imageSource,
@ -282,8 +282,8 @@ namespace ManagerService.Services
ConfigurationId = dto.configurationId,
InstanceId = dto.instanceId,
Label = dto.label,
Title = dto.title.Select(t => new Translation().FromDTO(t)).ToList(),
Description = dto.description.Select(d => new Translation().FromDTO(d)).ToList(),
Title = dto.title,
Description = dto.description,
Order = dto.order.Value,
ImageId = dto.imageId,
ImageSource = dto.imageSource,
@ -305,8 +305,8 @@ namespace ManagerService.Services
ConfigurationId = dto.configurationId,
InstanceId = dto.instanceId,
Label = dto.label,
Title = dto.title.Select(t => new Translation().FromDTO(t)).ToList(),
Description = dto.description.Select(d => new Translation().FromDTO(d)).ToList(),
Title = dto.title,
Description = dto.description,
Order = dto.order.Value,
ImageId = dto.imageId,
ImageSource = dto.imageSource,
@ -326,6 +326,7 @@ namespace ManagerService.Services
public static SectionDTO ToDTO(Section section)
{
// TODO retrieve specific elements ?
return section switch
{
SectionAgenda agenda => new AgendaDTO
@ -334,8 +335,8 @@ namespace ManagerService.Services
configurationId = agenda.ConfigurationId,
instanceId = agenda.InstanceId,
label = agenda.Label,
title = agenda.Title.Select(t => t.ToDTO()).ToList(),
description = agenda.Description.Select(t => t.ToDTO()).ToList(),
title = agenda.Title,
description = agenda.Description,
order = agenda.Order,
imageId = agenda.ImageId,
imageSource = agenda.ImageSource,
@ -347,17 +348,17 @@ namespace ManagerService.Services
longitude = agenda.Longitude,
meterZoneGPS = agenda.MeterZoneGPS,
type = agenda.Type,
resourceIds = agenda.AgendaResourceIds.Select(r => r.ToDTO()).ToList(),
resourceIds = agenda.AgendaResourceIds,
agendaMapProvider = agenda.AgendaMapProvider
},
SectionArticle article => new ArticleDTO
{
id = article.Id,
configurationId = article.ConfigurationId,
instanceId = agenda.InstanceId,
instanceId = article.InstanceId,
label = article.Label,
title = article.Title.Select(t => t.ToDTO()).ToList(),
description = article.Description.Select(d => d.ToDTO()).ToList(),
title = article.Title,
description = article.Description,
order = article.Order,
imageId = article.ImageId,
imageSource = article.ImageSource,
@ -369,19 +370,20 @@ namespace ManagerService.Services
longitude = article.Longitude,
meterZoneGPS = article.MeterZoneGPS,
type = article.Type,
content = article.ArticleContent.Select(r => r.ToDTO()).ToList(),
content = article.ArticleContent,
isContentTop = article.ArticleIsContentTop,
audioIds = article.ArticleAudioIds.Select(a => a.ToDTO()).ToList(),
audioIds = article.ArticleAudioIds,
isReadAudioAuto = article.ArticleIsReadAudioAuto,
contents = article.ArticleContents.Select(c => c.ToDTO()).ToList()
contents = article.ArticleContents
},
SectionMap map => new MapDTO
{
id = map.Id,
configurationId = map.ConfigurationId,
instanceId = map.InstanceId,
label = map.Label,
title = map.Title.Select(t => t.ToDTO()).ToList(),
description = map.Description.Select(d => d.ToDTO()).ToList(),
title = map.Title,
description = map.Description,
order = map.Order,
imageId = map.ImageId,
imageSource = map.ImageSource,
@ -401,15 +403,16 @@ namespace ManagerService.Services
centerLatitude = map.MapCenterLatitude,
centerLongitude = map.MapCenterLongitude,
categories = null, // map.MapCategories, // TODO specific
points = null // map.MapPoints // TODO specific
//points = null // map.MapPoints // TODO specific
},
SectionMenu menu => new MenuDTO
{
id = menu.Id,
configurationId = menu.ConfigurationId,
instanceId = menu.InstanceId,
label = menu.Label,
title = menu.Title.Select(t => t.ToDTO()).ToList(),
description = menu.Description.Select(d => d.ToDTO()).ToList(),
title = menu.Title,
description = menu.Description,
order = menu.Order,
imageId = menu.ImageId,
imageSource = menu.ImageSource,
@ -427,9 +430,10 @@ namespace ManagerService.Services
{
id = pdf.Id,
configurationId = pdf.ConfigurationId,
instanceId = pdf.InstanceId,
label = pdf.Label,
title = pdf.Title.Select(t => t.ToDTO()).ToList(),
description = pdf.Description.Select(d => d.ToDTO()).ToList(),
title = pdf.Title,
description = pdf.Description,
order = pdf.Order,
imageId = pdf.ImageId,
imageSource = pdf.ImageSource,
@ -441,15 +445,16 @@ namespace ManagerService.Services
longitude = pdf.Longitude,
meterZoneGPS = pdf.MeterZoneGPS,
type = pdf.Type,
pdfs = pdf.PDFOrderedTranslationAndResources.Select(p => p.ToDTO()).ToList()
pdfs = pdf.PDFOrderedTranslationAndResources
},
SectionPuzzle puzzle => new PuzzleDTO
{
id = puzzle.Id,
configurationId = puzzle.ConfigurationId,
instanceId = puzzle.InstanceId,
label = puzzle.Label,
title = puzzle.Title.Select(t => t.ToDTO()).ToList(),
description = puzzle.Description.Select(d => d.ToDTO()).ToList(),
title = puzzle.Title,
description = puzzle.Description,
order = puzzle.Order,
imageId = puzzle.ImageId,
imageSource = puzzle.ImageSource,
@ -471,9 +476,10 @@ namespace ManagerService.Services
{
id = quiz.Id,
configurationId = quiz.ConfigurationId,
instanceId = quiz.InstanceId,
label = quiz.Label,
title = quiz.Title.Select(t => t.ToDTO()).ToList(),
description = quiz.Description.Select(d => d.ToDTO()).ToList(),
title = quiz.Title,
description = quiz.Description,
order = quiz.Order,
imageId = quiz.ImageId,
imageSource = quiz.ImageSource,
@ -485,19 +491,20 @@ namespace ManagerService.Services
longitude = quiz.Longitude,
meterZoneGPS = quiz.MeterZoneGPS,
type = quiz.Type,
bad_level = quiz.QuizBadLevel.Select(bl => bl.ToDTO()).ToList(),
medium_level = quiz.QuizMediumLevel.Select(ml => ml.ToDTO()).ToList(),
good_level = quiz.QuizGoodLevel.Select(gol => gol.ToDTO()).ToList(),
great_level = quiz.QuizGreatLevel.Select(gl => gl.ToDTO()).ToList(),
bad_level = quiz.QuizBadLevel,
medium_level = quiz.QuizMediumLevel,
good_level = quiz.QuizGoodLevel,
great_level = quiz.QuizGreatLevel,
questions = null // quiz.Questions, // TODO specific
},
SectionSlider slider => new SliderDTO
{
id = slider.Id,
configurationId = slider.ConfigurationId,
instanceId = slider.InstanceId,
label = slider.Label,
title = slider.Title.Select(t => t.ToDTO()).ToList(),
description = slider.Description.Select(d => d.ToDTO()).ToList(),
title = slider.Title,
description = slider.Description,
order = slider.Order,
imageId = slider.ImageId,
imageSource = slider.ImageSource,
@ -509,15 +516,16 @@ namespace ManagerService.Services
longitude = slider.Longitude,
meterZoneGPS = slider.MeterZoneGPS,
type = slider.Type,
contents = slider.SliderContents.Select(c => c.ToDTO()).ToList()
contents = slider.SliderContents
},
SectionVideo video => new VideoDTO
{
id = video.Id,
configurationId = video.ConfigurationId,
instanceId = video.InstanceId,
label = video.Label,
title = video.Title.Select(t => t.ToDTO()).ToList(),
description = video.Description.Select(d => d.ToDTO()).ToList(),
title = video.Title,
description = video.Description,
order = video.Order,
imageId = video.ImageId,
imageSource = video.ImageSource,
@ -535,9 +543,10 @@ namespace ManagerService.Services
{
id = weather.Id,
configurationId = weather.ConfigurationId,
instanceId = weather.InstanceId,
label = weather.Label,
title = weather.Title.Select(t => t.ToDTO()).ToList(),
description = weather.Description.Select(d => d.ToDTO()).ToList(),
title = weather.Title,
description = weather.Description,
order = weather.Order,
imageId = weather.ImageId,
imageSource = weather.ImageSource,
@ -557,9 +566,10 @@ namespace ManagerService.Services
{
id = web.Id,
configurationId = web.ConfigurationId,
instanceId = web.InstanceId,
label = web.Label,
title = web.Title.Select(t => t.ToDTO()).ToList(),
description = web.Description.Select(d => d.ToDTO()).ToList(),
title = web.Title,
description = web.Description,
order = web.Order,
imageId = web.ImageId,
imageSource = web.ImageSource,