diff --git a/ManagerService/Controllers/ApplicationInstanceController.cs b/ManagerService/Controllers/ApplicationInstanceController.cs new file mode 100644 index 0000000..758c387 --- /dev/null +++ b/ManagerService/Controllers/ApplicationInstanceController.cs @@ -0,0 +1,188 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Manager.Helpers; +using Manager.Services; +using ManagerService.Data; +using ManagerService.DTOs; +using ManagerService.Helpers; +using ManagerService.Services; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using NSwag.Annotations; + +namespace ManagerService.Controllers +{ + [Authorize] // TODO Add ROLES (Roles = "Admin") + [ApiController, Route("api/[controller]")] + [OpenApiTag("Instance", Description = "Application instance management")] + public class ApplicationInstanceController : ControllerBase + { + private readonly MyInfoMateDbContext _myInfoMateDbContext; + + private InstanceDatabaseService _instanceService; + private UserDatabaseService _userService; + private readonly ILogger _logger; + private readonly ProfileLogic _profileLogic; + IHexIdGeneratorService idService = new HexIdGeneratorService(); + + public ApplicationInstanceController(ILogger logger, InstanceDatabaseService instanceService, UserDatabaseService userService, ProfileLogic profileLogic, MyInfoMateDbContext myInfoMateDbContext) + { + _logger = logger; + _instanceService = instanceService; + _userService = userService; + _profileLogic = profileLogic; + _myInfoMateDbContext = myInfoMateDbContext; + } + + /// + /// Get a list of all applicationInstance (summary) + /// + /// instance id + [AllowAnonymous] + [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(string), 500)] + [HttpGet] + public ObjectResult Get([FromQuery] string instanceId) + { + try + { + List applicationInstances = _myInfoMateDbContext.ApplicationInstances.Where(ai => ai.InstanceId == instanceId).ToList(); + + return new OkObjectResult(applicationInstances.Select(ai => ai.ToDTO()).OrderBy(c => c.AppType)); + } + catch (Exception ex) + { + return new ObjectResult(ex.Message) { StatusCode = 500 }; + } + } + + /// + /// Create a new application instance + /// + /// New application instance info + [ProducesResponseType(typeof(ApplicationInstanceDTO), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 409)] + [ProducesResponseType(typeof(string), 500)] + [HttpPost] + public ObjectResult Create([FromBody] ApplicationInstanceDTO newApplicationInstanceDTO) + { + try + { + if (newApplicationInstanceDTO == null) + throw new ArgumentNullException("Application instance param is null"); + + // Todo add some verification ? + ApplicationInstance applicationInstance = new ApplicationInstance(); + applicationInstance.FromDTO(newApplicationInstanceDTO); + applicationInstance.Id = idService.GenerateHexId(); + + _myInfoMateDbContext.ApplicationInstances.Add(applicationInstance); + + _myInfoMateDbContext.SaveChanges(); + + return new OkObjectResult(applicationInstance.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 }; + } + } + + + + /// + /// Update an application instance + /// + /// application instance to update + [ProducesResponseType(typeof(ApplicationInstanceDTO), 200)] + [ProducesResponseType(typeof(string), 400)] + [ProducesResponseType(typeof(string), 404)] + [ProducesResponseType(typeof(string), 500)] + [HttpPut] + public ObjectResult Update([FromBody] ApplicationInstanceDTO updatedApplicationInstanceDTO) + { + try + { + if (updatedApplicationInstanceDTO == null) + throw new ArgumentNullException("application instance param is null"); + + ApplicationInstance applicationInstance = _myInfoMateDbContext.ApplicationInstances.FirstOrDefault(ai => ai.Id == updatedApplicationInstanceDTO.Id); + + if (applicationInstance == null) + throw new KeyNotFoundException("application instance does not exist"); + + applicationInstance.FromDTO(updatedApplicationInstanceDTO); + + _myInfoMateDbContext.SaveChanges(); + + return new OkObjectResult(applicationInstance.ToDTO()); + } + 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 }; + } + } + + /// + /// Delete an application instance + /// + /// Id of application instance to delete + [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("application instance param is null"); + + ApplicationInstance applicationInstance = _myInfoMateDbContext.ApplicationInstances.FirstOrDefault(ai => ai.Id == id); + + if (applicationInstance == null) + throw new KeyNotFoundException("application instance does not exist"); + + //_instanceService.Remove(id); + _myInfoMateDbContext.ApplicationInstances.Remove(applicationInstance); + + _myInfoMateDbContext.SaveChanges(); + + return new ObjectResult("The application instance 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 }; + } + } + } +} diff --git a/ManagerService/Controllers/InstanceController.cs b/ManagerService/Controllers/InstanceController.cs index 794f25a..9ebd076 100644 --- a/ManagerService/Controllers/InstanceController.cs +++ b/ManagerService/Controllers/InstanceController.cs @@ -234,20 +234,19 @@ namespace ManagerService.Controllers //OldInstance instance = _instanceService.GetById(id); Instance instance = _myInfoMateDbContext.Instances.FirstOrDefault(i => i.Id == id); + if (instance == null) + throw new KeyNotFoundException("instance does not exist"); + // Delete all user in instance //List users = _userService.GetByInstanceId(instance.Id); List users = _myInfoMateDbContext.Users.Where(u => u.InstanceId == instance.Id).ToList(); - foreach (var user in users) { //_userService.Remove(user.Id); _myInfoMateDbContext.Users.Remove(user); } - if (instance == null) - throw new KeyNotFoundException("instance does not exist"); - //_instanceService.Remove(id); _myInfoMateDbContext.Instances.Remove(instance); diff --git a/ManagerService/Controllers/SectionController.cs b/ManagerService/Controllers/SectionController.cs index 17ecc8f..58189d4 100644 --- a/ManagerService/Controllers/SectionController.cs +++ b/ManagerService/Controllers/SectionController.cs @@ -5,6 +5,7 @@ using Manager.Services; using ManagerService.Data; using ManagerService.Data.SubSection; using ManagerService.DTOs; +using ManagerService.Helpers; using ManagerService.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -181,9 +182,8 @@ namespace ManagerService.Controllers phone = geoPoint.Phone, email = geoPoint.Email, site = geoPoint.Site, - geometryType = geoPoint.GeometryType, polyColor = geoPoint.PolyColor, - coordinates = geoPoint.Coordinates, + geometry = geoPoint.Geometry?.ToDto() }); } (dto as MapDTO).points = geoPointDTOs; @@ -237,9 +237,8 @@ namespace ManagerService.Controllers phone = geoPointSub.Phone, email = geoPointSub.Email, site = geoPointSub.Site, - geometryType = geoPointSub.GeometryType, polyColor = geoPointSub.PolyColor, - coordinates = geoPointSub.Coordinates + geometry = geoPointSub.Geometry?.ToDto() }); } (subDTO as MapDTO).points = geoPointDTOsSub; diff --git a/ManagerService/Controllers/SectionMapController.cs b/ManagerService/Controllers/SectionMapController.cs index dd8648a..81694aa 100644 --- a/ManagerService/Controllers/SectionMapController.cs +++ b/ManagerService/Controllers/SectionMapController.cs @@ -1,6 +1,7 @@ using Manager.DTOs; using ManagerService.Data; using ManagerService.Data.SubSection; +using ManagerService.Helpers; using ManagerService.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -66,8 +67,7 @@ namespace ManagerService.Controllers description = point.Description, contents = point.Contents, categorieId = point.CategorieId, - geometryType = point.GeometryType, - coordinates = point.Coordinates, // TODO test that + geometry = point.Geometry?.ToDto(), polyColor = point.PolyColor, imageResourceId = point.ImageResourceId, imageUrl = point.ImageUrl, @@ -121,8 +121,14 @@ namespace ManagerService.Controllers geoPoint.Description = geoPointDTO.description; geoPoint.Contents = geoPointDTO.contents; geoPoint.CategorieId = geoPointDTO.categorieId; - geoPoint.GeometryType = geoPointDTO.geometryType; - geoPoint.Coordinates = geoPointDTO.coordinates; // TODO TEST + if (geoPointDTO.geometry != null) + { + geoPoint.Geometry = geoPointDTO.geometry.FromDto(); + } + else + { + geoPoint.Geometry = null; + } geoPoint.PolyColor = geoPointDTO.polyColor; geoPoint.ImageResourceId = geoPointDTO.imageResourceId; geoPoint.ImageUrl = geoPointDTO.imageUrl; // TO BE TESTED ? Depends on front @@ -147,8 +153,7 @@ namespace ManagerService.Controllers description = geoPoint.Description, contents = geoPoint.Contents, categorieId = geoPoint.CategorieId, - geometryType = geoPointDTO.geometryType, - coordinates = geoPointDTO.coordinates, // TODO TEST + geometry = geoPoint.Geometry?.ToDto(), polyColor = geoPointDTO.polyColor, imageResourceId = geoPoint.ImageResourceId, imageUrl = geoPoint.ImageUrl, @@ -199,8 +204,7 @@ namespace ManagerService.Controllers existingGeoPoint.Description = geoPointDTO.description; existingGeoPoint.Contents = geoPointDTO.contents; existingGeoPoint.CategorieId = geoPointDTO.categorieId; - existingGeoPoint.GeometryType = geoPointDTO.geometryType; - existingGeoPoint.Coordinates = geoPointDTO.coordinates; // TODO TEST + existingGeoPoint.Geometry = geoPointDTO.geometry.FromDto(); existingGeoPoint.PolyColor = geoPointDTO.polyColor; existingGeoPoint.ImageResourceId = geoPointDTO.imageResourceId; existingGeoPoint.ImageUrl = geoPointDTO.imageUrl; diff --git a/ManagerService/DTOs/EventAgendaDTO.cs b/ManagerService/DTOs/EventAgendaDTO.cs index e3a4566..226be6e 100644 --- a/ManagerService/DTOs/EventAgendaDTO.cs +++ b/ManagerService/DTOs/EventAgendaDTO.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System; using static ManagerService.Data.SubSection.SectionEvent; +using Manager.DTOs; namespace ManagerService.DTOs { @@ -53,9 +54,7 @@ namespace ManagerService.DTOs public string Country { get; set; } - public GeometryType GeometryType { get; set; } - - public List Coordinates { get; set; } = new(); // 1 point = marker, plusieurs = polyline/polygon + public GeometryDTO Geometry { get; set; } public string PolyColor { get; set; } // color of the polyline or polygon diff --git a/ManagerService/DTOs/SubSection/MapDTO.cs b/ManagerService/DTOs/SubSection/MapDTO.cs index f98ccd6..0a15d19 100644 --- a/ManagerService/DTOs/SubSection/MapDTO.cs +++ b/ManagerService/DTOs/SubSection/MapDTO.cs @@ -1,9 +1,5 @@ -using ManagerService.Data; -using ManagerService.Data.SubSection; -using ManagerService.DTOs; +using ManagerService.DTOs; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations.Schema; -using static ManagerService.Data.SubSection.SectionEvent; namespace Manager.DTOs { @@ -35,8 +31,7 @@ namespace Manager.DTOs public List phone { get; set; } public List email { get; set; } public List site { get; set; } - public GeometryType geometryType { get; set; } - public List coordinates { get; set; } = new(); // 1 point = marker, plusieurs = polyline/polygon + public GeometryDTO geometry { get; set; } public string polyColor { get; set; } // color of the polyline or polygon } @@ -49,6 +44,12 @@ namespace Manager.DTOs public int? order { get; set; } // Order to show } + public class GeometryDTO + { + public string Type { get; set; } // "Point", "Polygon", "LineString" + public object Coordinates { get; set; } + } + /*public class ContentGeoPoint { public string resourceId { get; set; } diff --git a/ManagerService/Data/MyInfoMateDbContext.cs b/ManagerService/Data/MyInfoMateDbContext.cs index 34d6fb2..68084f8 100644 --- a/ManagerService/Data/MyInfoMateDbContext.cs +++ b/ManagerService/Data/MyInfoMateDbContext.cs @@ -19,6 +19,10 @@ namespace ManagerService.Data public DbSet Resources { get; set; } public DbSet Users { get; set; } + public DbSet ApplicationInstances { get; set; } + public DbSet AppConfigurationLinks { get; set; } + + // MAP public DbSet GeoPoints { get; set; } @@ -28,6 +32,13 @@ namespace ManagerService.Data public DbSet GuidedPaths { get; set; } public DbSet GuidedSteps { get; set; } + // Events + public DbSet ProgrammeBlocks { get; set; } + + // Agenda + public DbSet EventAgendas { get; set; } + + protected override void OnModelCreating(ModelBuilder modelBuilder) { var options = new JsonSerializerOptions @@ -36,6 +47,7 @@ namespace ManagerService.Data }; base.OnModelCreating(modelBuilder); + modelBuilder.Entity() .Property(s => s.Title) .HasColumnType("jsonb") @@ -58,6 +70,16 @@ namespace ManagerService.Data .HasValue("Weather") .HasValue("Web"); + /*modelBuilder.Entity(entity => + { + entity.Property(e => e.Geometry).HasColumnType("geometry"); + }); + + modelBuilder.Entity(entity => + { + entity.Property(e => e.Geometry).HasColumnType("geometry"); + });*/ + modelBuilder.Entity
() .Property(s => s.Title) .HasColumnType("jsonb") @@ -86,13 +108,6 @@ namespace ManagerService.Data v => JsonSerializer.Serialize(v, options), v => JsonSerializer.Deserialize>(v, options)); - modelBuilder.Entity() - .Property(s => s.Coordinates) - .HasColumnType("jsonb") - .HasConversion( - v => JsonSerializer.Serialize(v, options), - v => JsonSerializer.Deserialize>(v, options)); - modelBuilder.Entity() .Property(s => s.Contents) .HasColumnType("jsonb") @@ -193,19 +208,26 @@ namespace ManagerService.Data v => JsonSerializer.Serialize(v, options), v => JsonSerializer.Deserialize>(v, options)); - modelBuilder.Entity() - .Property(gp => gp.Coordinates) + modelBuilder.Entity() + .Property(s => s.Label) .HasColumnType("jsonb") .HasConversion( v => JsonSerializer.Serialize(v, options), - v => JsonSerializer.Deserialize>(v, options)); + v => JsonSerializer.Deserialize>(v, options)); - modelBuilder.Entity() - .Property(s => s.Coordinates) + modelBuilder.Entity() + .Property(s => s.Description) .HasColumnType("jsonb") .HasConversion( v => JsonSerializer.Serialize(v, options), - v => JsonSerializer.Deserialize>(v, options)); + v => JsonSerializer.Deserialize>(v, options)); + + modelBuilder.Entity() + .Property(s => s.Address) + .HasColumnType("jsonb") + .HasConversion( + v => JsonSerializer.Serialize(v, options), + v => JsonSerializer.Deserialize(v, options)); } } } diff --git a/ManagerService/Data/SubSection/EventAgenda.cs b/ManagerService/Data/SubSection/EventAgenda.cs index cedb86b..02aff80 100644 --- a/ManagerService/Data/SubSection/EventAgenda.cs +++ b/ManagerService/Data/SubSection/EventAgenda.cs @@ -1,5 +1,6 @@ using Manager.DTOs; using ManagerService.DTOs; +using NetTopologySuite.Geometries; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -75,9 +76,7 @@ namespace ManagerService.Data.SubSection public string Country { get; set; } - public GeometryType GeometryType { get; set; } - - public List Coordinates { get; set; } = new(); // 1 point = marker, plusieurs = polyline/polygon + public Geometry Geometry { get; set; } public string PolyColor { get; set; } // color of the polyline or polygon diff --git a/ManagerService/Data/SubSection/SectionEvent.cs b/ManagerService/Data/SubSection/SectionEvent.cs index 5ee15ec..abc340c 100644 --- a/ManagerService/Data/SubSection/SectionEvent.cs +++ b/ManagerService/Data/SubSection/SectionEvent.cs @@ -1,4 +1,5 @@ using ManagerService.DTOs; +using NetTopologySuite.Geometries; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -41,8 +42,8 @@ namespace ManagerService.Data.SubSection [Column(TypeName = "jsonb")] public List Label { get; set; } public GeometryType GeometryType { get; set; } - [Column(TypeName = "jsonb")] - public List Coordinates { get; set; } = new(); // 1 point = marker, plusieurs = polyline/polygon + public Geometry Geometry { get; set; } // Peut être Point, LineString, Polygon + public string PolyColor { get; set; } public string Icon { get; set; } // icon material if point public ResourceDTO IconResourceDTO { get; set; } // Icon if point } @@ -55,12 +56,6 @@ namespace ManagerService.Data.SubSection Polygon } - public class Coordinate - { - public double Latitude { get; set; } - public double Longitude { get; set; } - } - /*public EventDTO ToDTO() { return new EventDTO() diff --git a/ManagerService/Data/SubSection/SectionMap.cs b/ManagerService/Data/SubSection/SectionMap.cs index 4d9c9fc..5ef75cd 100644 --- a/ManagerService/Data/SubSection/SectionMap.cs +++ b/ManagerService/Data/SubSection/SectionMap.cs @@ -1,5 +1,6 @@ using Manager.DTOs; using ManagerService.DTOs; +using NetTopologySuite.Geometries; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -82,10 +83,7 @@ namespace ManagerService.Data.SubSection public int? CategorieId { get; set; } - public GeometryType GeometryType { get; set; } - - [Column(TypeName = "jsonb")] - public List Coordinates { get; set; } = new(); // 1 point = marker, plusieurs = polyline/polygon + public Geometry Geometry { get; set; } public string PolyColor { get; set; } // color of the polyline or polygon @@ -179,10 +177,7 @@ namespace ManagerService.Data.SubSection [Column(TypeName = "jsonb")] public List Description { get; set; } - public GeometryType GeometryType { get; set; } = GeometryType.Point; // Polygon, Circle, Point - - [Column(TypeName = "jsonb")] - public List Coordinates { get; set; } = new(); // Polygon ou centre du cercle + public Geometry Geometry { get; set; } // Polygon ou centre du cercle public double? ZoneRadiusMeters { get; set; } // Optionnel, utile si zone cercle ou point diff --git a/ManagerService/Deployment/README.md b/ManagerService/Deployment/README.md index cbbb89d..be4b467 100644 --- a/ManagerService/Deployment/README.md +++ b/ManagerService/Deployment/README.md @@ -6,4 +6,8 @@ gsutil cors get gs://mymuseum-3b97f.appspot.com Pour le moment : -[{"maxAgeSeconds": 3600, "method": ["GET", "POST", "DELETE", "PUT"], "origin": ["http://localhost:49430", "https://manager.myinfomate.be", "https://manager.mymuseum.be", "https://fortsaintheribert.mymuseum.be", "https://fortsaintheribert.myinfomate.be", "https://visitnamur.myinfomate.be"]}] \ No newline at end of file +[{"maxAgeSeconds": 3600, "method": ["GET", "POST", "DELETE", "PUT"], "origin": ["http://localhost:49430", "https://manager.myinfomate.be", "https://manager.mymuseum.be", "https://fortsaintheribert.mymuseum.be", "https://fortsaintheribert.myinfomate.be", "https://visitnamur.myinfomate.be"]}] + +Pour support postgis, attention image docker postgis + => + +CREATE EXTENSION postgis SCHEMA public; \ No newline at end of file diff --git a/ManagerService/Deployment/docker-compose.dev.yaml b/ManagerService/Deployment/docker-compose.dev.yaml index 7990e20..7b526a3 100644 --- a/ManagerService/Deployment/docker-compose.dev.yaml +++ b/ManagerService/Deployment/docker-compose.dev.yaml @@ -3,7 +3,7 @@ version: '3.9' services: postgres: - image: postgres:16 + image: postgis/postgis:16-3.4 container_name: myim_postgres environment: POSTGRES_USER: ${POSTGRES_USER} diff --git a/ManagerService/Deployment/docker-compose.preprod.yaml b/ManagerService/Deployment/docker-compose.preprod.yaml index ff87c5d..a84982a 100644 --- a/ManagerService/Deployment/docker-compose.preprod.yaml +++ b/ManagerService/Deployment/docker-compose.preprod.yaml @@ -3,7 +3,7 @@ version: '3.9' services: postgres: - image: postgres:16 + image: postgis/postgis:16-3.4 container_name: myim_postgres environment: POSTGRES_USER: ${POSTGRES_USER} diff --git a/ManagerService/Helpers/GeometryMapper.cs b/ManagerService/Helpers/GeometryMapper.cs new file mode 100644 index 0000000..8096938 --- /dev/null +++ b/ManagerService/Helpers/GeometryMapper.cs @@ -0,0 +1,77 @@ +using Manager.DTOs; +using NetTopologySuite; +using NetTopologySuite.Geometries; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System; + +namespace ManagerService.Helpers +{ + public static class GeometryMapper + { + public static GeometryDTO ToDto(this Geometry geometry) + { + return geometry switch + { + Point point => new GeometryDTO + { + Type = "Point", + Coordinates = new List { point.X, point.Y } + }, + LineString line => new GeometryDTO + { + Type = "LineString", + Coordinates = line.Coordinates + .Select(coord => new List { coord.X, coord.Y }) + .ToList() + }, + Polygon polygon => new GeometryDTO + { + Type = "Polygon", + Coordinates = new List>> + { + polygon.ExteriorRing.Coordinates + .Select(coord => new List { coord.X, coord.Y }) + .ToList() + } + }, + _ => throw new NotSupportedException($"Geometry type {geometry.GeometryType} not supported.") + }; + } + + public static Geometry FromDto(this GeometryDTO dto, GeometryFactory factory = null!) + { + factory ??= NtsGeometryServices.Instance.CreateGeometryFactory(); + + return dto.Type switch + { + "Point" => CreatePoint(dto, factory), + "LineString" => CreateLineString(dto, factory), + "Polygon" => CreatePolygon(dto, factory), + _ => throw new NotSupportedException($"DTO type {dto.Type} not supported.") + }; + } + + private static Point CreatePoint(GeometryDTO dto, GeometryFactory factory) + { + var coords = ((JsonElement)dto.Coordinates).Deserialize>(); + return factory.CreatePoint(new Coordinate(coords[0], coords[1])); + } + + private static LineString CreateLineString(GeometryDTO dto, GeometryFactory factory) + { + var coords = ((JsonElement)dto.Coordinates).Deserialize>>(); + var coordinates = coords.Select(c => new Coordinate(c[0], c[1])).ToArray(); + return factory.CreateLineString(coordinates); + } + + private static Polygon CreatePolygon(GeometryDTO dto, GeometryFactory factory) + { + var rings = ((JsonElement)dto.Coordinates).Deserialize>>>(); + var exterior = rings.First().Select(c => new Coordinate(c[0], c[1])).ToArray(); + return factory.CreatePolygon(exterior); + } + } + +} diff --git a/ManagerService/ManagerService.csproj b/ManagerService/ManagerService.csproj index 32560aa..f97838b 100644 --- a/ManagerService/ManagerService.csproj +++ b/ManagerService/ManagerService.csproj @@ -17,6 +17,7 @@ + diff --git a/ManagerService/Migrations/20250710194737_UpdateCoordinatesToGeom.Designer.cs b/ManagerService/Migrations/20250710194737_UpdateCoordinatesToGeom.Designer.cs new file mode 100644 index 0000000..33bbaae --- /dev/null +++ b/ManagerService/Migrations/20250710194737_UpdateCoordinatesToGeom.Designer.cs @@ -0,0 +1,1194 @@ +// +using System; +using System.Collections.Generic; +using Manager.DTOs; +using ManagerService.DTOs; +using ManagerService.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NetTopologySuite.Geometries; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace ManagerService.Migrations +{ + [DbContext(typeof(MyInfoMateDbContext))] + [Migration("20250710194737_UpdateCoordinatesToGeom")] + partial class UpdateCoordinatesToGeom + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.2") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("ManagerService.DTOs.ResourceDTO", b => + { + b.Property("id") + .HasColumnType("text"); + + b.Property("dateCreation") + .HasColumnType("timestamp with time zone"); + + b.Property("instanceId") + .HasColumnType("text"); + + b.Property("label") + .HasColumnType("text"); + + b.Property("type") + .HasColumnType("integer"); + + b.Property("url") + .HasColumnType("text"); + + b.HasKey("id"); + + b.ToTable("ResourceDTO"); + }); + + modelBuilder.Entity("ManagerService.Data.AppConfigurationLink", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ApplicationInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ConfigurationId") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("WeightMasonryGrid") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationInstanceId"); + + b.HasIndex("ConfigurationId"); + + b.ToTable("AppConfigurationLinks"); + }); + + modelBuilder.Entity("ManagerService.Data.ApplicationInstance", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("AppType") + .HasColumnType("integer"); + + b.Property("InstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsDate") + .HasColumnType("boolean"); + + b.Property("IsHour") + .HasColumnType("boolean"); + + b.Property("IsSectionImageBackground") + .HasColumnType("boolean"); + + b.PrimitiveCollection>("Languages") + .HasColumnType("text[]"); + + b.Property("LayoutMainPage") + .HasColumnType("integer"); + + b.Property("LoaderImageId") + .HasColumnType("text"); + + b.Property("LoaderImageUrl") + .HasColumnType("text"); + + b.Property("MainImageId") + .HasColumnType("text"); + + b.Property("MainImageUrl") + .HasColumnType("text"); + + b.Property("PrimaryColor") + .HasColumnType("text"); + + b.Property("RoundedValue") + .HasColumnType("integer"); + + b.Property("ScreenPercentageSectionsMainPage") + .HasColumnType("integer"); + + b.Property("SecondaryColor") + .HasColumnType("text"); + + b.Property("SectionEventId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("SectionEventId"); + + b.ToTable("ApplicationInstances"); + }); + + modelBuilder.Entity("ManagerService.Data.Configuration", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("DateCreation") + .HasColumnType("timestamp with time zone"); + + b.Property("ImageId") + .HasColumnType("text"); + + b.Property("ImageSource") + .HasColumnType("text"); + + b.Property("InstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsOffline") + .HasColumnType("boolean"); + + b.Property("IsQRCode") + .HasColumnType("boolean"); + + b.Property("Label") + .IsRequired() + .HasColumnType("text"); + + b.PrimitiveCollection>("Languages") + .HasColumnType("text[]"); + + b.Property("LoaderImageId") + .HasColumnType("text"); + + b.Property("LoaderImageUrl") + .HasColumnType("text"); + + b.Property("PrimaryColor") + .HasColumnType("text"); + + b.Property("SecondaryColor") + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("jsonb"); + + b.HasKey("Id"); + + b.ToTable("Configurations"); + }); + + modelBuilder.Entity("ManagerService.Data.Device", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("BatteryLevel") + .HasColumnType("text"); + + b.Property("ConfigurationId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Connected") + .HasColumnType("boolean"); + + b.Property("ConnectionLevel") + .HasColumnType("text"); + + b.Property("DateCreation") + .HasColumnType("timestamp with time zone"); + + b.Property("DateUpdate") + .HasColumnType("timestamp with time zone"); + + b.Property("Identifier") + .HasColumnType("text"); + + b.Property("InstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("IpAddressETH") + .HasColumnType("text"); + + b.Property("IpAddressWLAN") + .HasColumnType("text"); + + b.Property("LastBatteryLevel") + .HasColumnType("timestamp with time zone"); + + b.Property("LastConnectionLevel") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ConfigurationId"); + + b.ToTable("Devices"); + }); + + modelBuilder.Entity("ManagerService.Data.Instance", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("DateCreation") + .HasColumnType("timestamp with time zone"); + + b.Property("IsMobile") + .HasColumnType("boolean"); + + b.Property("IsPushNotification") + .HasColumnType("boolean"); + + b.Property("IsStatistic") + .HasColumnType("boolean"); + + b.Property("IsTablet") + .HasColumnType("boolean"); + + b.Property("IsVR") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("PinCode") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Instances"); + }); + + modelBuilder.Entity("ManagerService.Data.Resource", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("DateCreation") + .HasColumnType("timestamp with time zone"); + + b.Property("InstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Label") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("Url") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Resources"); + }); + + modelBuilder.Entity("ManagerService.Data.Section", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("BeaconId") + .HasColumnType("integer"); + + b.Property("ConfigurationId") + .IsRequired() + .HasColumnType("text"); + + b.Property("DateCreation") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("jsonb"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(13) + .HasColumnType("character varying(13)"); + + b.Property("ImageId") + .HasColumnType("text"); + + b.Property("ImageSource") + .HasColumnType("text"); + + b.Property("InstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsBeacon") + .HasColumnType("boolean"); + + b.Property("IsSubSection") + .HasColumnType("boolean"); + + b.Property("Label") + .IsRequired() + .HasColumnType("text"); + + b.Property("Latitude") + .HasColumnType("text"); + + b.Property("Longitude") + .HasColumnType("text"); + + b.Property("MeterZoneGPS") + .HasColumnType("integer"); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("ParentId") + .HasColumnType("text"); + + b.Property("SectionMenuId") + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("isActive") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("SectionMenuId"); + + b.ToTable("Sections"); + + b.HasDiscriminator().HasValue("Base"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.EventAgenda", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .HasColumnType("jsonb"); + + b.Property("DateAdded") + .HasColumnType("timestamp with time zone"); + + b.Property("DateFrom") + .HasColumnType("timestamp with time zone"); + + b.Property("DateTo") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("Label") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("Phone") + .HasColumnType("text"); + + b.Property("ResourceId") + .HasColumnType("text"); + + b.Property("SectionAgendaId") + .HasColumnType("text"); + + b.Property("SectionEventId") + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("text"); + + b.Property("Website") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ResourceId"); + + b.HasIndex("SectionAgendaId"); + + b.HasIndex("SectionEventId"); + + b.ToTable("EventAgendas"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.GeoPoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CategorieId") + .HasColumnType("integer"); + + b.Property("Contents") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("Description") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("Email") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("Geometry") + .HasColumnType("geometry"); + + b.Property("ImageResourceId") + .HasColumnType("text"); + + b.Property("ImageUrl") + .HasColumnType("text"); + + b.Property("Phone") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("PolyColor") + .HasColumnType("text"); + + b.Property("Prices") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("Schedules") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("SectionEventId") + .HasColumnType("text"); + + b.Property("SectionMapId") + .HasColumnType("text"); + + b.Property("Site") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("Title") + .IsRequired() + .HasColumnType("jsonb"); + + b.HasKey("Id"); + + b.HasIndex("SectionEventId"); + + b.HasIndex("SectionMapId"); + + b.ToTable("GeoPoints"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.GuidedPath", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("jsonb"); + + b.Property("HideNextStepsUntilComplete") + .HasColumnType("boolean"); + + b.Property("InstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsLinear") + .HasColumnType("boolean"); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("RequireSuccessToAdvance") + .HasColumnType("boolean"); + + b.Property("SectionEventId") + .HasColumnType("text"); + + b.Property("SectionMapId") + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("jsonb"); + + b.HasKey("Id"); + + b.HasIndex("SectionEventId"); + + b.HasIndex("SectionMapId"); + + b.ToTable("GuidedPaths"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.GuidedStep", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("jsonb"); + + b.Property("ExpectedAnswer") + .HasColumnType("jsonb"); + + b.Property("Geometry") + .HasColumnType("geometry"); + + b.Property("GuidedPathId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ImageUrl") + .HasColumnType("text"); + + b.Property("IsHiddenInitially") + .HasColumnType("boolean"); + + b.Property("IsStepLocked") + .HasColumnType("boolean"); + + b.Property("IsStepTimer") + .HasColumnType("boolean"); + + b.Property("MultipleChoiceOptions") + .HasColumnType("jsonb"); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("TimerExpiredMessage") + .HasColumnType("jsonb"); + + b.Property("TimerSeconds") + .HasColumnType("integer"); + + b.Property("Title") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("TriggerGeoPointId") + .HasColumnType("integer"); + + b.Property("ValidationQuestion") + .HasColumnType("jsonb"); + + b.Property("ValidationQuestionType") + .HasColumnType("integer"); + + b.Property("ZoneRadiusMeters") + .HasColumnType("double precision"); + + b.HasKey("Id"); + + b.HasIndex("GuidedPathId"); + + b.HasIndex("TriggerGeoPointId"); + + b.ToTable("GuidedSteps"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property>("Label") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("ResourceId") + .HasColumnType("text"); + + b.Property>("Responses") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("SectionQuizId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ResourceId"); + + b.HasIndex("SectionQuizId"); + + b.ToTable("QuizQuestions"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+MapAnnotation", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Geometry") + .HasColumnType("geometry"); + + b.Property("GeometryType") + .HasColumnType("integer"); + + b.Property("Icon") + .HasColumnType("text"); + + b.Property("IconResourceDTOid") + .HasColumnType("text"); + + b.Property>("Label") + .HasColumnType("jsonb"); + + b.Property("PolyColor") + .HasColumnType("text"); + + b.Property("ProgrammeBlockId") + .HasColumnType("text"); + + b.Property>("Type") + .HasColumnType("jsonb"); + + b.HasKey("Id"); + + b.HasIndex("IconResourceDTOid"); + + b.HasIndex("ProgrammeBlockId"); + + b.ToTable("MapAnnotation"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+ProgrammeBlock", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property>("Description") + .HasColumnType("jsonb"); + + b.Property("EndTime") + .HasColumnType("timestamp with time zone"); + + b.Property("SectionEventId") + .HasColumnType("text"); + + b.Property("StartTime") + .HasColumnType("timestamp with time zone"); + + b.Property>("Title") + .HasColumnType("jsonb"); + + b.HasKey("Id"); + + b.HasIndex("SectionEventId"); + + b.ToTable("ProgrammeBlocks"); + }); + + modelBuilder.Entity("ManagerService.Data.User", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("DateCreation") + .HasColumnType("timestamp with time zone"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("FirstName") + .HasColumnType("text"); + + b.Property("InstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Password") + .IsRequired() + .HasColumnType("text"); + + b.Property("Token") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionAgenda", b => + { + b.HasBaseType("ManagerService.Data.Section"); + + b.Property("AgendaMapProvider") + .HasColumnType("integer"); + + b.Property>("AgendaResourceIds") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("IsOnlineAgenda") + .HasColumnType("boolean"); + + b.HasDiscriminator().HasValue("Agenda"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionArticle", b => + { + b.HasBaseType("ManagerService.Data.Section"); + + b.Property>("ArticleAudioIds") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property>("ArticleContent") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property>("ArticleContents") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("ArticleIsContentTop") + .HasColumnType("boolean"); + + b.Property("ArticleIsReadAudioAuto") + .HasColumnType("boolean"); + + b.HasDiscriminator().HasValue("Article"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent", b => + { + b.HasBaseType("ManagerService.Data.Section"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property>("ParcoursIds") + .HasColumnType("jsonb"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.HasDiscriminator().HasValue("SectionEvent"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b => + { + b.HasBaseType("ManagerService.Data.Section"); + + b.Property>("MapCategories") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("MapCenterLatitude") + .HasColumnType("text"); + + b.Property("MapCenterLongitude") + .HasColumnType("text"); + + b.Property("MapMapProvider") + .HasColumnType("integer"); + + b.Property("MapMapType") + .HasColumnType("integer"); + + b.Property("MapResourceId") + .HasColumnType("text"); + + b.Property("MapTypeMapbox") + .HasColumnType("integer"); + + b.Property("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>("PDFOrderedTranslationAndResources") + .IsRequired() + .HasColumnType("jsonb"); + + b.HasDiscriminator().HasValue("PDF"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionPuzzle", b => + { + b.HasBaseType("ManagerService.Data.Section"); + + b.Property("IsSlidingPuzzle") + .HasColumnType("boolean"); + + b.Property("PuzzleCols") + .HasColumnType("integer"); + + b.Property("PuzzleImageId") + .HasColumnType("text"); + + b.Property>("PuzzleMessageDebut") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property>("PuzzleMessageFin") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("PuzzleRows") + .HasColumnType("integer"); + + b.HasIndex("PuzzleImageId"); + + b.HasDiscriminator().HasValue("Puzzle"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionQuiz", b => + { + b.HasBaseType("ManagerService.Data.Section"); + + b.Property>("QuizBadLevel") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property>("QuizGoodLevel") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property>("QuizGreatLevel") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property>("QuizMediumLevel") + .IsRequired() + .HasColumnType("jsonb"); + + b.HasDiscriminator().HasValue("Quiz"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionSlider", b => + { + b.HasBaseType("ManagerService.Data.Section"); + + b.Property>("SliderContents") + .IsRequired() + .HasColumnType("jsonb"); + + b.HasDiscriminator().HasValue("Slider"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionVideo", b => + { + b.HasBaseType("ManagerService.Data.Section"); + + b.Property("VideoSource") + .IsRequired() + .HasColumnType("text"); + + b.HasDiscriminator().HasValue("Video"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionWeather", b => + { + b.HasBaseType("ManagerService.Data.Section"); + + b.Property("WeatherCity") + .HasColumnType("text"); + + b.Property("WeatherResult") + .HasColumnType("text"); + + b.Property("WeatherUpdatedDate") + .HasColumnType("timestamp with time zone"); + + b.HasDiscriminator().HasValue("Weather"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionWeb", b => + { + b.HasBaseType("ManagerService.Data.Section"); + + b.Property("WebSource") + .IsRequired() + .HasColumnType("text"); + + b.HasDiscriminator().HasValue("Web"); + }); + + modelBuilder.Entity("ManagerService.Data.AppConfigurationLink", b => + { + b.HasOne("ManagerService.Data.ApplicationInstance", "ApplicationInstance") + .WithMany("Configurations") + .HasForeignKey("ApplicationInstanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ManagerService.Data.Configuration", "Configuration") + .WithMany() + .HasForeignKey("ConfigurationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationInstance"); + + b.Navigation("Configuration"); + }); + + modelBuilder.Entity("ManagerService.Data.ApplicationInstance", b => + { + b.HasOne("ManagerService.Data.SubSection.SectionEvent", "SectionEvent") + .WithMany() + .HasForeignKey("SectionEventId"); + + b.Navigation("SectionEvent"); + }); + + 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.EventAgenda", b => + { + b.HasOne("ManagerService.Data.Resource", "Resource") + .WithMany() + .HasForeignKey("ResourceId"); + + b.HasOne("ManagerService.Data.SubSection.SectionAgenda", "SectionAgenda") + .WithMany("EventAgendas") + .HasForeignKey("SectionAgendaId"); + + b.HasOne("ManagerService.Data.SubSection.SectionEvent", "SectionEvent") + .WithMany() + .HasForeignKey("SectionEventId"); + + b.Navigation("Resource"); + + b.Navigation("SectionAgenda"); + + b.Navigation("SectionEvent"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.GeoPoint", b => + { + b.HasOne("ManagerService.Data.SubSection.SectionEvent", "SectionEvent") + .WithMany() + .HasForeignKey("SectionEventId"); + + b.HasOne("ManagerService.Data.SubSection.SectionMap", "SectionMap") + .WithMany("MapPoints") + .HasForeignKey("SectionMapId"); + + b.Navigation("SectionEvent"); + + b.Navigation("SectionMap"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.GuidedPath", b => + { + b.HasOne("ManagerService.Data.SubSection.SectionEvent", "SectionEvent") + .WithMany() + .HasForeignKey("SectionEventId"); + + b.HasOne("ManagerService.Data.SubSection.SectionMap", "SectionMap") + .WithMany() + .HasForeignKey("SectionMapId"); + + b.Navigation("SectionEvent"); + + b.Navigation("SectionMap"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.GuidedStep", b => + { + b.HasOne("ManagerService.Data.SubSection.GuidedPath", "GuidedPath") + .WithMany("Steps") + .HasForeignKey("GuidedPathId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ManagerService.Data.SubSection.GeoPoint", "TriggerGeoPoint") + .WithMany() + .HasForeignKey("TriggerGeoPointId"); + + b.Navigation("GuidedPath"); + + b.Navigation("TriggerGeoPoint"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b => + { + b.HasOne("ManagerService.Data.Resource", "Resource") + .WithMany() + .HasForeignKey("ResourceId"); + + b.HasOne("ManagerService.Data.SubSection.SectionQuiz", "SectionQuiz") + .WithMany("QuizQuestions") + .HasForeignKey("SectionQuizId"); + + b.Navigation("Resource"); + + b.Navigation("SectionQuiz"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+MapAnnotation", b => + { + b.HasOne("ManagerService.DTOs.ResourceDTO", "IconResourceDTO") + .WithMany() + .HasForeignKey("IconResourceDTOid"); + + b.HasOne("ManagerService.Data.SubSection.SectionEvent+ProgrammeBlock", null) + .WithMany("MapAnnotations") + .HasForeignKey("ProgrammeBlockId"); + + b.Navigation("IconResourceDTO"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+ProgrammeBlock", b => + { + b.HasOne("ManagerService.Data.SubSection.SectionEvent", null) + .WithMany("Programme") + .HasForeignKey("SectionEventId"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b => + { + b.HasOne("ManagerService.Data.Resource", "MapResource") + .WithMany() + .HasForeignKey("MapResourceId"); + + b.Navigation("MapResource"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionPuzzle", b => + { + b.HasOne("ManagerService.Data.Resource", "PuzzleImage") + .WithMany() + .HasForeignKey("PuzzleImageId"); + + b.Navigation("PuzzleImage"); + }); + + modelBuilder.Entity("ManagerService.Data.ApplicationInstance", b => + { + b.Navigation("Configurations"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.GuidedPath", b => + { + b.Navigation("Steps"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+ProgrammeBlock", b => + { + b.Navigation("MapAnnotations"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionAgenda", b => + { + b.Navigation("EventAgendas"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent", b => + { + b.Navigation("Programme"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b => + { + b.Navigation("MapPoints"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionMenu", b => + { + b.Navigation("MenuSections"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionQuiz", b => + { + b.Navigation("QuizQuestions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/ManagerService/Migrations/20250710194737_UpdateCoordinatesToGeom.cs b/ManagerService/Migrations/20250710194737_UpdateCoordinatesToGeom.cs new file mode 100644 index 0000000..1e38be6 --- /dev/null +++ b/ManagerService/Migrations/20250710194737_UpdateCoordinatesToGeom.cs @@ -0,0 +1,401 @@ +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; +using NetTopologySuite.Geometries; + +#nullable disable + +namespace ManagerService.Migrations +{ + /// + public partial class UpdateCoordinatesToGeom : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_EventAgenda_Resources_ResourceId", + table: "EventAgenda"); + + migrationBuilder.DropForeignKey( + name: "FK_EventAgenda_Sections_SectionAgendaId", + table: "EventAgenda"); + + migrationBuilder.DropForeignKey( + name: "FK_EventAgenda_Sections_SectionEventId", + table: "EventAgenda"); + + migrationBuilder.DropForeignKey( + name: "FK_MapAnnotation_ProgrammeBlock_ProgrammeBlockId", + table: "MapAnnotation"); + + migrationBuilder.DropForeignKey( + name: "FK_ProgrammeBlock_Sections_SectionEventId", + table: "ProgrammeBlock"); + + migrationBuilder.DropPrimaryKey( + name: "PK_ProgrammeBlock", + table: "ProgrammeBlock"); + + migrationBuilder.DropPrimaryKey( + name: "PK_EventAgenda", + table: "EventAgenda"); + + migrationBuilder.DropColumn( + name: "Coordinates", + table: "MapAnnotation"); + + migrationBuilder.DropColumn( + name: "Coordinates", + table: "GuidedSteps"); + + migrationBuilder.DropColumn( + name: "GeometryType", + table: "GuidedSteps"); + + migrationBuilder.DropColumn( + name: "Coordinates", + table: "GeoPoints"); + + migrationBuilder.DropColumn( + name: "GeometryType", + table: "GeoPoints"); + + migrationBuilder.RenameTable( + name: "ProgrammeBlock", + newName: "ProgrammeBlocks"); + + migrationBuilder.RenameTable( + name: "EventAgenda", + newName: "EventAgendas"); + + migrationBuilder.RenameIndex( + name: "IX_ProgrammeBlock_SectionEventId", + table: "ProgrammeBlocks", + newName: "IX_ProgrammeBlocks_SectionEventId"); + + migrationBuilder.RenameIndex( + name: "IX_EventAgenda_SectionEventId", + table: "EventAgendas", + newName: "IX_EventAgendas_SectionEventId"); + + migrationBuilder.RenameIndex( + name: "IX_EventAgenda_SectionAgendaId", + table: "EventAgendas", + newName: "IX_EventAgendas_SectionAgendaId"); + + migrationBuilder.RenameIndex( + name: "IX_EventAgenda_ResourceId", + table: "EventAgendas", + newName: "IX_EventAgendas_ResourceId"); + + migrationBuilder.AlterDatabase() + .Annotation("Npgsql:PostgresExtension:postgis", ",,"); + + migrationBuilder.AddColumn( + name: "Geometry", + table: "MapAnnotation", + type: "geometry", + nullable: true); + + migrationBuilder.AddColumn( + name: "PolyColor", + table: "MapAnnotation", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "Geometry", + table: "GuidedSteps", + type: "geometry", + nullable: true); + + migrationBuilder.AddColumn( + name: "Geometry", + table: "GeoPoints", + type: "geometry", + nullable: true); + + migrationBuilder.AddPrimaryKey( + name: "PK_ProgrammeBlocks", + table: "ProgrammeBlocks", + column: "Id"); + + migrationBuilder.AddPrimaryKey( + name: "PK_EventAgendas", + table: "EventAgendas", + column: "Id"); + + migrationBuilder.CreateTable( + name: "ApplicationInstances", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + InstanceId = table.Column(type: "text", nullable: false), + AppType = table.Column(type: "integer", nullable: false), + MainImageId = table.Column(type: "text", nullable: true), + MainImageUrl = table.Column(type: "text", nullable: true), + LoaderImageId = table.Column(type: "text", nullable: true), + LoaderImageUrl = table.Column(type: "text", nullable: true), + IsDate = table.Column(type: "boolean", nullable: false), + IsHour = table.Column(type: "boolean", nullable: false), + PrimaryColor = table.Column(type: "text", nullable: true), + SecondaryColor = table.Column(type: "text", nullable: true), + RoundedValue = table.Column(type: "integer", nullable: true), + ScreenPercentageSectionsMainPage = table.Column(type: "integer", nullable: true), + IsSectionImageBackground = table.Column(type: "boolean", nullable: false), + LayoutMainPage = table.Column(type: "integer", nullable: false), + Languages = table.Column>(type: "text[]", nullable: true), + SectionEventId = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ApplicationInstances", x => x.Id); + table.ForeignKey( + name: "FK_ApplicationInstances_Sections_SectionEventId", + column: x => x.SectionEventId, + principalTable: "Sections", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "AppConfigurationLinks", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + ConfigurationId = table.Column(type: "text", nullable: false), + ApplicationInstanceId = table.Column(type: "text", nullable: false), + Order = table.Column(type: "integer", nullable: true), + IsActive = table.Column(type: "boolean", nullable: false), + WeightMasonryGrid = table.Column(type: "integer", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AppConfigurationLinks", x => x.Id); + table.ForeignKey( + name: "FK_AppConfigurationLinks_ApplicationInstances_ApplicationInsta~", + column: x => x.ApplicationInstanceId, + principalTable: "ApplicationInstances", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AppConfigurationLinks_Configurations_ConfigurationId", + column: x => x.ConfigurationId, + principalTable: "Configurations", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AppConfigurationLinks_ApplicationInstanceId", + table: "AppConfigurationLinks", + column: "ApplicationInstanceId"); + + migrationBuilder.CreateIndex( + name: "IX_AppConfigurationLinks_ConfigurationId", + table: "AppConfigurationLinks", + column: "ConfigurationId"); + + migrationBuilder.CreateIndex( + name: "IX_ApplicationInstances_SectionEventId", + table: "ApplicationInstances", + column: "SectionEventId"); + + migrationBuilder.AddForeignKey( + name: "FK_EventAgendas_Resources_ResourceId", + table: "EventAgendas", + column: "ResourceId", + principalTable: "Resources", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_EventAgendas_Sections_SectionAgendaId", + table: "EventAgendas", + column: "SectionAgendaId", + principalTable: "Sections", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_EventAgendas_Sections_SectionEventId", + table: "EventAgendas", + column: "SectionEventId", + principalTable: "Sections", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_MapAnnotation_ProgrammeBlocks_ProgrammeBlockId", + table: "MapAnnotation", + column: "ProgrammeBlockId", + principalTable: "ProgrammeBlocks", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_ProgrammeBlocks_Sections_SectionEventId", + table: "ProgrammeBlocks", + column: "SectionEventId", + principalTable: "Sections", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_EventAgendas_Resources_ResourceId", + table: "EventAgendas"); + + migrationBuilder.DropForeignKey( + name: "FK_EventAgendas_Sections_SectionAgendaId", + table: "EventAgendas"); + + migrationBuilder.DropForeignKey( + name: "FK_EventAgendas_Sections_SectionEventId", + table: "EventAgendas"); + + migrationBuilder.DropForeignKey( + name: "FK_MapAnnotation_ProgrammeBlocks_ProgrammeBlockId", + table: "MapAnnotation"); + + migrationBuilder.DropForeignKey( + name: "FK_ProgrammeBlocks_Sections_SectionEventId", + table: "ProgrammeBlocks"); + + migrationBuilder.DropTable( + name: "AppConfigurationLinks"); + + migrationBuilder.DropTable( + name: "ApplicationInstances"); + + migrationBuilder.DropPrimaryKey( + name: "PK_ProgrammeBlocks", + table: "ProgrammeBlocks"); + + migrationBuilder.DropPrimaryKey( + name: "PK_EventAgendas", + table: "EventAgendas"); + + migrationBuilder.DropColumn( + name: "Geometry", + table: "MapAnnotation"); + + migrationBuilder.DropColumn( + name: "PolyColor", + table: "MapAnnotation"); + + migrationBuilder.DropColumn( + name: "Geometry", + table: "GuidedSteps"); + + migrationBuilder.DropColumn( + name: "Geometry", + table: "GeoPoints"); + + migrationBuilder.RenameTable( + name: "ProgrammeBlocks", + newName: "ProgrammeBlock"); + + migrationBuilder.RenameTable( + name: "EventAgendas", + newName: "EventAgenda"); + + migrationBuilder.RenameIndex( + name: "IX_ProgrammeBlocks_SectionEventId", + table: "ProgrammeBlock", + newName: "IX_ProgrammeBlock_SectionEventId"); + + migrationBuilder.RenameIndex( + name: "IX_EventAgendas_SectionEventId", + table: "EventAgenda", + newName: "IX_EventAgenda_SectionEventId"); + + migrationBuilder.RenameIndex( + name: "IX_EventAgendas_SectionAgendaId", + table: "EventAgenda", + newName: "IX_EventAgenda_SectionAgendaId"); + + migrationBuilder.RenameIndex( + name: "IX_EventAgendas_ResourceId", + table: "EventAgenda", + newName: "IX_EventAgenda_ResourceId"); + + migrationBuilder.AlterDatabase() + .OldAnnotation("Npgsql:PostgresExtension:postgis", ",,"); + + migrationBuilder.AddColumn( + name: "Coordinates", + table: "MapAnnotation", + type: "jsonb", + nullable: true); + + migrationBuilder.AddColumn( + name: "Coordinates", + table: "GuidedSteps", + type: "jsonb", + nullable: true); + + migrationBuilder.AddColumn( + name: "GeometryType", + table: "GuidedSteps", + type: "integer", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "Coordinates", + table: "GeoPoints", + type: "jsonb", + nullable: true); + + migrationBuilder.AddColumn( + name: "GeometryType", + table: "GeoPoints", + type: "integer", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddPrimaryKey( + name: "PK_ProgrammeBlock", + table: "ProgrammeBlock", + column: "Id"); + + migrationBuilder.AddPrimaryKey( + name: "PK_EventAgenda", + table: "EventAgenda", + column: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_EventAgenda_Resources_ResourceId", + table: "EventAgenda", + column: "ResourceId", + principalTable: "Resources", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_EventAgenda_Sections_SectionAgendaId", + table: "EventAgenda", + column: "SectionAgendaId", + principalTable: "Sections", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_EventAgenda_Sections_SectionEventId", + table: "EventAgenda", + column: "SectionEventId", + principalTable: "Sections", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_MapAnnotation_ProgrammeBlock_ProgrammeBlockId", + table: "MapAnnotation", + column: "ProgrammeBlockId", + principalTable: "ProgrammeBlock", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_ProgrammeBlock_Sections_SectionEventId", + table: "ProgrammeBlock", + column: "SectionEventId", + principalTable: "Sections", + principalColumn: "Id"); + } + } +} diff --git a/ManagerService/Migrations/MyInfoMateDbContextModelSnapshot.cs b/ManagerService/Migrations/MyInfoMateDbContextModelSnapshot.cs index b010184..f0382d7 100644 --- a/ManagerService/Migrations/MyInfoMateDbContextModelSnapshot.cs +++ b/ManagerService/Migrations/MyInfoMateDbContextModelSnapshot.cs @@ -4,10 +4,10 @@ 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.Storage.ValueConversion; +using NetTopologySuite.Geometries; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable @@ -24,6 +24,7 @@ namespace ManagerService.Migrations .HasAnnotation("ProductVersion", "9.0.2") .HasAnnotation("Relational:MaxIdentifierLength", 63); + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis"); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("ManagerService.DTOs.ResourceDTO", b => @@ -51,6 +52,98 @@ namespace ManagerService.Migrations b.ToTable("ResourceDTO"); }); + modelBuilder.Entity("ManagerService.Data.AppConfigurationLink", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ApplicationInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ConfigurationId") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("WeightMasonryGrid") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationInstanceId"); + + b.HasIndex("ConfigurationId"); + + b.ToTable("AppConfigurationLinks"); + }); + + modelBuilder.Entity("ManagerService.Data.ApplicationInstance", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("AppType") + .HasColumnType("integer"); + + b.Property("InstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsDate") + .HasColumnType("boolean"); + + b.Property("IsHour") + .HasColumnType("boolean"); + + b.Property("IsSectionImageBackground") + .HasColumnType("boolean"); + + b.PrimitiveCollection>("Languages") + .HasColumnType("text[]"); + + b.Property("LayoutMainPage") + .HasColumnType("integer"); + + b.Property("LoaderImageId") + .HasColumnType("text"); + + b.Property("LoaderImageUrl") + .HasColumnType("text"); + + b.Property("MainImageId") + .HasColumnType("text"); + + b.Property("MainImageUrl") + .HasColumnType("text"); + + b.Property("PrimaryColor") + .HasColumnType("text"); + + b.Property("RoundedValue") + .HasColumnType("integer"); + + b.Property("ScreenPercentageSectionsMainPage") + .HasColumnType("integer"); + + b.Property("SecondaryColor") + .HasColumnType("text"); + + b.Property("SectionEventId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("SectionEventId"); + + b.ToTable("ApplicationInstances"); + }); + modelBuilder.Entity("ManagerService.Data.Configuration", b => { b.Property("Id") @@ -308,7 +401,7 @@ namespace ManagerService.Migrations NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - b.Property("Address") + b.Property("Address") .HasColumnType("jsonb"); b.Property("DateAdded") @@ -320,14 +413,14 @@ namespace ManagerService.Migrations b.Property("DateTo") .HasColumnType("timestamp with time zone"); - b.Property>("Description") + b.Property("Description") .IsRequired() .HasColumnType("jsonb"); b.Property("Email") .HasColumnType("text"); - b.Property>("Label") + b.Property("Label") .IsRequired() .HasColumnType("jsonb"); @@ -357,7 +450,7 @@ namespace ManagerService.Migrations b.HasIndex("SectionEventId"); - b.ToTable("EventAgenda"); + b.ToTable("EventAgendas"); }); modelBuilder.Entity("ManagerService.Data.SubSection.GeoPoint", b => @@ -375,9 +468,6 @@ namespace ManagerService.Migrations .IsRequired() .HasColumnType("jsonb"); - b.Property("Coordinates") - .HasColumnType("jsonb"); - b.Property("Description") .IsRequired() .HasColumnType("jsonb"); @@ -386,8 +476,8 @@ namespace ManagerService.Migrations .IsRequired() .HasColumnType("jsonb"); - b.Property("GeometryType") - .HasColumnType("integer"); + b.Property("Geometry") + .HasColumnType("geometry"); b.Property("ImageResourceId") .HasColumnType("text"); @@ -481,17 +571,14 @@ namespace ManagerService.Migrations b.Property("Id") .HasColumnType("text"); - b.Property("Coordinates") - .HasColumnType("jsonb"); - b.Property("Description") .HasColumnType("jsonb"); b.Property("ExpectedAnswer") .HasColumnType("jsonb"); - b.Property("GeometryType") - .HasColumnType("integer"); + b.Property("Geometry") + .HasColumnType("geometry"); b.Property("GuidedPathId") .IsRequired() @@ -585,8 +672,8 @@ namespace ManagerService.Migrations b.Property("Id") .HasColumnType("text"); - b.Property("Coordinates") - .HasColumnType("jsonb"); + b.Property("Geometry") + .HasColumnType("geometry"); b.Property("GeometryType") .HasColumnType("integer"); @@ -600,6 +687,9 @@ namespace ManagerService.Migrations b.Property>("Label") .HasColumnType("jsonb"); + b.Property("PolyColor") + .HasColumnType("text"); + b.Property("ProgrammeBlockId") .HasColumnType("text"); @@ -639,7 +729,7 @@ namespace ManagerService.Migrations b.HasIndex("SectionEventId"); - b.ToTable("ProgrammeBlock"); + b.ToTable("ProgrammeBlocks"); }); modelBuilder.Entity("ManagerService.Data.User", b => @@ -889,6 +979,34 @@ namespace ManagerService.Migrations b.HasDiscriminator().HasValue("Web"); }); + modelBuilder.Entity("ManagerService.Data.AppConfigurationLink", b => + { + b.HasOne("ManagerService.Data.ApplicationInstance", "ApplicationInstance") + .WithMany("Configurations") + .HasForeignKey("ApplicationInstanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ManagerService.Data.Configuration", "Configuration") + .WithMany() + .HasForeignKey("ConfigurationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationInstance"); + + b.Navigation("Configuration"); + }); + + modelBuilder.Entity("ManagerService.Data.ApplicationInstance", b => + { + b.HasOne("ManagerService.Data.SubSection.SectionEvent", "SectionEvent") + .WithMany() + .HasForeignKey("SectionEventId"); + + b.Navigation("SectionEvent"); + }); + modelBuilder.Entity("ManagerService.Data.Device", b => { b.HasOne("ManagerService.Data.Configuration", "Configuration") @@ -1028,6 +1146,11 @@ namespace ManagerService.Migrations b.Navigation("PuzzleImage"); }); + modelBuilder.Entity("ManagerService.Data.ApplicationInstance", b => + { + b.Navigation("Configurations"); + }); + modelBuilder.Entity("ManagerService.Data.SubSection.GuidedPath", b => { b.Navigation("Steps"); diff --git a/ManagerService/Startup.cs b/ManagerService/Startup.cs index 799f6a4..7a3d473 100644 --- a/ManagerService/Startup.cs +++ b/ManagerService/Startup.cs @@ -160,7 +160,7 @@ namespace ManagerService var dataSource = dataSourceBuilder.Build(); services.AddDbContext(options => - options.UseNpgsql(dataSource) + options.UseNpgsql(dataSource, o => o.UseNetTopologySuite()) ); }