Device controller done
This commit is contained in:
parent
7fb3feace4
commit
8b68ebe8c9
@ -4,8 +4,10 @@ using System.Linq;
|
|||||||
using Manager.Services;
|
using Manager.Services;
|
||||||
using ManagerService.Data;
|
using ManagerService.Data;
|
||||||
using ManagerService.DTOs;
|
using ManagerService.DTOs;
|
||||||
|
using ManagerService.Services;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Mqtt.Client.AspNetCore.Services;
|
using Mqtt.Client.AspNetCore.Services;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@ -21,12 +23,15 @@ namespace ManagerService.Controllers
|
|||||||
private DeviceDatabaseService _deviceService;
|
private DeviceDatabaseService _deviceService;
|
||||||
private ConfigurationDatabaseService _configurationService;
|
private ConfigurationDatabaseService _configurationService;
|
||||||
private readonly ILogger<DeviceController> _logger;
|
private readonly ILogger<DeviceController> _logger;
|
||||||
|
private readonly MyInfoMateDbContext _myInfoMateDbContext;
|
||||||
|
IHexIdGeneratorService idService = new HexIdGeneratorService();
|
||||||
|
|
||||||
public DeviceController(ILogger<DeviceController> logger, DeviceDatabaseService deviceService, ConfigurationDatabaseService configurationService)
|
public DeviceController(ILogger<DeviceController> logger, DeviceDatabaseService deviceService, ConfigurationDatabaseService configurationService, MyInfoMateDbContext myInfoMateDbContext)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_deviceService = deviceService;
|
_deviceService = deviceService;
|
||||||
_configurationService = configurationService;
|
_configurationService = configurationService;
|
||||||
|
_myInfoMateDbContext = myInfoMateDbContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -40,7 +45,8 @@ namespace ManagerService.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<OldDevice> devices = _deviceService.GetAll(instanceId);
|
//List<OldDevice> devices = _deviceService.GetAll(instanceId);
|
||||||
|
List<Device> devices = _myInfoMateDbContext.Devices.Include(d => d.Configuration).ToList();
|
||||||
|
|
||||||
return new OkObjectResult(devices.Select(d => d.ToDTO()));
|
return new OkObjectResult(devices.Select(d => d.ToDTO()));
|
||||||
}
|
}
|
||||||
@ -64,7 +70,8 @@ namespace ManagerService.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OldDevice device = _deviceService.GetById(id);
|
//OldDevice device = _deviceService.GetById(id);
|
||||||
|
Device device = _myInfoMateDbContext.Devices.Include(d => d.Configuration).FirstOrDefault(i => i.Id == id);
|
||||||
|
|
||||||
if (device == null)
|
if (device == null)
|
||||||
throw new KeyNotFoundException("This device was not found");
|
throw new KeyNotFoundException("This device was not found");
|
||||||
@ -99,27 +106,33 @@ namespace ManagerService.Controllers
|
|||||||
if (newDevice == null)
|
if (newDevice == null)
|
||||||
throw new ArgumentNullException("Device param is null");
|
throw new ArgumentNullException("Device param is null");
|
||||||
|
|
||||||
var configuration = _configurationService.GetById(newDevice.configurationId);
|
//var configuration = _configurationService.GetById(newDevice.configurationId);
|
||||||
|
var configuration = _myInfoMateDbContext.Configurations.FirstOrDefault(c => c.Id == newDevice.configurationId);
|
||||||
|
|
||||||
if (configuration == null)
|
if (configuration == null)
|
||||||
throw new KeyNotFoundException("Configuration does not exist");
|
throw new KeyNotFoundException("Configuration does not exist");
|
||||||
|
|
||||||
OldDevice device = new OldDevice();
|
//OldDevice device = new OldDevice();
|
||||||
if (_deviceService.IsExistIdentifier(newDevice.identifier))
|
Device device = new Device().FromDTO(newDevice);
|
||||||
|
device.Id = idService.GenerateHexId();
|
||||||
|
|
||||||
|
var deviceDB = _myInfoMateDbContext.Devices.FirstOrDefault(d => d.Identifier == newDevice.identifier);
|
||||||
|
|
||||||
|
if (deviceDB != null)
|
||||||
{
|
{
|
||||||
// Update info
|
// Update info
|
||||||
device = _deviceService.GetByIdentifier(newDevice.identifier);
|
device = deviceDB;
|
||||||
device.DateUpdate = DateTime.Now;
|
//device = _deviceService.GetByIdentifier(newDevice.identifier);
|
||||||
|
device.DateUpdate = DateTime.Now.ToUniversalTime();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Creation
|
// Creation
|
||||||
device.Identifier = newDevice.identifier;
|
device.Identifier = newDevice.identifier;
|
||||||
device.DateCreation = DateTime.Now;
|
device.DateCreation = DateTime.Now.ToUniversalTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
device.InstanceId = newDevice.instanceId;
|
device.InstanceId = newDevice.instanceId;
|
||||||
device.Name = newDevice.name;
|
device.Name = newDevice.name;
|
||||||
device.Configuration = configuration.Label;
|
|
||||||
device.ConfigurationId = newDevice.configurationId;
|
device.ConfigurationId = newDevice.configurationId;
|
||||||
device.IpAddressETH = newDevice.ipAddressETH;
|
device.IpAddressETH = newDevice.ipAddressETH;
|
||||||
device.IpAddressWLAN = newDevice.ipAddressWLAN;
|
device.IpAddressWLAN = newDevice.ipAddressWLAN;
|
||||||
@ -129,9 +142,16 @@ namespace ManagerService.Controllers
|
|||||||
device.BatteryLevel = newDevice.batteryLevel;
|
device.BatteryLevel = newDevice.batteryLevel;
|
||||||
device.LastBatteryLevel = newDevice.lastBatteryLevel;
|
device.LastBatteryLevel = newDevice.lastBatteryLevel;
|
||||||
|
|
||||||
OldDevice deviceCreated = _deviceService.IsExistIdentifier(newDevice.identifier) ? _deviceService.Update(device.Id, device) : _deviceService.Create(device);
|
//OldDevice deviceCreated = _deviceService.IsExistIdentifier(newDevice.identifier) ? _deviceService.Update(device.Id, device) : _deviceService.Create(device);
|
||||||
|
if (deviceDB != null)
|
||||||
|
{
|
||||||
|
_myInfoMateDbContext.Update(device);
|
||||||
|
} else {
|
||||||
|
_myInfoMateDbContext.Add(device);
|
||||||
|
}
|
||||||
|
_myInfoMateDbContext.SaveChanges();
|
||||||
|
|
||||||
return new OkObjectResult(deviceCreated.ToDTO());
|
return new OkObjectResult(device.ToDTO());
|
||||||
}
|
}
|
||||||
catch (ArgumentNullException ex)
|
catch (ArgumentNullException ex)
|
||||||
{
|
{
|
||||||
@ -168,7 +188,8 @@ namespace ManagerService.Controllers
|
|||||||
if (updatedDevice == null)
|
if (updatedDevice == null)
|
||||||
throw new ArgumentNullException("Device param is null");
|
throw new ArgumentNullException("Device param is null");
|
||||||
|
|
||||||
OldDevice device = _deviceService.GetById(updatedDevice.id);
|
//OldDevice device = _deviceService.GetById(updatedDevice.id);
|
||||||
|
Device device = _myInfoMateDbContext.Devices.FirstOrDefault(d => d.Id == updatedDevice.id);
|
||||||
|
|
||||||
if (device == null)
|
if (device == null)
|
||||||
throw new KeyNotFoundException("Device does not exist");
|
throw new KeyNotFoundException("Device does not exist");
|
||||||
@ -185,9 +206,10 @@ namespace ManagerService.Controllers
|
|||||||
device.BatteryLevel = updatedDevice.batteryLevel;
|
device.BatteryLevel = updatedDevice.batteryLevel;
|
||||||
device.LastBatteryLevel = updatedDevice.lastBatteryLevel;
|
device.LastBatteryLevel = updatedDevice.lastBatteryLevel;
|
||||||
|
|
||||||
OldDevice deviceModified = _deviceService.Update(updatedDevice.id, device);
|
//OldDevice deviceModified = _deviceService.Update(updatedDevice.id, device);
|
||||||
|
_myInfoMateDbContext.SaveChanges();
|
||||||
|
|
||||||
return new OkObjectResult(deviceModified.ToDTO());
|
return new OkObjectResult(device.ToDTO());
|
||||||
}
|
}
|
||||||
catch (ArgumentNullException ex)
|
catch (ArgumentNullException ex)
|
||||||
{
|
{
|
||||||
@ -219,12 +241,14 @@ namespace ManagerService.Controllers
|
|||||||
if (deviceIn == null)
|
if (deviceIn == null)
|
||||||
throw new ArgumentNullException("Device param is null");
|
throw new ArgumentNullException("Device param is null");
|
||||||
|
|
||||||
OldDevice device = _deviceService.GetById(deviceIn.id);
|
//OldDevice device = _deviceService.GetById(deviceIn.id);
|
||||||
|
Device device = _myInfoMateDbContext.Devices.FirstOrDefault(d => d.Id == deviceIn.id);
|
||||||
|
|
||||||
if (device == null)
|
if (device == null)
|
||||||
throw new KeyNotFoundException("Device does not exist");
|
throw new KeyNotFoundException("Device does not exist");
|
||||||
|
|
||||||
var configuration = _configurationService.GetById(deviceIn.configurationId);
|
//var configuration = _configurationService.GetById(deviceIn.configurationId);
|
||||||
|
var configuration = _myInfoMateDbContext.Configurations.FirstOrDefault(c => c.Id == deviceIn.configurationId);
|
||||||
|
|
||||||
if (configuration == null)
|
if (configuration == null)
|
||||||
throw new KeyNotFoundException("Configuration does not exist");
|
throw new KeyNotFoundException("Configuration does not exist");
|
||||||
@ -232,14 +256,15 @@ namespace ManagerService.Controllers
|
|||||||
// Todo add some verification ?
|
// Todo add some verification ?
|
||||||
device.Name = deviceIn.name;
|
device.Name = deviceIn.name;
|
||||||
device.Connected = deviceIn.connected;
|
device.Connected = deviceIn.connected;
|
||||||
device.Configuration = configuration.Label;
|
//device.Configuration = configuration.Label;
|
||||||
device.ConfigurationId = deviceIn.configurationId;
|
device.ConfigurationId = deviceIn.configurationId;
|
||||||
|
|
||||||
OldDevice deviceModified = _deviceService.Update(device.Id, device);
|
//OldDevice deviceModified = _deviceService.Update(device.Id, device);
|
||||||
|
_myInfoMateDbContext.SaveChanges();
|
||||||
|
|
||||||
MqttClientService.PublishMessage($"player/{device.Id}", JsonConvert.SerializeObject(new PlayerMessageDTO() { configChanged = true }));
|
MqttClientService.PublishMessage($"player/{device.Id}", JsonConvert.SerializeObject(new PlayerMessageDTO() { configChanged = true }));
|
||||||
|
|
||||||
return new OkObjectResult(deviceModified.ToDTO());
|
return new OkObjectResult(device.ToDTO());
|
||||||
}
|
}
|
||||||
catch (ArgumentNullException ex)
|
catch (ArgumentNullException ex)
|
||||||
{
|
{
|
||||||
@ -272,10 +297,14 @@ namespace ManagerService.Controllers
|
|||||||
if (id == null)
|
if (id == null)
|
||||||
throw new ArgumentNullException("Device param is null");
|
throw new ArgumentNullException("Device param is null");
|
||||||
|
|
||||||
if (!_deviceService.IsExist(id))
|
Device device = _myInfoMateDbContext.Devices.FirstOrDefault(d => d.Id == id);
|
||||||
|
|
||||||
|
if (device == null)
|
||||||
throw new KeyNotFoundException("Device does not exist");
|
throw new KeyNotFoundException("Device does not exist");
|
||||||
|
|
||||||
_deviceService.Remove(id);
|
_myInfoMateDbContext.Remove(device);
|
||||||
|
_myInfoMateDbContext.SaveChanges();
|
||||||
|
//_deviceService.Remove(id);
|
||||||
|
|
||||||
return new ObjectResult("The device has been deleted") { StatusCode = 202 };
|
return new ObjectResult("The device has been deleted") { StatusCode = 202 };
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,6 @@ namespace ManagerService.Controllers
|
|||||||
//List<OldInstance> instances = _instanceService.GetAll();
|
//List<OldInstance> instances = _instanceService.GetAll();
|
||||||
List<Instance> instances = _myInfoMateDbContext.Instances.ToList();
|
List<Instance> instances = _myInfoMateDbContext.Instances.ToList();
|
||||||
|
|
||||||
|
|
||||||
return new OkObjectResult(instances);
|
return new OkObjectResult(instances);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@ -12,8 +12,8 @@ namespace ManagerService.DTOs
|
|||||||
public string configurationId { get; set; }
|
public string configurationId { get; set; }
|
||||||
public string configuration { get; set; }
|
public string configuration { get; set; }
|
||||||
public bool connected{ get; set; }
|
public bool connected{ get; set; }
|
||||||
public DateTime dateCreation{ get; set; }
|
public DateTime? dateCreation{ get; set; }
|
||||||
public DateTime dateUpdate { get; set; }
|
public DateTime? dateUpdate { get; set; }
|
||||||
public string instanceId { get; set; }
|
public string instanceId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ namespace ManagerService.Data
|
|||||||
public string IpAddressETH { get; set; }
|
public string IpAddressETH { get; set; }
|
||||||
|
|
||||||
//[BsonElement("Configuration")]
|
//[BsonElement("Configuration")]
|
||||||
public string Configuration { get; set; }
|
public Configuration Configuration { get; set; }
|
||||||
|
|
||||||
//[BsonElement("ConfigurationId")]
|
//[BsonElement("ConfigurationId")]
|
||||||
//[BsonRequired]
|
//[BsonRequired]
|
||||||
@ -79,7 +79,7 @@ namespace ManagerService.Data
|
|||||||
ipAddressWLAN = IpAddressWLAN,
|
ipAddressWLAN = IpAddressWLAN,
|
||||||
ipAddressETH = IpAddressETH,
|
ipAddressETH = IpAddressETH,
|
||||||
connected = Connected,
|
connected = Connected,
|
||||||
configuration = Configuration,
|
configuration = Configuration.Label,
|
||||||
configurationId = ConfigurationId,
|
configurationId = ConfigurationId,
|
||||||
dateUpdate = DateUpdate,
|
dateUpdate = DateUpdate,
|
||||||
dateCreation = DateCreation,
|
dateCreation = DateCreation,
|
||||||
@ -97,7 +97,7 @@ namespace ManagerService.Data
|
|||||||
ipAddressWLAN = IpAddressWLAN,
|
ipAddressWLAN = IpAddressWLAN,
|
||||||
ipAddressETH = IpAddressETH,
|
ipAddressETH = IpAddressETH,
|
||||||
connected = Connected,
|
connected = Connected,
|
||||||
configuration = Configuration,
|
configuration = Configuration.Label,
|
||||||
configurationId = ConfigurationId,
|
configurationId = ConfigurationId,
|
||||||
connectionLevel = ConnectionLevel,
|
connectionLevel = ConnectionLevel,
|
||||||
lastConnectionLevel = LastConnectionLevel,
|
lastConnectionLevel = LastConnectionLevel,
|
||||||
@ -108,5 +108,26 @@ namespace ManagerService.Data
|
|||||||
instanceId = InstanceId
|
instanceId = InstanceId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Device FromDTO(DeviceDetailDTO deviceDetailDTO)
|
||||||
|
{
|
||||||
|
return new Device()
|
||||||
|
{
|
||||||
|
Id = deviceDetailDTO.id,
|
||||||
|
Name = deviceDetailDTO.name,
|
||||||
|
DateCreation = deviceDetailDTO.dateCreation != null ? deviceDetailDTO.dateCreation.Value : DateTime.Now.ToUniversalTime(),
|
||||||
|
Identifier = deviceDetailDTO.identifier,
|
||||||
|
IpAddressWLAN = deviceDetailDTO.ipAddressWLAN,
|
||||||
|
IpAddressETH = deviceDetailDTO.ipAddressETH,
|
||||||
|
Connected = deviceDetailDTO.connected,
|
||||||
|
ConfigurationId = deviceDetailDTO.configurationId,
|
||||||
|
ConnectionLevel = deviceDetailDTO.connectionLevel,
|
||||||
|
LastConnectionLevel = deviceDetailDTO.lastConnectionLevel,
|
||||||
|
BatteryLevel = deviceDetailDTO.batteryLevel,
|
||||||
|
LastBatteryLevel = deviceDetailDTO.lastBatteryLevel,
|
||||||
|
DateUpdate = deviceDetailDTO.dateUpdate != null ? deviceDetailDTO.dateUpdate.Value : DateTime.Now.ToUniversalTime(),
|
||||||
|
InstanceId = deviceDetailDTO.instanceId
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
835
ManagerService/Migrations/20250319105313_UpdateConfigurationLinkInDevice.Designer.cs
generated
Normal file
835
ManagerService/Migrations/20250319105313_UpdateConfigurationLinkInDevice.Designer.cs
generated
Normal file
@ -0,0 +1,835 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Manager.DTOs;
|
||||||
|
using ManagerService.DTOs;
|
||||||
|
using ManagerService.Data;
|
||||||
|
using ManagerService.Data.SubSection;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ManagerService.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(MyInfoMateDbContext))]
|
||||||
|
[Migration("20250319105313_UpdateConfigurationLinkInDevice")]
|
||||||
|
partial class UpdateConfigurationLinkInDevice
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "9.0.2")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.Configuration", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreation")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("ImageId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ImageSource")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("InstanceId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDate")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<bool>("IsHour")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<bool>("IsMobile")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<bool>("IsOffline")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<bool>("IsSectionImageBackground")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<bool>("IsTablet")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<string>("Label")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.PrimitiveCollection<List<string>>("Languages")
|
||||||
|
.HasColumnType("text[]");
|
||||||
|
|
||||||
|
b.Property<string>("LoaderImageId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("LoaderImageUrl")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("PrimaryColor")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("RoundedValue")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int?>("ScreenPercentageSectionsMainPage")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("SecondaryColor")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<List<Translation>>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<string>("WeatherCity")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("WeatherResult")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset?>("WeatherUpdatedDate")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Configurations");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.Device", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("BatteryLevel")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ConfigurationId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("Connected")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<string>("ConnectionLevel")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreation")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateUpdate")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("Identifier")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("InstanceId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("IpAddressETH")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("IpAddressWLAN")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastBatteryLevel")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastConnectionLevel")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ConfigurationId");
|
||||||
|
|
||||||
|
b.ToTable("Devices");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.Instance", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreation")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("PinCode")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Instances");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.Resource", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreation")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("InstanceId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Label")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Url")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Resources");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.Section", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("BeaconId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("ConfigurationId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreation")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<List<Translation>>("Description")
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<string>("Discriminator")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(8)
|
||||||
|
.HasColumnType("character varying(8)");
|
||||||
|
|
||||||
|
b.Property<string>("ImageId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ImageSource")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("InstanceId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("IsBeacon")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<bool>("IsSubSection")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<string>("Label")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Latitude")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Longitude")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("MeterZoneGPS")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Order")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("ParentId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("SectionMenuId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<List<Translation>>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("SectionMenuId");
|
||||||
|
|
||||||
|
b.ToTable("Sections");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Base");
|
||||||
|
|
||||||
|
b.UseTphMappingStrategy();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.Categorie", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Icon")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<List<Translation>>("Label")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<int?>("Order")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("ResourceId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("SectionMapId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ResourceId");
|
||||||
|
|
||||||
|
b.HasIndex("SectionMapId");
|
||||||
|
|
||||||
|
b.ToTable("Categorie");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.Content", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<List<Translation>>("Description")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<int>("Order")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("ResourceId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("SectionArticleId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("SectionSliderId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<List<Translation>>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ResourceId");
|
||||||
|
|
||||||
|
b.HasIndex("SectionArticleId");
|
||||||
|
|
||||||
|
b.HasIndex("SectionSliderId");
|
||||||
|
|
||||||
|
b.ToTable("Content");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.GeoPoint", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int?>("CategorieId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<List<Resource>>("Contents")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<List<Translation>>("Description")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<List<TranslationDTO>>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<string>("ImageResourceId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ImageUrl")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Latitude")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Longitude")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<List<TranslationDTO>>("Phone")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<List<TranslationDTO>>("Prices")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<List<TranslationDTO>>("Schedules")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<string>("SectionMapId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<List<TranslationDTO>>("Site")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<List<Translation>>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("SectionMapId");
|
||||||
|
|
||||||
|
b.ToTable("GeoPoint");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.OrderedTranslationAndResource", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Order")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("SectionPdfId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<List<TranslationAndResource>>("TranslationAndResources")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("SectionPdfId");
|
||||||
|
|
||||||
|
b.ToTable("OrderedTranslationAndResource");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<List<TranslationAndResourceDTO>>("Label")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<int>("Order")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("ResourceId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<List<ResponseDTO>>("Responses")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<string>("SectionQuizId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ResourceId");
|
||||||
|
|
||||||
|
b.HasIndex("SectionQuizId");
|
||||||
|
|
||||||
|
b.ToTable("QuizQuestion");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreation")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("FirstName")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("InstanceId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("LastName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Token")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionAgenda", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ManagerService.Data.Section");
|
||||||
|
|
||||||
|
b.Property<int?>("mapProvider")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<List<Translation>>("resourceIds")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Agenda");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionArticle", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ManagerService.Data.Section");
|
||||||
|
|
||||||
|
b.Property<List<Translation>>("audioIds")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<List<Translation>>("content")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<bool>("isContentTop")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<bool>("isReadAudioAuto")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Article");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ManagerService.Data.Section");
|
||||||
|
|
||||||
|
b.Property<string>("CenterLatitude")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("CenterLongitude")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("MapProvider")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int?>("MapType")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int?>("MapTypeMapbox")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("ResourceId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("Zoom")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasIndex("ResourceId");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Map");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMenu", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ManagerService.Data.Section");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Menu");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionPdf", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ManagerService.Data.Section");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("PDF");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionPuzzle", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ManagerService.Data.Section");
|
||||||
|
|
||||||
|
b.Property<int>("Cols")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("ContentId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("ContentId1")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<List<TranslationAndResource>>("MessageDebut")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<List<TranslationAndResource>>("MessageFin")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<int>("Rows")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasIndex("ContentId1");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Puzzle");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionQuiz", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ManagerService.Data.Section");
|
||||||
|
|
||||||
|
b.Property<List<TranslationAndResource>>("BadLevel")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<List<TranslationAndResource>>("GoodLevel")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<List<TranslationAndResource>>("GreatLevel")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<List<TranslationAndResource>>("MediumLevel")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Quiz");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionSlider", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ManagerService.Data.Section");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Slider");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionVideo", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ManagerService.Data.Section");
|
||||||
|
|
||||||
|
b.Property<string>("Source")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Video");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionWeather", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ManagerService.Data.Section");
|
||||||
|
|
||||||
|
b.Property<string>("City")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Result")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset?>("UpdatedDate")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Weather");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionWeb", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ManagerService.Data.Section");
|
||||||
|
|
||||||
|
b.Property<string>("Source")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.ToTable("Sections", t =>
|
||||||
|
{
|
||||||
|
t.Property("Source")
|
||||||
|
.HasColumnName("SectionWeb_Source");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Web");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.Device", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ManagerService.Data.Configuration", "Configuration")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ConfigurationId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Configuration");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.Section", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ManagerService.Data.SubSection.SectionMenu", null)
|
||||||
|
.WithMany("Sections")
|
||||||
|
.HasForeignKey("SectionMenuId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.Categorie", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ManagerService.Data.Resource", "Resource")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ResourceId");
|
||||||
|
|
||||||
|
b.HasOne("ManagerService.Data.SubSection.SectionMap", null)
|
||||||
|
.WithMany("Categories")
|
||||||
|
.HasForeignKey("SectionMapId");
|
||||||
|
|
||||||
|
b.Navigation("Resource");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.Content", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ManagerService.Data.Resource", "Resource")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ResourceId");
|
||||||
|
|
||||||
|
b.HasOne("ManagerService.Data.SubSection.SectionArticle", null)
|
||||||
|
.WithMany("contents")
|
||||||
|
.HasForeignKey("SectionArticleId");
|
||||||
|
|
||||||
|
b.HasOne("ManagerService.Data.SubSection.SectionSlider", null)
|
||||||
|
.WithMany("Contents")
|
||||||
|
.HasForeignKey("SectionSliderId");
|
||||||
|
|
||||||
|
b.Navigation("Resource");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.GeoPoint", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ManagerService.Data.SubSection.SectionMap", null)
|
||||||
|
.WithMany("Points")
|
||||||
|
.HasForeignKey("SectionMapId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.OrderedTranslationAndResource", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ManagerService.Data.SubSection.SectionPdf", null)
|
||||||
|
.WithMany("orderedTranslationAndResources")
|
||||||
|
.HasForeignKey("SectionPdfId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.QuizQuestion", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ManagerService.Data.Resource", "Resource")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ResourceId");
|
||||||
|
|
||||||
|
b.HasOne("ManagerService.Data.SubSection.SectionQuiz", null)
|
||||||
|
.WithMany("Questions")
|
||||||
|
.HasForeignKey("SectionQuizId");
|
||||||
|
|
||||||
|
b.Navigation("Resource");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ManagerService.Data.Resource", "Resource")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ResourceId");
|
||||||
|
|
||||||
|
b.Navigation("Resource");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionPuzzle", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ManagerService.Data.SubSection.Content", "Content")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ContentId1");
|
||||||
|
|
||||||
|
b.Navigation("Content");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionArticle", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("contents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMap", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Categories");
|
||||||
|
|
||||||
|
b.Navigation("Points");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionMenu", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Sections");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionPdf", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("orderedTranslationAndResources");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionQuiz", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Questions");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.SubSection.SectionSlider", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Contents");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ManagerService.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class UpdateConfigurationLinkInDevice : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Configuration",
|
||||||
|
table: "Devices");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Devices_ConfigurationId",
|
||||||
|
table: "Devices",
|
||||||
|
column: "ConfigurationId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Devices_Configurations_ConfigurationId",
|
||||||
|
table: "Devices",
|
||||||
|
column: "ConfigurationId",
|
||||||
|
principalTable: "Configurations",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Devices_Configurations_ConfigurationId",
|
||||||
|
table: "Devices");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Devices_ConfigurationId",
|
||||||
|
table: "Devices");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Configuration",
|
||||||
|
table: "Devices",
|
||||||
|
type: "text",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -113,9 +113,6 @@ namespace ManagerService.Migrations
|
|||||||
b.Property<string>("BatteryLevel")
|
b.Property<string>("BatteryLevel")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("Configuration")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ConfigurationId")
|
b.Property<string>("ConfigurationId")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
@ -158,6 +155,8 @@ namespace ManagerService.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ConfigurationId");
|
||||||
|
|
||||||
b.ToTable("Devices");
|
b.ToTable("Devices");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -703,6 +702,17 @@ namespace ManagerService.Migrations
|
|||||||
b.HasDiscriminator().HasValue("Web");
|
b.HasDiscriminator().HasValue("Web");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ManagerService.Data.Device", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ManagerService.Data.Configuration", "Configuration")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ConfigurationId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Configuration");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ManagerService.Data.Section", b =>
|
modelBuilder.Entity("ManagerService.Data.Section", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("ManagerService.Data.SubSection.SectionMenu", null)
|
b.HasOne("ManagerService.Data.SubSection.SectionMenu", null)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user