From 94443fa4111c18156bf39d7afd5f20c945f0bb01 Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Thu, 27 Nov 2025 16:19:00 +0100 Subject: [PATCH] Update puzzle to game + misc --- .../Controllers/ResourceController.cs | 32 +- .../Controllers/SectionController.cs | 22 +- ManagerService/DTOs/SectionType.cs | 2 +- .../SubSection/{PuzzleDTO.cs => GameDTO.cs} | 4 +- ManagerService/Data/AppConfigurationLink.cs | 2 +- ManagerService/Data/MyInfoMateDbContext.cs | 2 +- ManagerService/Data/SubSection/GuidedPath.cs | 5 + ManagerService/Data/SubSection/GuidedStep.cs | 4 +- .../{SectionPuzzle.cs => SectionGame.cs} | 43 +- ManagerService/Helpers/GeometryMapper.cs | 6 +- ...51121142433_UpdatePuzzleToGame.Designer.cs | 1242 +++++++++++++++++ .../20251121142433_UpdatePuzzleToGame.cs | 150 ++ .../MyInfoMateDbContextModelSnapshot.cs | 87 +- ManagerService/Services/SectionFactory.cs | 68 +- ManagerService/Startup.cs | 4 +- 15 files changed, 1547 insertions(+), 126 deletions(-) rename ManagerService/DTOs/SubSection/{PuzzleDTO.cs => GameDTO.cs} (75%) rename ManagerService/Data/SubSection/{SectionPuzzle.cs => SectionGame.cs} (54%) create mode 100644 ManagerService/Migrations/20251121142433_UpdatePuzzleToGame.Designer.cs create mode 100644 ManagerService/Migrations/20251121142433_UpdatePuzzleToGame.cs diff --git a/ManagerService/Controllers/ResourceController.cs b/ManagerService/Controllers/ResourceController.cs index be077ed..c483bcd 100644 --- a/ManagerService/Controllers/ResourceController.cs +++ b/ManagerService/Controllers/ResourceController.cs @@ -628,36 +628,36 @@ namespace ManagerService.Controllers } } break; - case SectionPuzzle puzzle: - if (puzzle.PuzzleMessageDebut != null) + case SectionGame puzzle: + if (puzzle.GameMessageDebut != null) { - foreach (var puzzleMessageDebut in puzzle.PuzzleMessageDebut) + foreach (var gameMessageDebut in puzzle.GameMessageDebut) { - if (puzzleMessageDebut.resourceId == id) + if (gameMessageDebut.resourceId == id) { - puzzleMessageDebut.resourceId = null; - puzzleMessageDebut.resource = null; - _myInfoMateDbContext.Entry(puzzle).Property(p => p.PuzzleMessageDebut).IsModified = true; + gameMessageDebut.resourceId = null; + gameMessageDebut.resource = null; + _myInfoMateDbContext.Entry(puzzle).Property(p => p.GameMessageDebut).IsModified = true; } } } - if (puzzle.PuzzleMessageFin != null) + if (puzzle.GameMessageFin != null) { - foreach (var puzzleMessageFin in puzzle.PuzzleMessageFin) + foreach (var gameMessageFin in puzzle.GameMessageFin) { - if (puzzleMessageFin.resourceId == id) + if (gameMessageFin.resourceId == id) { - puzzleMessageFin.resourceId = null; - puzzleMessageFin.resource = null; - _myInfoMateDbContext.Entry(puzzle).Property(p => p.PuzzleMessageFin).IsModified = true; + gameMessageFin.resourceId = null; + gameMessageFin.resource = null; + _myInfoMateDbContext.Entry(puzzle).Property(p => p.GameMessageFin).IsModified = true; } } } - if (puzzle.PuzzleImageId == id) + if (puzzle.GamePuzzleImageId == id) { - puzzle.PuzzleImageId = null; - puzzle.PuzzleImage = null; + puzzle.GamePuzzleImageId = null; + puzzle.GamePuzzleImage = null; } break; case SectionVideo video: // TO BE TESTED .. diff --git a/ManagerService/Controllers/SectionController.cs b/ManagerService/Controllers/SectionController.cs index f8cf49a..eb41066 100644 --- a/ManagerService/Controllers/SectionController.cs +++ b/ManagerService/Controllers/SectionController.cs @@ -208,9 +208,9 @@ namespace ManagerService.Controllers var sectionEvent = _myInfoMateDbContext.Sections.OfType().Include(se => se.Programme).ThenInclude(se => se.MapAnnotations).FirstOrDefault(s => s.Id == id); (dto as SectionEventDTO).Programme = sectionEvent.Programme; // TODO test ! Need dto ? break; - case SectionType.Puzzle: - Resource resource = _myInfoMateDbContext.Resources.FirstOrDefault(r => r.Id == (dto as PuzzleDTO).puzzleImageId); - (dto as PuzzleDTO).puzzleImage = resource.ToDTO(); + case SectionType.Game: + Resource resource = _myInfoMateDbContext.Resources.FirstOrDefault(r => r.Id == (dto as GameDTO).puzzleImageId); + (dto as GameDTO).puzzleImage = resource.ToDTO(); break; case SectionType.Map: var geoPoints = _myInfoMateDbContext.GeoPoints.Where(gp => gp.SectionMapId == section.Id)/*.OrderBy(gp => gp.or)*/.ToList(); @@ -262,9 +262,9 @@ namespace ManagerService.Controllers var subDTO = SectionFactory.ToDTO(subSection); switch (subSection.Type) { - case SectionType.Puzzle: - Resource resourceSub = _myInfoMateDbContext.Resources.FirstOrDefault(r => r.Id == (subDTO as PuzzleDTO).puzzleImageId); - (subDTO as PuzzleDTO).puzzleImage = resourceSub?.ToDTO(); + case SectionType.Game: + Resource resourceSub = _myInfoMateDbContext.Resources.FirstOrDefault(r => r.Id == (subDTO as GameDTO).puzzleImageId); + (subDTO as GameDTO).puzzleImage = resourceSub?.ToDTO(); break; case SectionType.Map: var geoPointsSub = _myInfoMateDbContext.GeoPoints.Where(gp => gp.SectionMapId == subSection.Id).ToList(); @@ -609,11 +609,11 @@ namespace ManagerService.Controllers PDFOrderedTranslationAndResources = [] }; break; - case SectionType.Puzzle: - section = new SectionPuzzle + case SectionType.Game: + section = new SectionGame { - PuzzleMessageDebut = [], - PuzzleMessageFin = [] + GameMessageDebut = [], + GameMessageFin = [] }; break; case SectionType.Quiz: @@ -1102,7 +1102,7 @@ namespace ManagerService.Controllers /// /// Useless, just to generate dto code /// - [ProducesResponseType(typeof(PuzzleDTO), 200)] + [ProducesResponseType(typeof(GameDTO), 200)] [HttpGet("PuzzleDTO")] public ObjectResult GetPuzzleDTO() { diff --git a/ManagerService/DTOs/SectionType.cs b/ManagerService/DTOs/SectionType.cs index 8c2e712..b76fbde 100644 --- a/ManagerService/DTOs/SectionType.cs +++ b/ManagerService/DTOs/SectionType.cs @@ -10,7 +10,7 @@ Quiz, Article, PDF, - Puzzle, + Game, Agenda, Weather, Event diff --git a/ManagerService/DTOs/SubSection/PuzzleDTO.cs b/ManagerService/DTOs/SubSection/GameDTO.cs similarity index 75% rename from ManagerService/DTOs/SubSection/PuzzleDTO.cs rename to ManagerService/DTOs/SubSection/GameDTO.cs index fe6c8d0..3e795ae 100644 --- a/ManagerService/DTOs/SubSection/PuzzleDTO.cs +++ b/ManagerService/DTOs/SubSection/GameDTO.cs @@ -1,9 +1,10 @@ using ManagerService.DTOs; using System.Collections.Generic; +using static ManagerService.Data.SubSection.SectionGame; namespace Manager.DTOs { - public class PuzzleDTO : SectionDTO + public class GameDTO : SectionDTO { public List messageDebut { get; set; } public List messageFin { get; set; } @@ -11,5 +12,6 @@ namespace Manager.DTOs public string puzzleImageId { get; set; } // But only image is possible public int rows { get; set; } = 3; public int cols { get; set; } = 3; + public GameTypes gameType { get; set; } = GameTypes.Puzzle; } } diff --git a/ManagerService/Data/AppConfigurationLink.cs b/ManagerService/Data/AppConfigurationLink.cs index e2a0707..8e6cc81 100644 --- a/ManagerService/Data/AppConfigurationLink.cs +++ b/ManagerService/Data/AppConfigurationLink.cs @@ -40,7 +40,7 @@ namespace ManagerService.Data public bool IsSectionImageBackground { get; set; } // => Chose layout of main page // Specific Kiosk - public LayoutMainPageType LayoutMainPage { get; set; } = LayoutMainPageType.MasonryGrid; // Specific Kiosk + public LayoutMainPageType LayoutMainPage { get; set; } = LayoutMainPageType.MasonryGrid; // Specific Kiosk and mobile public string LoaderImageId { get; set; } // Specific Kiosk diff --git a/ManagerService/Data/MyInfoMateDbContext.cs b/ManagerService/Data/MyInfoMateDbContext.cs index 7d383f9..ba05c1f 100644 --- a/ManagerService/Data/MyInfoMateDbContext.cs +++ b/ManagerService/Data/MyInfoMateDbContext.cs @@ -69,7 +69,7 @@ namespace ManagerService.Data .HasValue("Map") .HasValue("Menu") .HasValue("PDF") - .HasValue("Puzzle") + .HasValue("Game") .HasValue("Quiz") .HasValue("Slider") .HasValue("Video") diff --git a/ManagerService/Data/SubSection/GuidedPath.cs b/ManagerService/Data/SubSection/GuidedPath.cs index 31e34f4..6e0cf2b 100644 --- a/ManagerService/Data/SubSection/GuidedPath.cs +++ b/ManagerService/Data/SubSection/GuidedPath.cs @@ -31,6 +31,11 @@ namespace ManagerService.Data.SubSection [ForeignKey("SectionEventId")] public SectionEvent? SectionEvent { get; set; } + // Lié à une section game (optionnel) => Escape game / geolocalisé ou non + public string? SectionGameId { get; set; } + [ForeignKey("SectionGameId")] + public SectionGame? SectionGame { get; set; } + // Type de parcours public bool IsLinear { get; set; } = true; // Avancer dans l’ordre - Ordre obligatoire public bool RequireSuccessToAdvance { get; set; } = false; // Par exemple: résoudre une énigme diff --git a/ManagerService/Data/SubSection/GuidedStep.cs b/ManagerService/Data/SubSection/GuidedStep.cs index 16eac10..b35a158 100644 --- a/ManagerService/Data/SubSection/GuidedStep.cs +++ b/ManagerService/Data/SubSection/GuidedStep.cs @@ -27,7 +27,7 @@ namespace ManagerService.Data.SubSection [Column(TypeName = "jsonb")] public List Description { get; set; } - public Geometry Geometry { get; set; } // 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 @@ -36,7 +36,7 @@ namespace ManagerService.Data.SubSection public int? TriggerGeoPointId { get; set; } // Lieu lié à l'étape et genre si on veut plus d'info ou pourrait afficher les infos du geopoint. [ForeignKey("TriggerGeoPointId")] - public GeoPoint TriggerGeoPoint { get; set; } + public GeoPoint? TriggerGeoPoint { get; set; } public bool IsHiddenInitially { get; set; } = false; diff --git a/ManagerService/Data/SubSection/SectionPuzzle.cs b/ManagerService/Data/SubSection/SectionGame.cs similarity index 54% rename from ManagerService/Data/SubSection/SectionPuzzle.cs rename to ManagerService/Data/SubSection/SectionGame.cs index db04310..fa9e2a9 100644 --- a/ManagerService/Data/SubSection/SectionPuzzle.cs +++ b/ManagerService/Data/SubSection/SectionGame.cs @@ -10,33 +10,32 @@ using System.Linq; namespace ManagerService.Data.SubSection { /// - /// Section puzzle + /// Section game /// - public class SectionPuzzle : Section + public class SectionGame : Section { [Required] [Column(TypeName = "jsonb")] - public List PuzzleMessageDebut { get; set; } + public List GameMessageDebut { get; set; } [Required] [Column(TypeName = "jsonb")] - public List PuzzleMessageFin { get; set; } + public List GameMessageFin { get; set; } - public string PuzzleImageId { get; set; } // But only image is possible - public Resource PuzzleImage { get; set; } // But only image is possible + public string GamePuzzleImageId { get; set; } // But only image is possible + public Resource GamePuzzleImage { get; set; } // But only image is possible [Required] - public int PuzzleRows { get; set; } = 3; + public int GamePuzzleRows { get; set; } = 3; [Required] - public int PuzzleCols { get; set; } = 3; + public int GamePuzzleCols { get; set; } = 3; - public bool IsSlidingPuzzle { get; set; } = false; + public GameTypes GameType { get; set; } = GameTypes.Puzzle; - - public PuzzleDTO ToDTO() + public GameDTO ToDTO() { - return new PuzzleDTO() + return new GameDTO() { id = Id, label = Label, @@ -56,13 +55,21 @@ namespace ManagerService.Data.SubSection latitude = Latitude, longitude = Longitude, meterZoneGPS = MeterZoneGPS, - messageDebut = PuzzleMessageDebut, - messageFin = PuzzleMessageFin, - puzzleImage = PuzzleImage.ToDTO(), - puzzleImageId = PuzzleImageId, - rows = PuzzleRows, - cols = PuzzleCols + messageDebut = GameMessageDebut, + messageFin = GameMessageFin, + puzzleImage = GamePuzzleImage.ToDTO(), + puzzleImageId = GamePuzzleImageId, + rows = GamePuzzleRows, + cols = GamePuzzleCols, + gameType = GameType }; } + + public enum GameTypes + { + Puzzle, + SlidingPuzzle, + Escape + } } } diff --git a/ManagerService/Helpers/GeometryMapper.cs b/ManagerService/Helpers/GeometryMapper.cs index 3e26679..dbb32de 100644 --- a/ManagerService/Helpers/GeometryMapper.cs +++ b/ManagerService/Helpers/GeometryMapper.cs @@ -42,7 +42,8 @@ namespace ManagerService.Helpers public static Geometry FromDto(this GeometryDTO dto, GeometryFactory factory = null!) { - factory ??= NtsGeometryServices.Instance.CreateGeometryFactory(); + factory ??= NtsGeometryServices.Instance.CreateGeometryFactory(srid: 4326); + return dto.type switch { @@ -56,7 +57,8 @@ namespace ManagerService.Helpers private static Point CreatePoint(GeometryDTO dto, GeometryFactory factory) { var coords = ((JsonElement)dto.coordinates).Deserialize>(); - return factory.CreatePoint(new Coordinate(coords[0], coords[1])); + var point = factory.CreatePoint(new Coordinate(coords[0], coords[1])); + return point; } private static LineString CreateLineString(GeometryDTO dto, GeometryFactory factory) diff --git a/ManagerService/Migrations/20251121142433_UpdatePuzzleToGame.Designer.cs b/ManagerService/Migrations/20251121142433_UpdatePuzzleToGame.Designer.cs new file mode 100644 index 0000000..3c45a78 --- /dev/null +++ b/ManagerService/Migrations/20251121142433_UpdatePuzzleToGame.Designer.cs @@ -0,0 +1,1242 @@ +// +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("20251121142433_UpdatePuzzleToGame")] + partial class UpdatePuzzleToGame + { + /// + 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.Data.AppConfigurationLink", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ApplicationInstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ConfigurationId") + .IsRequired() + .HasColumnType("text"); + + b.Property("DeviceId") + .HasColumnType("text"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("IsDate") + .HasColumnType("boolean"); + + b.Property("IsHour") + .HasColumnType("boolean"); + + b.Property("IsSectionImageBackground") + .HasColumnType("boolean"); + + b.Property("LayoutMainPage") + .HasColumnType("integer"); + + b.Property("LoaderImageId") + .HasColumnType("text"); + + b.Property("LoaderImageUrl") + .HasColumnType("text"); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("PrimaryColor") + .HasColumnType("text"); + + b.Property("RoundedValue") + .HasColumnType("integer"); + + b.Property("ScreenPercentageSectionsMainPage") + .HasColumnType("integer"); + + b.Property("SecondaryColor") + .HasColumnType("text"); + + b.Property("WeightMasonryGrid") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationInstanceId"); + + b.HasIndex("ConfigurationId"); + + b.HasIndex("DeviceId"); + + 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.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("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("IsSearchNumber") + .HasColumnType("boolean"); + + b.Property("IsSearchText") + .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("IsWeb") + .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(50) + .HasColumnType("character varying(50)"); + + b.Property("ImageId") + .HasColumnType("text"); + + b.Property("ImageSource") + .HasColumnType("text"); + + b.Property("InstanceId") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + 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.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("SectionGameId") + .HasColumnType("text"); + + b.Property("SectionMapId") + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("jsonb"); + + b.HasKey("Id"); + + b.HasIndex("SectionEventId"); + + b.HasIndex("SectionGameId"); + + 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("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("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("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("GuidedStepId") + .HasColumnType("text"); + + b.Property("IsSlidingPuzzle") + .HasColumnType("boolean"); + + b.Property>("Label") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("PuzzleCols") + .HasColumnType("integer"); + + b.Property("PuzzleImageId") + .HasColumnType("text"); + + b.Property("PuzzleRows") + .HasColumnType("integer"); + + b.Property("ResourceId") + .HasColumnType("text"); + + b.Property>("Responses") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("SectionQuizId") + .HasColumnType("text"); + + b.Property("ValidationQuestionType") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuidedStepId"); + + b.HasIndex("PuzzleImageId"); + + 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("IconResourceId") + .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("IconResourceId"); + + b.HasIndex("ProgrammeBlockId"); + + b.ToTable("MapAnnotations"); + }); + + 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("Event"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionGame", b => + { + b.HasBaseType("ManagerService.Data.Section"); + + b.Property>("GameMessageDebut") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property>("GameMessageFin") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("GamePuzzleCols") + .HasColumnType("integer"); + + b.Property("GamePuzzleImageId") + .HasColumnType("text"); + + b.Property("GamePuzzleRows") + .HasColumnType("integer"); + + b.Property("GameType") + .HasColumnType("integer"); + + b.HasIndex("GamePuzzleImageId"); + + b.HasDiscriminator().HasValue("Game"); + }); + + 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.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.HasOne("ManagerService.Data.Device", "Device") + .WithMany() + .HasForeignKey("DeviceId"); + + b.Navigation("ApplicationInstance"); + + b.Navigation("Configuration"); + + b.Navigation("Device"); + }); + + 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.SectionGame", "SectionGame") + .WithMany() + .HasForeignKey("SectionGameId"); + + b.HasOne("ManagerService.Data.SubSection.SectionMap", "SectionMap") + .WithMany() + .HasForeignKey("SectionMapId"); + + b.Navigation("SectionEvent"); + + b.Navigation("SectionGame"); + + 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.SubSection.GuidedStep", "GuidedStep") + .WithMany("QuizQuestions") + .HasForeignKey("GuidedStepId"); + + b.HasOne("ManagerService.Data.Resource", "PuzzleImage") + .WithMany() + .HasForeignKey("PuzzleImageId"); + + b.HasOne("ManagerService.Data.Resource", "Resource") + .WithMany() + .HasForeignKey("ResourceId"); + + b.HasOne("ManagerService.Data.SubSection.SectionQuiz", "SectionQuiz") + .WithMany("QuizQuestions") + .HasForeignKey("SectionQuizId"); + + b.Navigation("GuidedStep"); + + b.Navigation("PuzzleImage"); + + b.Navigation("Resource"); + + b.Navigation("SectionQuiz"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+MapAnnotation", b => + { + b.HasOne("ManagerService.Data.Resource", "IconResource") + .WithMany() + .HasForeignKey("IconResourceId"); + + b.HasOne("ManagerService.Data.SubSection.SectionEvent+ProgrammeBlock", null) + .WithMany("MapAnnotations") + .HasForeignKey("ProgrammeBlockId"); + + b.Navigation("IconResource"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionEvent+ProgrammeBlock", b => + { + b.HasOne("ManagerService.Data.SubSection.SectionEvent", null) + .WithMany("Programme") + .HasForeignKey("SectionEventId"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionGame", b => + { + b.HasOne("ManagerService.Data.Resource", "GamePuzzleImage") + .WithMany() + .HasForeignKey("GamePuzzleImageId"); + + b.Navigation("GamePuzzleImage"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b => + { + b.HasOne("ManagerService.Data.Resource", "MapResource") + .WithMany() + .HasForeignKey("MapResourceId"); + + b.Navigation("MapResource"); + }); + + modelBuilder.Entity("ManagerService.Data.ApplicationInstance", b => + { + b.Navigation("Configurations"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.GuidedPath", b => + { + b.Navigation("Steps"); + }); + + modelBuilder.Entity("ManagerService.Data.SubSection.GuidedStep", b => + { + b.Navigation("QuizQuestions"); + }); + + 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/20251121142433_UpdatePuzzleToGame.cs b/ManagerService/Migrations/20251121142433_UpdatePuzzleToGame.cs new file mode 100644 index 0000000..2e76c74 --- /dev/null +++ b/ManagerService/Migrations/20251121142433_UpdatePuzzleToGame.cs @@ -0,0 +1,150 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace ManagerService.Migrations +{ + /// + public partial class UpdatePuzzleToGame : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Sections_Resources_PuzzleImageId", + table: "Sections"); + + migrationBuilder.DropColumn( + name: "IsSlidingPuzzle", + table: "Sections"); + + migrationBuilder.RenameColumn( + name: "PuzzleRows", + table: "Sections", + newName: "GameType"); + + migrationBuilder.RenameColumn( + name: "PuzzleMessageFin", + table: "Sections", + newName: "GameMessageFin"); + + migrationBuilder.RenameColumn( + name: "PuzzleMessageDebut", + table: "Sections", + newName: "GameMessageDebut"); + + migrationBuilder.RenameColumn( + name: "PuzzleImageId", + table: "Sections", + newName: "GamePuzzleImageId"); + + migrationBuilder.RenameColumn( + name: "PuzzleCols", + table: "Sections", + newName: "GamePuzzleRows"); + + migrationBuilder.RenameIndex( + name: "IX_Sections_PuzzleImageId", + table: "Sections", + newName: "IX_Sections_GamePuzzleImageId"); + + migrationBuilder.AddColumn( + name: "GamePuzzleCols", + table: "Sections", + type: "integer", + nullable: true); + + migrationBuilder.AddColumn( + name: "SectionGameId", + table: "GuidedPaths", + type: "text", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_GuidedPaths_SectionGameId", + table: "GuidedPaths", + column: "SectionGameId"); + + migrationBuilder.AddForeignKey( + name: "FK_GuidedPaths_Sections_SectionGameId", + table: "GuidedPaths", + column: "SectionGameId", + principalTable: "Sections", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_Sections_Resources_GamePuzzleImageId", + table: "Sections", + column: "GamePuzzleImageId", + principalTable: "Resources", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_GuidedPaths_Sections_SectionGameId", + table: "GuidedPaths"); + + migrationBuilder.DropForeignKey( + name: "FK_Sections_Resources_GamePuzzleImageId", + table: "Sections"); + + migrationBuilder.DropIndex( + name: "IX_GuidedPaths_SectionGameId", + table: "GuidedPaths"); + + migrationBuilder.DropColumn( + name: "GamePuzzleCols", + table: "Sections"); + + migrationBuilder.DropColumn( + name: "SectionGameId", + table: "GuidedPaths"); + + migrationBuilder.RenameColumn( + name: "GameType", + table: "Sections", + newName: "PuzzleRows"); + + migrationBuilder.RenameColumn( + name: "GamePuzzleRows", + table: "Sections", + newName: "PuzzleCols"); + + migrationBuilder.RenameColumn( + name: "GamePuzzleImageId", + table: "Sections", + newName: "PuzzleImageId"); + + migrationBuilder.RenameColumn( + name: "GameMessageFin", + table: "Sections", + newName: "PuzzleMessageFin"); + + migrationBuilder.RenameColumn( + name: "GameMessageDebut", + table: "Sections", + newName: "PuzzleMessageDebut"); + + migrationBuilder.RenameIndex( + name: "IX_Sections_GamePuzzleImageId", + table: "Sections", + newName: "IX_Sections_PuzzleImageId"); + + migrationBuilder.AddColumn( + name: "IsSlidingPuzzle", + table: "Sections", + type: "boolean", + nullable: true); + + migrationBuilder.AddForeignKey( + name: "FK_Sections_Resources_PuzzleImageId", + table: "Sections", + column: "PuzzleImageId", + principalTable: "Resources", + principalColumn: "Id"); + } + } +} diff --git a/ManagerService/Migrations/MyInfoMateDbContextModelSnapshot.cs b/ManagerService/Migrations/MyInfoMateDbContextModelSnapshot.cs index aca05d8..2d47c0c 100644 --- a/ManagerService/Migrations/MyInfoMateDbContextModelSnapshot.cs +++ b/ManagerService/Migrations/MyInfoMateDbContextModelSnapshot.cs @@ -554,6 +554,9 @@ namespace ManagerService.Migrations b.Property("SectionEventId") .HasColumnType("text"); + b.Property("SectionGameId") + .HasColumnType("text"); + b.Property("SectionMapId") .HasColumnType("text"); @@ -565,6 +568,8 @@ namespace ManagerService.Migrations b.HasIndex("SectionEventId"); + b.HasIndex("SectionGameId"); + b.HasIndex("SectionMapId"); b.ToTable("GuidedPaths"); @@ -840,6 +845,35 @@ namespace ManagerService.Migrations b.HasDiscriminator().HasValue("Event"); }); + modelBuilder.Entity("ManagerService.Data.SubSection.SectionGame", b => + { + b.HasBaseType("ManagerService.Data.Section"); + + b.Property>("GameMessageDebut") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property>("GameMessageFin") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("GamePuzzleCols") + .HasColumnType("integer"); + + b.Property("GamePuzzleImageId") + .HasColumnType("text"); + + b.Property("GamePuzzleRows") + .HasColumnType("integer"); + + b.Property("GameType") + .HasColumnType("integer"); + + b.HasIndex("GamePuzzleImageId"); + + b.HasDiscriminator().HasValue("Game"); + }); + modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b => { b.HasBaseType("ManagerService.Data.Section"); @@ -892,35 +926,6 @@ namespace ManagerService.Migrations 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"); @@ -1087,12 +1092,18 @@ namespace ManagerService.Migrations .WithMany() .HasForeignKey("SectionEventId"); + b.HasOne("ManagerService.Data.SubSection.SectionGame", "SectionGame") + .WithMany() + .HasForeignKey("SectionGameId"); + b.HasOne("ManagerService.Data.SubSection.SectionMap", "SectionMap") .WithMany() .HasForeignKey("SectionMapId"); b.Navigation("SectionEvent"); + b.Navigation("SectionGame"); + b.Navigation("SectionMap"); }); @@ -1160,6 +1171,15 @@ namespace ManagerService.Migrations .HasForeignKey("SectionEventId"); }); + modelBuilder.Entity("ManagerService.Data.SubSection.SectionGame", b => + { + b.HasOne("ManagerService.Data.Resource", "GamePuzzleImage") + .WithMany() + .HasForeignKey("GamePuzzleImageId"); + + b.Navigation("GamePuzzleImage"); + }); + modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b => { b.HasOne("ManagerService.Data.Resource", "MapResource") @@ -1169,15 +1189,6 @@ namespace ManagerService.Migrations 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"); diff --git a/ManagerService/Services/SectionFactory.cs b/ManagerService/Services/SectionFactory.cs index 2f14057..0513e73 100644 --- a/ManagerService/Services/SectionFactory.cs +++ b/ManagerService/Services/SectionFactory.cs @@ -18,7 +18,7 @@ namespace ManagerService.Services MapDTO mapDTO = new MapDTO(); MenuDTO menuDTO = new MenuDTO(); PdfDTO pdfDTO = new PdfDTO(); - PuzzleDTO puzzleDTO = new PuzzleDTO(); + GameDTO puzzleDTO = new GameDTO(); QuizDTO quizDTO = new QuizDTO(); SliderDTO sliderDTO = new SliderDTO(); VideoDTO videoDTO = new VideoDTO(); @@ -45,8 +45,8 @@ namespace ManagerService.Services case SectionType.PDF: pdfDTO = JsonConvert.DeserializeObject(jsonElement.ToString()); break; - case SectionType.Puzzle: - puzzleDTO = JsonConvert.DeserializeObject(jsonElement.ToString()); + case SectionType.Game: + puzzleDTO = JsonConvert.DeserializeObject(jsonElement.ToString()); break; case SectionType.Quiz: quizDTO = JsonConvert.DeserializeObject(jsonElement.ToString()); @@ -215,7 +215,7 @@ namespace ManagerService.Services Type = dto.type, PDFOrderedTranslationAndResources = pdfDTO.pdfs }, - SectionType.Puzzle => new SectionPuzzle + SectionType.Game => new SectionGame { Id = dto.id, DateCreation = dto.dateCreation.Value, @@ -235,11 +235,11 @@ namespace ManagerService.Services Longitude = dto.longitude, MeterZoneGPS = dto.meterZoneGPS, Type = dto.type, - PuzzleMessageDebut = puzzleDTO.messageDebut, - PuzzleMessageFin = puzzleDTO.messageFin, - PuzzleImageId = puzzleDTO.puzzleImageId, - PuzzleRows = puzzleDTO.rows, - PuzzleCols = puzzleDTO.cols + GameMessageDebut = puzzleDTO.messageDebut, + GameMessageFin = puzzleDTO.messageFin, + GamePuzzleImageId = puzzleDTO.puzzleImageId, + GamePuzzleRows = puzzleDTO.rows, + GamePuzzleCols = puzzleDTO.cols }, SectionType.Quiz => new SectionQuiz { @@ -516,32 +516,32 @@ namespace ManagerService.Services type = pdf.Type, pdfs = pdf.PDFOrderedTranslationAndResources }, - SectionPuzzle puzzle => new PuzzleDTO + SectionGame game => new GameDTO { - id = puzzle.Id, - dateCreation = puzzle.DateCreation, - configurationId = puzzle.ConfigurationId, - instanceId = puzzle.InstanceId, - label = puzzle.Label, - title = puzzle.Title, - description = puzzle.Description, - order = puzzle.Order, - imageId = puzzle.ImageId, - imageSource = puzzle.ImageSource, - isSubSection = puzzle.IsSubSection, - parentId = puzzle.ParentId, - isBeacon = puzzle.IsBeacon, - beaconId = puzzle.BeaconId, - latitude = puzzle.Latitude, - longitude = puzzle.Longitude, - meterZoneGPS = puzzle.MeterZoneGPS, - type = puzzle.Type, - messageDebut = puzzle.PuzzleMessageDebut, - messageFin = puzzle.PuzzleMessageFin, - puzzleImage = puzzle.PuzzleImage?.ToDTO(), - puzzleImageId = puzzle.PuzzleImageId, - rows = puzzle.PuzzleRows, - cols = puzzle.PuzzleCols + id = game.Id, + dateCreation = game.DateCreation, + configurationId = game.ConfigurationId, + instanceId = game.InstanceId, + label = game.Label, + title = game.Title, + description = game.Description, + order = game.Order, + imageId = game.ImageId, + imageSource = game.ImageSource, + isSubSection = game.IsSubSection, + parentId = game.ParentId, + isBeacon = game.IsBeacon, + beaconId = game.BeaconId, + latitude = game.Latitude, + longitude = game.Longitude, + meterZoneGPS = game.MeterZoneGPS, + type = game.Type, + messageDebut = game.GameMessageDebut, + messageFin = game.GameMessageFin, + puzzleImage = game.GamePuzzleImage?.ToDTO(), + puzzleImageId = game.GamePuzzleImageId, + rows = game.GamePuzzleRows, + cols = game.GamePuzzleCols }, SectionQuiz quiz => new QuizDTO { diff --git a/ManagerService/Startup.cs b/ManagerService/Startup.cs index a1a9383..61eb8cf 100644 --- a/ManagerService/Startup.cs +++ b/ManagerService/Startup.cs @@ -161,6 +161,8 @@ namespace ManagerService services.AddDbContext(options => options.UseNpgsql(dataSource, o => o.UseNetTopologySuite()) + .EnableSensitiveDataLogging() // montre les valeurs des paramètres + .LogTo(Console.WriteLine, LogLevel.Information) ); } @@ -188,7 +190,7 @@ namespace ManagerService app.UseCors( #if DEBUG options => options - .SetIsOriginAllowed(origin => string.IsNullOrEmpty(origin) || origin == "http://localhost:57209") + .SetIsOriginAllowed(origin => string.IsNullOrEmpty(origin) || origin == "http://localhost:55307") .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials()