Updated for kiosk (can assign different config on different device)

This commit is contained in:
Thomas Fransolet 2025-08-14 16:56:02 +02:00
parent c8c5902292
commit b81972f723
8 changed files with 1555 additions and 65 deletions

View File

@ -1,4 +1,6 @@
namespace ManagerService.DTOs
using ManagerService.Data;
namespace ManagerService.DTOs
{
public class AppConfigurationLinkDTO
{
@ -14,6 +16,26 @@
public bool isActive { get; set; } = true;
public int? weightMasonryGrid { get; set; }
public int? weightMasonryGrid { get; set; } // Specific Mobile
public bool isDate { get; set; } // Specific Kiosk
public bool isHour { get; set; } // Specific Kiosk
public int? roundedValue { get; set; } // Specific Kiosk
public int? screenPercentageSectionsMainPage { get; set; } // Specific Kiosk
public bool isSectionImageBackground { get; set; } // Specific Kiosk
public string deviceId { get; set; } // Specific Kiosk
public LayoutMainPageType layoutMainPage { get; set; } // Specific Kiosk
public string LoaderImageUrl { get; set; } // Specific Kiosk
public string PrimaryColor { get; set; } // Specific Kiosk
public string SecondaryColor { get; set; } // Specific Kiosk
}
}

View File

@ -21,20 +21,10 @@ namespace ManagerService.DTOs
public string loaderImageUrl { get; set; }
public bool isDate { get; set; }
public bool isHour { get; set; }
public string primaryColor { get; set; }
public string secondaryColor { get; set; }
public int? roundedValue { get; set; }
public int? screenPercentageSectionsMainPage { get; set; }
public bool isSectionImageBackground { get; set; }
public List<string> languages { get; set; }
}
}

View File

@ -1,4 +1,5 @@
using ManagerService.DTOs;
using ManagerService.Data.SubSection;
using ManagerService.DTOs;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@ -23,11 +24,31 @@ namespace ManagerService.Data
[Required]
public string ApplicationInstanceId { get; set; }
public int? Order { get; set; }
public int? Order { get; set; } // Specific Mobile
public bool IsActive { get; set; } = true;
public bool IsActive { get; set; } = true; // Specific Mobile
public int? WeightMasonryGrid { get; set; }
public int? WeightMasonryGrid { get; set; } // Specific Mobile
public bool IsDate { get; set; } // Specific Kiosk
public bool IsHour { get; set; } // Specific Kiosk
public int? RoundedValue { get; set; } // Specific Kiosk
public int? ScreenPercentageSectionsMainPage { get; set; } // Specific Kiosk
public bool IsSectionImageBackground { get; set; } // => Chose layout of main page // Specific Kiosk
public LayoutMainPageType LayoutMainPage { get; set; } = LayoutMainPageType.MasonryGrid; // Specific Kiosk
public string LoaderImageId { get; set; } // Specific Kiosk
public string LoaderImageUrl { get; set; } // Specific Kiosk
public string PrimaryColor { get; set; } // Specific Kiosk
public string SecondaryColor { get; set; } // Specific Kiosk
[ForeignKey(nameof(ConfigurationId))]
public Configuration Configuration { get; set; }
@ -35,6 +56,10 @@ namespace ManagerService.Data
[ForeignKey(nameof(ApplicationInstanceId))]
public ApplicationInstance ApplicationInstance { get; set; }
public string? DeviceId { get; set; } // Specific kiosk
[ForeignKey("DeviceId")]
public Device? Device { get; set; } // Specific kiosk
public AppConfigurationLinkDTO ToDTO()
{
return new AppConfigurationLinkDTO()
@ -45,7 +70,13 @@ namespace ManagerService.Data
applicationInstanceId = ApplicationInstanceId,
order = Order,
isActive = IsActive,
weightMasonryGrid = WeightMasonryGrid
weightMasonryGrid = WeightMasonryGrid,
isDate = IsDate,
isHour = IsHour,
roundedValue = RoundedValue,
screenPercentageSectionsMainPage = ScreenPercentageSectionsMainPage,
isSectionImageBackground = IsSectionImageBackground,
deviceId = DeviceId,
};
}
@ -56,6 +87,11 @@ namespace ManagerService.Data
Order = appConfigurationLinkDTO.order;
IsActive = appConfigurationLinkDTO.isActive;
WeightMasonryGrid = appConfigurationLinkDTO?.weightMasonryGrid;
IsDate = appConfigurationLinkDTO.isDate;
IsHour = appConfigurationLinkDTO.isHour;
RoundedValue = appConfigurationLinkDTO.roundedValue;
ScreenPercentageSectionsMainPage = appConfigurationLinkDTO.screenPercentageSectionsMainPage;
IsSectionImageBackground = appConfigurationLinkDTO.isSectionImageBackground;
return this;
}

