list of coordinates to geometry support (for sql postgis support)
This commit is contained in:
parent
c89566c9a9
commit
a051ae5f70
188
ManagerService/Controllers/ApplicationInstanceController.cs
Normal file
188
ManagerService/Controllers/ApplicationInstanceController.cs
Normal file
@ -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<ApplicationInstanceController> _logger;
|
||||
private readonly ProfileLogic _profileLogic;
|
||||
IHexIdGeneratorService idService = new HexIdGeneratorService();
|
||||
|
||||
public ApplicationInstanceController(ILogger<ApplicationInstanceController> logger, InstanceDatabaseService instanceService, UserDatabaseService userService, ProfileLogic profileLogic, MyInfoMateDbContext myInfoMateDbContext)
|
||||
{
|
||||
_logger = logger;
|
||||
_instanceService = instanceService;
|
||||
_userService = userService;
|
||||
_profileLogic = profileLogic;
|
||||
_myInfoMateDbContext = myInfoMateDbContext;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of all applicationInstance (summary)
|
||||
/// </summary>
|
||||
/// <param name="id">instance id</param>
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(List<ApplicationInstanceDTO>), 200)]
|
||||
[ProducesResponseType(typeof(string), 500)]
|
||||
[HttpGet]
|
||||
public ObjectResult Get([FromQuery] string instanceId)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<ApplicationInstance> 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 };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new application instance
|
||||
/// </summary>
|
||||
/// <param name="newApplicationInstanceDTO">New application instance info</param>
|
||||
[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 };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Update an application instance
|
||||
/// </summary>
|
||||
/// <param name="updatedApplicationInstanceDTO">application instance to update</param>
|
||||
[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 };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete an application instance
|
||||
/// </summary>
|
||||
/// <param name="id">Id of application instance 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("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 };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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<OldUser> users = _userService.GetByInstanceId(instance.Id);
|
||||
List<User> 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);
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<Coordinate> 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
|
||||
|
||||
|
||||
@ -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<TranslationDTO> phone { get; set; }
|
||||
public List<TranslationDTO> email { get; set; }
|
||||
public List<TranslationDTO> site { get; set; }
|
||||
public GeometryType geometryType { get; set; }
|
||||
public List<Coordinate> 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; }
|
||||
|
||||
@ -19,6 +19,10 @@ namespace ManagerService.Data
|
||||
public DbSet<Resource> Resources { get; set; }
|
||||
public DbSet<User> Users { get; set; }
|
||||
|
||||
public DbSet<ApplicationInstance> ApplicationInstances { get; set; }
|
||||
public DbSet<AppConfigurationLink> AppConfigurationLinks { get; set; }
|
||||
|
||||
|
||||
// MAP
|
||||
public DbSet<GeoPoint> GeoPoints { get; set; }
|
||||
|
||||
@ -28,6 +32,13 @@ namespace ManagerService.Data
|
||||
public DbSet<GuidedPath> GuidedPaths { get; set; }
|
||||
public DbSet<GuidedStep> GuidedSteps { get; set; }
|
||||
|
||||
// Events
|
||||
public DbSet<ProgrammeBlock> ProgrammeBlocks { get; set; }
|
||||
|
||||
// Agenda
|
||||
public DbSet<EventAgenda> 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<Configuration>()
|
||||
.Property(s => s.Title)
|
||||
.HasColumnType("jsonb")
|
||||
@ -58,6 +70,16 @@ namespace ManagerService.Data
|
||||
.HasValue<SectionWeather>("Weather")
|
||||
.HasValue<SectionWeb>("Web");
|
||||
|
||||
/*modelBuilder.Entity<GeoPoint>(entity =>
|
||||
{
|
||||
entity.Property(e => e.Geometry).HasColumnType("geometry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<GuidedStep>(entity =>
|
||||
{
|
||||
entity.Property(e => e.Geometry).HasColumnType("geometry");
|
||||
});*/
|
||||
|
||||
modelBuilder.Entity<Section>()
|
||||
.Property(s => s.Title)
|
||||
.HasColumnType("jsonb")
|
||||
@ -86,13 +108,6 @@ namespace ManagerService.Data
|
||||
v => JsonSerializer.Serialize(v, options),
|
||||
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
|
||||
|
||||
modelBuilder.Entity<GeoPoint>()
|
||||
.Property(s => s.Coordinates)
|
||||
.HasColumnType("jsonb")
|
||||
.HasConversion(
|
||||
v => JsonSerializer.Serialize(v, options),
|
||||
v => JsonSerializer.Deserialize<List<Coordinate>>(v, options));
|
||||
|
||||
modelBuilder.Entity<GeoPoint>()
|
||||
.Property(s => s.Contents)
|
||||
.HasColumnType("jsonb")
|
||||
@ -193,19 +208,26 @@ namespace ManagerService.Data
|
||||
v => JsonSerializer.Serialize(v, options),
|
||||
v => JsonSerializer.Deserialize<List<ChoiceOptionDTO>>(v, options));
|
||||
|
||||
modelBuilder.Entity<GuidedStep>()
|
||||
.Property(gp => gp.Coordinates)
|
||||
modelBuilder.Entity<EventAgenda>()
|
||||
.Property(s => s.Label)
|
||||
.HasColumnType("jsonb")
|
||||
.HasConversion(
|
||||
v => JsonSerializer.Serialize(v, options),
|
||||
v => JsonSerializer.Deserialize<List<Coordinate>>(v, options));
|
||||
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
|
||||
|
||||
modelBuilder.Entity<MapAnnotation>()
|
||||
.Property(s => s.Coordinates)
|
||||
modelBuilder.Entity<EventAgenda>()
|
||||
.Property(s => s.Description)
|
||||
.HasColumnType("jsonb")
|
||||
.HasConversion(
|
||||
v => JsonSerializer.Serialize(v, options),
|
||||
v => JsonSerializer.Deserialize<List<Coordinate>>(v, options));
|
||||
v => JsonSerializer.Deserialize<List<TranslationDTO>>(v, options));
|
||||
|
||||
modelBuilder.Entity<EventAgenda>()
|
||||
.Property(s => s.Address)
|
||||
.HasColumnType("jsonb")
|
||||
.HasConversion(
|
||||
v => JsonSerializer.Serialize(v, options),
|
||||
v => JsonSerializer.Deserialize<EventAddress>(v, options));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<Coordinate> 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
|
||||
|
||||
|
||||
@ -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<TranslationDTO> Label { get; set; }
|
||||
public GeometryType GeometryType { get; set; }
|
||||
[Column(TypeName = "jsonb")]
|
||||
public List<Coordinate> Coordinates { get; set; } = new(); // 1 point = marker, plusieurs = polyline/polygon
|
||||
public 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()
|
||||
|
||||
@ -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<Coordinate> 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<TranslationDTO> Description { get; set; }
|
||||
|
||||
public GeometryType GeometryType { get; set; } = GeometryType.Point; // Polygon, Circle, Point
|
||||
|
||||
[Column(TypeName = "jsonb")]
|
||||
public List<Coordinate> Coordinates { get; set; } = new(); // Polygon ou centre du cercle
|
||||
public Geometry Geometry { get; set; } // Polygon ou centre du cercle
|
||||
|
||||
public double? ZoneRadiusMeters { get; set; } // Optionnel, utile si zone cercle ou point
|
||||
|
||||
|
||||
@ -7,3 +7,7 @@ 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"]}]
|
||||
|
||||
Pour support postgis, attention image docker postgis + =>
|
||||
|
||||
CREATE EXTENSION postgis SCHEMA public;
|
||||
@ -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}
|
||||
|
||||
@ -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}
|
||||
|
||||
77
ManagerService/Helpers/GeometryMapper.cs
Normal file
77
ManagerService/Helpers/GeometryMapper.cs
Normal file
@ -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<double> { point.X, point.Y }
|
||||
},
|
||||
LineString line => new GeometryDTO
|
||||
{
|
||||
Type = "LineString",
|
||||
Coordinates = line.Coordinates
|
||||
.Select(coord => new List<double> { coord.X, coord.Y })
|
||||
.ToList()
|
||||
},
|
||||
Polygon polygon => new GeometryDTO
|
||||
{
|
||||
Type = "Polygon",
|
||||
Coordinates = new List<List<List<double>>>
|
||||
{
|
||||
polygon.ExteriorRing.Coordinates
|
||||
.Select(coord => new List<double> { 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<List<double>>();
|
||||
return factory.CreatePoint(new Coordinate(coords[0], coords[1]));
|
||||
}
|
||||
|
||||
private static LineString CreateLineString(GeometryDTO dto, GeometryFactory factory)
|
||||
{
|
||||
var coords = ((JsonElement)dto.Coordinates).Deserialize<List<List<double>>>();
|
||||
var coordinates = coords.Select(c => new Coordinate(c[0], c[1])).ToArray();
|
||||
return factory.CreateLineString(coordinates);
|
||||
}
|
||||
|
||||
private static Polygon CreatePolygon(GeometryDTO dto, GeometryFactory factory)
|
||||
{
|
||||
var rings = ((JsonElement)dto.Coordinates).Deserialize<List<List<List<double>>>>();
|
||||
var exterior = rings.First().Select(c => new Coordinate(c[0], c[1])).ToArray();
|
||||
return factory.CreatePolygon(exterior);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -17,6 +17,7 @@
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.19.0" />
|
||||
<PackageReference Include="MQTTnet.AspNetCore" Version="3.0.13" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.3" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite" Version="9.0.3" />
|
||||
<PackageReference Include="NSwag.AspNetCore" Version="13.10.8" />
|
||||
<PackageReference Include="Scrypt.NET" Version="1.3.0" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
||||
|
||||
1194
ManagerService/Migrations/20250710194737_UpdateCoordinatesToGeom.Designer.cs
generated
Normal file
1194
ManagerService/Migrations/20250710194737_UpdateCoordinatesToGeom.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,401 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using NetTopologySuite.Geometries;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ManagerService.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class UpdateCoordinatesToGeom : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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<Geometry>(
|
||||
name: "Geometry",
|
||||
table: "MapAnnotation",
|
||||
type: "geometry",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "PolyColor",
|
||||
table: "MapAnnotation",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<Geometry>(
|
||||
name: "Geometry",
|
||||
table: "GuidedSteps",
|
||||
type: "geometry",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<Geometry>(
|
||||
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<string>(type: "text", nullable: false),
|
||||
InstanceId = table.Column<string>(type: "text", nullable: false),
|
||||
AppType = table.Column<int>(type: "integer", nullable: false),
|
||||
MainImageId = table.Column<string>(type: "text", nullable: true),
|
||||
MainImageUrl = table.Column<string>(type: "text", nullable: true),
|
||||
LoaderImageId = table.Column<string>(type: "text", nullable: true),
|
||||
LoaderImageUrl = table.Column<string>(type: "text", nullable: true),
|
||||
IsDate = table.Column<bool>(type: "boolean", nullable: false),
|
||||
IsHour = table.Column<bool>(type: "boolean", nullable: false),
|
||||
PrimaryColor = table.Column<string>(type: "text", nullable: true),
|
||||
SecondaryColor = table.Column<string>(type: "text", nullable: true),
|
||||
RoundedValue = table.Column<int>(type: "integer", nullable: true),
|
||||
ScreenPercentageSectionsMainPage = table.Column<int>(type: "integer", nullable: true),
|
||||
IsSectionImageBackground = table.Column<bool>(type: "boolean", nullable: false),
|
||||
LayoutMainPage = table.Column<int>(type: "integer", nullable: false),
|
||||
Languages = table.Column<List<string>>(type: "text[]", nullable: true),
|
||||
SectionEventId = table.Column<string>(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<string>(type: "text", nullable: false),
|
||||
ConfigurationId = table.Column<string>(type: "text", nullable: false),
|
||||
ApplicationInstanceId = table.Column<string>(type: "text", nullable: false),
|
||||
Order = table.Column<int>(type: "integer", nullable: true),
|
||||
IsActive = table.Column<bool>(type: "boolean", nullable: false),
|
||||
WeightMasonryGrid = table.Column<int>(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");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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<string>(
|
||||
name: "Coordinates",
|
||||
table: "MapAnnotation",
|
||||
type: "jsonb",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Coordinates",
|
||||
table: "GuidedSteps",
|
||||
type: "jsonb",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "GeometryType",
|
||||
table: "GuidedSteps",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Coordinates",
|
||||
table: "GeoPoints",
|
||||
type: "jsonb",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "GeometryType",
|
||||
table: "GeoPoints",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ApplicationInstanceId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ConfigurationId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("Order")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("WeightMasonryGrid")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationInstanceId");
|
||||
|
||||
b.HasIndex("ConfigurationId");
|
||||
|
||||
b.ToTable("AppConfigurationLinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ManagerService.Data.ApplicationInstance", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("AppType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("InstanceId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsDate")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsHour")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsSectionImageBackground")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.PrimitiveCollection<List<string>>("Languages")
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.Property<int>("LayoutMainPage")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("LoaderImageId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LoaderImageUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("MainImageId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("MainImageUrl")
|
||||
.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<string>("SectionEventId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SectionEventId");
|
||||
|
||||
b.ToTable("ApplicationInstances");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ManagerService.Data.Configuration", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
@ -308,7 +401,7 @@ namespace ManagerService.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<EventAddress>("Address")
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<DateTime?>("DateAdded")
|
||||
@ -320,14 +413,14 @@ namespace ManagerService.Migrations
|
||||
b.Property<DateTime?>("DateTo")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<List<TranslationAndResourceDTO>>("Description")
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<List<TranslationAndResourceDTO>>("Label")
|
||||
b.Property<string>("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<string>("Coordinates")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
@ -386,8 +476,8 @@ namespace ManagerService.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<int>("GeometryType")
|
||||
.HasColumnType("integer");
|
||||
b.Property<Geometry>("Geometry")
|
||||
.HasColumnType("geometry");
|
||||
|
||||
b.Property<string>("ImageResourceId")
|
||||
.HasColumnType("text");
|
||||
@ -481,17 +571,14 @@ namespace ManagerService.Migrations
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Coordinates")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<string>("ExpectedAnswer")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<int>("GeometryType")
|
||||
.HasColumnType("integer");
|
||||
b.Property<Geometry>("Geometry")
|
||||
.HasColumnType("geometry");
|
||||
|
||||
b.Property<string>("GuidedPathId")
|
||||
.IsRequired()
|
||||
@ -585,8 +672,8 @@ namespace ManagerService.Migrations
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Coordinates")
|
||||
.HasColumnType("jsonb");
|
||||
b.Property<Geometry>("Geometry")
|
||||
.HasColumnType("geometry");
|
||||
|
||||
b.Property<int>("GeometryType")
|
||||
.HasColumnType("integer");
|
||||
@ -600,6 +687,9 @@ namespace ManagerService.Migrations
|
||||
b.Property<List<TranslationDTO>>("Label")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<string>("PolyColor")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("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");
|
||||
|
||||
@ -160,7 +160,7 @@ namespace ManagerService
|
||||
var dataSource = dataSourceBuilder.Build();
|
||||
|
||||
services.AddDbContext<MyInfoMateDbContext>(options =>
|
||||
options.UseNpgsql(dataSource)
|
||||
options.UseNpgsql(dataSource, o => o.UseNetTopologySuite())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user