View File

@ -24,32 +24,23 @@ namespace ManagerService.Data
public List<AppConfigurationLink> Configurations { get; set; }
public string MainImageId { get; set; }
public string MainImageId { get; set; } // Specific Mobile et web(?)
public string MainImageUrl { get; set; }
public string MainImageUrl { get; set; } // Specific Mobile et web(?)
public string LoaderImageId { get; set; }
public string LoaderImageId { get; set; } // Specific Mobile et web
public string LoaderImageUrl { get; set; }
public string LoaderImageUrl { get; set; } // Specific Mobile et web
public bool IsDate { get; set; }
public string PrimaryColor { get; set; } // Specific Mobile et web
public bool IsHour { get; set; }
public string SecondaryColor { get; set; } // Specific Mobile et web
public string PrimaryColor { get; set; }
public string SecondaryColor { get; set; }
public int? RoundedValue { get; set; }
public int? ScreenPercentageSectionsMainPage { get; set; }
public bool IsSectionImageBackground { get; set; } // => Chose layout of main page
public LayoutMainPageType LayoutMainPage { get; set; } = LayoutMainPageType.MasonryGrid;
public LayoutMainPageType LayoutMainPage { get; set; } = LayoutMainPageType.MasonryGrid; // Specific Mobile et web
public List<string> Languages { get; set; } // All app must support languages, if not, client's problem
public string? SectionEventId { get; set; }
public string? SectionEventId { get; set; } // Specific Mobile et web(?)
[ForeignKey("SectionEventId")]
public SectionEvent? SectionEvent { get; set; } // => To Display in large a event with countdown (in mobile app).
@ -66,13 +57,8 @@ namespace ManagerService.Data
mainImageUrl = MainImageUrl,
loaderImageId = LoaderImageId,
loaderImageUrl = LoaderImageUrl,
isDate = IsDate,
isHour = IsHour,
primaryColor = PrimaryColor,
secondaryColor = SecondaryColor,
roundedValue = RoundedValue,
screenPercentageSectionsMainPage = ScreenPercentageSectionsMainPage,
isSectionImageBackground = IsSectionImageBackground,
languages = Languages
};
}
@ -85,13 +71,8 @@ namespace ManagerService.Data
MainImageUrl = dto.mainImageUrl;
LoaderImageId = dto.loaderImageId;
LoaderImageUrl = dto.loaderImageUrl;
IsDate = dto.isDate;
IsHour = dto.isHour;
PrimaryColor = dto.primaryColor;
SecondaryColor = dto.secondaryColor;
RoundedValue = dto.roundedValue;
ScreenPercentageSectionsMainPage = dto.screenPercentageSectionsMainPage;
IsSectionImageBackground = dto.isSectionImageBackground;
Languages = dto.languages;
Configurations = dto.configurations;

View File

@ -1,10 +1,8 @@
using ManagerService.Data.SubSection;
using ManagerService.DTOs;
using ManagerService.DTOs;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace ManagerService.Data
@ -60,7 +58,8 @@ namespace ManagerService.Data
public int? MeterZoneGPS { get; set; }
public bool isActive { get; set; } = true;
public bool IsActive { get; set; } = true;
public SectionDTO ToDTO()
{
@ -70,7 +69,7 @@ namespace ManagerService.Data
label = Label,
title = Title,
description = Description,
isActive = isActive,
isActive = IsActive,
order = Order,
type = Type,
imageId = ImageId,

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,205 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ManagerService.Migrations
{
/// <inheritdoc />
public partial class UpdatedKioskSpecific : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsDate",
table: "ApplicationInstances");
migrationBuilder.DropColumn(
name: "IsHour",
table: "ApplicationInstances");
migrationBuilder.DropColumn(
name: "IsSectionImageBackground",
table: "ApplicationInstances");
migrationBuilder.DropColumn(
name: "RoundedValue",
table: "ApplicationInstances");
migrationBuilder.DropColumn(
name: "ScreenPercentageSectionsMainPage",
table: "ApplicationInstances");
migrationBuilder.AddColumn<string>(
name: "DeviceId",
table: "AppConfigurationLinks",
type: "text",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsDate",
table: "AppConfigurationLinks",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsHour",
table: "AppConfigurationLinks",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsSectionImageBackground",
table: "AppConfigurationLinks",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<int>(
name: "LayoutMainPage",
table: "AppConfigurationLinks",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "LoaderImageId",
table: "AppConfigurationLinks",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "LoaderImageUrl",
table: "AppConfigurationLinks",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "PrimaryColor",
table: "AppConfigurationLinks",
type: "text",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "RoundedValue",
table: "AppConfigurationLinks",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ScreenPercentageSectionsMainPage",
table: "AppConfigurationLinks",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "SecondaryColor",
table: "AppConfigurationLinks",
type: "text",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_AppConfigurationLinks_DeviceId",
table: "AppConfigurationLinks",
column: "DeviceId");
migrationBuilder.AddForeignKey(
name: "FK_AppConfigurationLinks_Devices_DeviceId",
table: "AppConfigurationLinks",
column: "DeviceId",
principalTable: "Devices",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_AppConfigurationLinks_Devices_DeviceId",
table: "AppConfigurationLinks");
migrationBuilder.DropIndex(
name: "IX_AppConfigurationLinks_DeviceId",
table: "AppConfigurationLinks");
migrationBuilder.DropColumn(
name: "DeviceId",
table: "AppConfigurationLinks");
migrationBuilder.DropColumn(
name: "IsDate",
table: "AppConfigurationLinks");
migrationBuilder.DropColumn(
name: "IsHour",
table: "AppConfigurationLinks");
migrationBuilder.DropColumn(
name: "IsSectionImageBackground",
table: "AppConfigurationLinks");
migrationBuilder.DropColumn(
name: "LayoutMainPage",
table: "AppConfigurationLinks");
migrationBuilder.DropColumn(
name: "LoaderImageId",
table: "AppConfigurationLinks");
migrationBuilder.DropColumn(
name: "LoaderImageUrl",
table: "AppConfigurationLinks");
migrationBuilder.DropColumn(
name: "PrimaryColor",
table: "AppConfigurationLinks");
migrationBuilder.DropColumn(
name: "RoundedValue",
table: "AppConfigurationLinks");
migrationBuilder.DropColumn(
name: "ScreenPercentageSectionsMainPage",
table: "AppConfigurationLinks");
migrationBuilder.DropColumn(
name: "SecondaryColor",
table: "AppConfigurationLinks");
migrationBuilder.AddColumn<bool>(
name: "IsDate",
table: "ApplicationInstances",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsHour",
table: "ApplicationInstances",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsSectionImageBackground",
table: "ApplicationInstances",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<int>(
name: "RoundedValue",
table: "ApplicationInstances",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ScreenPercentageSectionsMainPage",
table: "ApplicationInstances",
type: "integer",
nullable: true);
}
}
}

View File

@ -40,12 +40,45 @@ namespace ManagerService.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<string>("DeviceId")
.HasColumnType("text");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<bool>("IsDate")
.HasColumnType("boolean");
b.Property<bool>("IsHour")
.HasColumnType("boolean");
b.Property<bool>("IsSectionImageBackground")
.HasColumnType("boolean");
b.Property<int>("LayoutMainPage")
.HasColumnType("integer");
b.Property<string>("LoaderImageId")
.HasColumnType("text");
b.Property<string>("LoaderImageUrl")
.HasColumnType("text");
b.Property<int?>("Order")
.HasColumnType("integer");
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<int?>("WeightMasonryGrid")
.HasColumnType("integer");
@ -55,6 +88,8 @@ namespace ManagerService.Migrations
b.HasIndex("ConfigurationId");
b.HasIndex("DeviceId");
b.ToTable("AppConfigurationLinks");
});
@ -70,15 +105,6 @@ namespace ManagerService.Migrations
.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[]");
@ -100,12 +126,6 @@ namespace ManagerService.Migrations
b.Property<string>("PrimaryColor")
.HasColumnType("text");
b.Property<int?>("RoundedValue")
.HasColumnType("integer");
b.Property<int?>("ScreenPercentageSectionsMainPage")
.HasColumnType("integer");
b.Property<string>("SecondaryColor")
.HasColumnType("text");
@ -987,9 +1007,15 @@ namespace ManagerService.Migrations
.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 =>