Wip clean code and pass by postgres !
This commit is contained in:
parent
d968c419b3
commit
8c18825c5d
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -9,4 +9,10 @@
|
||||
<PackageReference Include="Scrypt.NET" Version="1.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Business\" />
|
||||
<Folder Include="Helpers\Passwords\" />
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
using Manager.Interfaces.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
{
|
||||
public class TranslationDTO
|
||||
{
|
||||
public string language { get; set; }
|
||||
public string value { get; set; }
|
||||
}
|
||||
}
|
||||
17
Manager.Interfaces/Manager.Data.csproj
Normal file
17
Manager.Interfaces/Manager.Data.csproj
Normal file
@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MongoDB.Bson" Version="2.12.1" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="DTO\" />
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@ -1,11 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MongoDB.Bson" Version="2.12.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@ -1,14 +1,10 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30907.101
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.12.35527.113 d17.12
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManagerService", "ManagerService\ManagerService.csproj", "{042E0BC4-8DCF-4EEC-8420-C71AA85D4D99}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Manager.Framework", "Manager.Framework\Manager.Framework.csproj", "{B9548312-650F-4538-85B8-8447F8BB2BD3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Manager.Interfaces", "Manager.Interfaces\Manager.Interfaces.csproj", "{0B2EDCA0-C813-4EAA-9215-E219AE884F7D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -19,14 +15,6 @@ Global
|
||||
{042E0BC4-8DCF-4EEC-8420-C71AA85D4D99}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{042E0BC4-8DCF-4EEC-8420-C71AA85D4D99}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{042E0BC4-8DCF-4EEC-8420-C71AA85D4D99}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B9548312-650F-4538-85B8-8447F8BB2BD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B9548312-650F-4538-85B8-8447F8BB2BD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B9548312-650F-4538-85B8-8447F8BB2BD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B9548312-650F-4538-85B8-8447F8BB2BD3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0B2EDCA0-C813-4EAA-9215-E219AE884F7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0B2EDCA0-C813-4EAA-9215-E219AE884F7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0B2EDCA0-C813-4EAA-9215-E219AE884F7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0B2EDCA0-C813-4EAA-9215-E219AE884F7D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@ -1,18 +1,16 @@
|
||||
using Manager.Interfaces.DTO;
|
||||
using Manager.Services;
|
||||
using Manager.Services;
|
||||
using ManagerService.Data;
|
||||
using ManagerService.DTOs;
|
||||
using ManagerService.Service.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using Mqtt.Client.AspNetCore.Services;
|
||||
using NSwag.Annotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
|
||||
namespace ManagerService.Service.Controllers
|
||||
{
|
||||
@ -26,17 +24,20 @@ namespace ManagerService.Service.Controllers
|
||||
{
|
||||
private readonly ILogger<AuthenticationController> _logger;
|
||||
private readonly TokensService _tokensService;
|
||||
private readonly UserDatabaseService _UserDatabaseService;
|
||||
/*private readonly UserDatabaseService _UserDatabaseService;
|
||||
private readonly DeviceDatabaseService _DeviceDatabaseService;
|
||||
private readonly ConfigurationDatabaseService _ConfigurationDatabaseService;
|
||||
private readonly ConfigurationDatabaseService _ConfigurationDatabaseService;*/
|
||||
private readonly MyInfoMateDbContext _myInfoMateDbContext;
|
||||
|
||||
public AuthenticationController(ILogger<AuthenticationController> logger, TokensService tokensService, UserDatabaseService UserDatabaseService, DeviceDatabaseService DeviceDatabaseService, ConfigurationDatabaseService ConfigurationDatabaseService)
|
||||
|
||||
public AuthenticationController(ILogger<AuthenticationController> logger, TokensService tokensService, MyInfoMateDbContext myInfoMateDbContext/*UserDatabaseService UserDatabaseService, DeviceDatabaseService DeviceDatabaseService, ConfigurationDatabaseService ConfigurationDatabaseService*/)
|
||||
{
|
||||
_logger = logger;
|
||||
_tokensService = tokensService;
|
||||
_UserDatabaseService = UserDatabaseService;
|
||||
_DeviceDatabaseService = DeviceDatabaseService;
|
||||
_ConfigurationDatabaseService = ConfigurationDatabaseService;
|
||||
_myInfoMateDbContext = myInfoMateDbContext;
|
||||
//_UserDatabaseService = UserDatabaseService;
|
||||
//_DeviceDatabaseService = DeviceDatabaseService;
|
||||
//_ConfigurationDatabaseService = ConfigurationDatabaseService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -54,14 +55,15 @@ namespace ManagerService.Service.Controllers
|
||||
password = "kljqsdkljqsd"; // password = "kljqsdkljqsd"; // W/7aj4NB60i3YFKJq50pbw==
|
||||
#endif
|
||||
// Set user token ?
|
||||
var user = _UserDatabaseService.GetByEmail(email.ToLower());
|
||||
var user = _myInfoMateDbContext.Users.FirstOrDefault(u => u.Email.ToLower() == email.ToLower());
|
||||
//var user = _UserDatabaseService.GetByEmail(email.ToLower());
|
||||
|
||||
if (user == null)
|
||||
throw new KeyNotFoundException("User not found");
|
||||
|
||||
var token = _tokensService.Authenticate(user, password);
|
||||
|
||||
MqttClientService.SetServices(_DeviceDatabaseService, _ConfigurationDatabaseService);
|
||||
MqttClientService.SetServices(_myInfoMateDbContext);//_DeviceDatabaseService, _ConfigurationDatabaseService);
|
||||
|
||||
return new OkObjectResult(token);
|
||||
}
|
||||
|
||||
@ -4,13 +4,13 @@ using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Manager.DTOs;
|
||||
using Manager.Helpers;
|
||||
using Manager.Interfaces.DTO;
|
||||
using Manager.Interfaces.Models;
|
||||
using Manager.Services;
|
||||
using ManagerService.Service.Services;
|
||||
using ManagerService.Data;
|
||||
using ManagerService.DTOs;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.DataProtection.KeyManagement;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@ -25,23 +25,21 @@ namespace ManagerService.Controllers
|
||||
[OpenApiTag("Configuration", Description = "Configuration management")]
|
||||
public class ConfigurationController : ControllerBase
|
||||
{
|
||||
private ConfigurationDatabaseService _configurationService;
|
||||
private readonly MyInfoMateDbContext _myInfoMateDbContext;
|
||||
|
||||
/*private ConfigurationDatabaseService _configurationService;
|
||||
private InstanceDatabaseService _instanceService;
|
||||
private SectionDatabaseService _sectionService;
|
||||
private ResourceDatabaseService _resourceService;
|
||||
private DeviceDatabaseService _deviceService;
|
||||
private DeviceDatabaseService _deviceService;*/
|
||||
private readonly ILogger<ConfigurationController> _logger;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public ConfigurationController(IConfiguration configuration, ILogger<ConfigurationController> logger, ConfigurationDatabaseService configurationService, InstanceDatabaseService instanceService, SectionDatabaseService sectionService, ResourceDatabaseService resourceService, DeviceDatabaseService deviceService)
|
||||
public ConfigurationController(IConfiguration configuration, ILogger<ConfigurationController> logger, MyInfoMateDbContext myInfoMateDbContext)
|
||||
{
|
||||
_logger = logger;
|
||||
_configuration = configuration;
|
||||
_configurationService = configurationService;
|
||||
_instanceService = instanceService;
|
||||
_sectionService = sectionService;
|
||||
_resourceService = resourceService;
|
||||
_deviceService = deviceService;
|
||||
_myInfoMateDbContext = myInfoMateDbContext;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -56,13 +54,13 @@ namespace ManagerService.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
List<Configuration> configurations = _configurationService.GetAll(instanceId);
|
||||
List<Configuration> configurations = _myInfoMateDbContext.Configurations.Where(c => c.InstanceId == instanceId).ToList();
|
||||
|
||||
List<ConfigurationDTO> configurationDTOs = new List<ConfigurationDTO>();
|
||||
|
||||
foreach(var configuration in configurations)
|
||||
{
|
||||
List<string> sectionIds = _sectionService.GetAllIdsFromConfiguration(configuration.Id);
|
||||
List<string> sectionIds = _myInfoMateDbContext.Sections.Where(c => c.ConfigurationId == configuration.Id).Select(c => c.Id).ToList();
|
||||
ConfigurationDTO configurationDTO = configuration.ToDTO(sectionIds);
|
||||
configurationDTOs.Add(configurationDTO);
|
||||
}
|
||||
@ -225,7 +223,7 @@ namespace ManagerService.Controllers
|
||||
Configuration configuration = new Configuration();
|
||||
configuration.InstanceId = newConfiguration.instanceId;
|
||||
configuration.Label = newConfiguration.label;
|
||||
configuration.Title = new List<TranslationDTO>();
|
||||
configuration.Title = new List<Translation>();
|
||||
configuration.ImageId = newConfiguration.imageId;
|
||||
configuration.ImageSource = newConfiguration.imageSource;
|
||||
configuration.PrimaryColor = newConfiguration.primaryColor;
|
||||
@ -294,7 +292,7 @@ namespace ManagerService.Controllers
|
||||
// Todo add some verification ?
|
||||
configuration.InstanceId = updatedConfiguration.instanceId;
|
||||
configuration.Label = updatedConfiguration.label;
|
||||
configuration.Title = updatedConfiguration.title;
|
||||
configuration.Title = updatedConfiguration.title.Select(t => new Translation().FromDTO(t)).ToList(); // TO CHEECK !
|
||||
configuration.ImageId = updatedConfiguration.imageId;
|
||||
configuration.ImageSource = updatedConfiguration.imageSource;
|
||||
configuration.PrimaryColor = updatedConfiguration.primaryColor;
|
||||
@ -644,7 +642,7 @@ namespace ManagerService.Controllers
|
||||
configuration.Id = exportConfiguration.id;
|
||||
configuration.InstanceId = exportConfiguration.instanceId;
|
||||
configuration.Label = exportConfiguration.label;
|
||||
configuration.Title = exportConfiguration.title;
|
||||
configuration.Title = exportConfiguration.title.Select(t => new Translation().FromDTO(t)).ToList(); // TO CHEECK !
|
||||
configuration.ImageId = exportConfiguration.imageId;
|
||||
configuration.ImageSource = exportConfiguration.imageSource;
|
||||
|
||||
@ -683,8 +681,8 @@ namespace ManagerService.Controllers
|
||||
newSection.Id = section.id;
|
||||
newSection.InstanceId = section.instanceId;
|
||||
newSection.Label = section.label;
|
||||
newSection.Title = section.title;
|
||||
newSection.Description = section.description;
|
||||
newSection.Title = section.title.Select(t => new Translation().FromDTO(t)).ToList(); // TODO TEST
|
||||
newSection.Description = section.description.Select(t => new Translation().FromDTO(t)).ToList(); // TODO TEST
|
||||
newSection.Order = section.order.GetValueOrDefault(); // if one day we can use same section in multiple configuration, need to change that
|
||||
newSection.Type = section.type;
|
||||
newSection.ImageId = section.imageId;
|
||||
|
||||
@ -1,14 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Manager.Interfaces.DTO;
|
||||
using Manager.Interfaces.Models;
|
||||
using Manager.Services;
|
||||
using ManagerService.Service.Services;
|
||||
using ManagerService.Data;
|
||||
using ManagerService.DTOs;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Manager.Framework.Business;
|
||||
using Manager.Interfaces.DTO;
|
||||
using Manager.Interfaces.Models;
|
||||
using Manager.Services;
|
||||
using ManagerService.Service.Services;
|
||||
using ManagerService.Data;
|
||||
using ManagerService.DTOs;
|
||||
using ManagerService.Helpers;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@ -1,25 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Manager.Interfaces.DTO;
|
||||
using Manager.Interfaces.Models;
|
||||
using Manager.DTOs;
|
||||
using Manager.Services;
|
||||
using ManagerService.Data;
|
||||
using ManagerService.DTOs;
|
||||
using ManagerService.Helpers;
|
||||
using ManagerService.Service.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Server.IIS.Core;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using NSwag.Annotations;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace ManagerService.Controllers
|
||||
{
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
using Manager.Helpers;
|
||||
using Manager.Interfaces.DTO;
|
||||
using Manager.Interfaces.Models;
|
||||
using Manager.DTOs;
|
||||
using Manager.Helpers;
|
||||
using Manager.Services;
|
||||
using ManagerService.Data;
|
||||
using ManagerService.DTOs;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
@ -292,8 +293,8 @@ namespace ManagerService.Controllers
|
||||
section.IsSubSection = newSection.isSubSection;
|
||||
section.ParentId = newSection.parentId;
|
||||
section.Type = newSection.type;
|
||||
section.Title = new List<TranslationDTO>();
|
||||
section.Description = new List<TranslationDTO>();
|
||||
section.Title = new List<Translation>();
|
||||
section.Description = new List<Translation>();
|
||||
section.Order = _sectionService.GetAllFromConfiguration(newSection.configurationId).Count;
|
||||
section.IsBeacon = newSection.isBeacon;
|
||||
section.BeaconId = newSection.beaconId;
|
||||
@ -304,7 +305,7 @@ namespace ManagerService.Controllers
|
||||
// Preparation
|
||||
List<string> languages = _configuration.GetSection("SupportedLanguages").Get<List<string>>();
|
||||
|
||||
var contentArticle = new List<TranslationDTO>();
|
||||
var contentArticle = new List<Translation>();
|
||||
|
||||
var mapDTO = new MapDTO(); // For menu dto
|
||||
var sliderDTO = new SliderDTO(); // For menu dto
|
||||
@ -349,8 +350,8 @@ namespace ManagerService.Controllers
|
||||
contentArticle.Add(content);
|
||||
}*/
|
||||
|
||||
section.Title = section.Title.OrderBy(t => t.language).ToList();
|
||||
section.Description = section.Description.OrderBy(d => d.language).ToList();
|
||||
section.Title = section.Title.OrderBy(t => t.Language).ToList();
|
||||
section.Description = section.Description.OrderBy(d => d.Language).ToList();
|
||||
|
||||
switch (newSection.type) {
|
||||
case SectionType.Map:
|
||||
@ -418,8 +419,8 @@ namespace ManagerService.Controllers
|
||||
case SectionType.Article:
|
||||
ArticleDTO articleDTO = new ArticleDTO();
|
||||
articleDTO.contents = new List<ContentDTO>();
|
||||
articleDTO.content = contentArticle;
|
||||
articleDTO.audioIds = LanguageInit.Init("Audio", languages, true);
|
||||
articleDTO.content = contentArticle.Select(c => c.ToDTO()).ToList(); // TODO check
|
||||
articleDTO.audioIds = LanguageInit.Init("Audio", languages, true).Select(c => c.ToDTO()).ToList(); // TODO check
|
||||
|
||||
section.Data = JsonConvert.SerializeObject(articleDTO); // Include all info from specific section as JSON
|
||||
break;
|
||||
@ -535,8 +536,8 @@ namespace ManagerService.Controllers
|
||||
// Todo add some verification ?
|
||||
section.InstanceId = updatedSection.instanceId;
|
||||
section.Label = updatedSection.label;
|
||||
section.Title = updatedSection.title;
|
||||
section.Description = updatedSection.description;
|
||||
section.Title = updatedSection.title.Select(t => new Translation().FromDTO(t)).ToList(); // TODO CHECK
|
||||
section.Description = updatedSection.description.Select(t => new Translation().FromDTO(t)).ToList();// TODO CHECK
|
||||
section.Type = updatedSection.type;
|
||||
section.ImageId = updatedSection.imageId;
|
||||
section.ImageSource = updatedSection.imageSource;
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Manager.Framework.Business;
|
||||
using Manager.Interfaces.DTO;
|
||||
using Manager.Interfaces.Models;
|
||||
using Manager.Services;
|
||||
using ManagerService.Data;
|
||||
using ManagerService.DTOs;
|
||||
using ManagerService.Helpers;
|
||||
using ManagerService.Service.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace ManagerService.DTOs
|
||||
{
|
||||
public class ConfigurationDTO
|
||||
{
|
||||
@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace ManagerService.DTOs
|
||||
{
|
||||
public class DeviceDTO
|
||||
{
|
||||
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace ManagerService.DTOs
|
||||
{
|
||||
public class ExportConfigurationDTO : ConfigurationDTO
|
||||
{
|
||||
@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace ManagerService.DTOs
|
||||
{
|
||||
public class InstanceDTO
|
||||
{
|
||||
@ -1,4 +1,4 @@
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace ManagerService.DTOs
|
||||
{
|
||||
public class LoginDTO
|
||||
{
|
||||
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.Models
|
||||
namespace ManagerService.DTOs
|
||||
{
|
||||
public class PlayerMessageDTO
|
||||
{
|
||||
@ -1,9 +1,7 @@
|
||||
using Manager.Interfaces.Models;
|
||||
using ManagerService.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace ManagerService.DTOs
|
||||
{
|
||||
public class ResourceDTO
|
||||
{
|
||||
@ -1,9 +1,8 @@
|
||||
using Manager.Interfaces.Models;
|
||||
using ManagerService.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace ManagerService.DTOs
|
||||
{
|
||||
public class SectionDTO
|
||||
{
|
||||
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using ManagerService.DTOs;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace Manager.DTOs
|
||||
{
|
||||
public class AgendaDTO
|
||||
{
|
||||
@ -1,9 +1,7 @@
|
||||
using Manager.Interfaces.Models;
|
||||
using System;
|
||||
using ManagerService.DTOs;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace Manager.DTOs
|
||||
{
|
||||
public class ArticleDTO
|
||||
{
|
||||
@ -1,9 +1,9 @@
|
||||
using Manager.Interfaces.Models;
|
||||
using System;
|
||||
using ManagerService.Data;
|
||||
using ManagerService.DTOs;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace Manager.DTOs
|
||||
{
|
||||
public class MapDTO
|
||||
{
|
||||
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using ManagerService.DTOs;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace Manager.DTOs
|
||||
{
|
||||
public class MenuDTO
|
||||
{
|
||||
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using ManagerService.DTOs;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace Manager.DTOs
|
||||
{
|
||||
public class PdfDTO
|
||||
{
|
||||
@ -1,9 +1,7 @@
|
||||
using Manager.Interfaces.Models;
|
||||
using System;
|
||||
using ManagerService.DTOs;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace Manager.DTOs
|
||||
{
|
||||
public class PuzzleDTO
|
||||
{
|
||||
@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using ManagerService.DTOs;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.AccessControl;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace Manager.DTOs
|
||||
{
|
||||
public class QuizzDTO
|
||||
{
|
||||
@ -1,9 +1,8 @@
|
||||
using Manager.Interfaces.Models;
|
||||
using System;
|
||||
using ManagerService.Data;
|
||||
using ManagerService.DTOs;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace Manager.DTOs
|
||||
{
|
||||
public class SliderDTO
|
||||
{
|
||||
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace Manager.DTOs
|
||||
{
|
||||
public class VideoDTO
|
||||
{
|
||||
@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace Manager.DTOs
|
||||
{
|
||||
public class WeatherDTO
|
||||
{
|
||||
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace Manager.DTOs
|
||||
{
|
||||
public class WebDTO
|
||||
{
|
||||
@ -1,4 +1,4 @@
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace ManagerService.DTOs
|
||||
{
|
||||
/// <summary>
|
||||
/// Swagger test client authentication data
|
||||
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace ManagerService.DTOs
|
||||
{
|
||||
public class TokenDTO
|
||||
{
|
||||
@ -1,9 +1,7 @@
|
||||
using Manager.Interfaces.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using ManagerService.Data;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace ManagerService.DTOs
|
||||
{
|
||||
public class TranslationAndResourceDTO
|
||||
{
|
||||
8
ManagerService/DTOs/TranslationDTO.cs
Normal file
8
ManagerService/DTOs/TranslationDTO.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace ManagerService.DTOs
|
||||
{
|
||||
public class TranslationDTO
|
||||
{
|
||||
public string language { get; set; }
|
||||
public string value { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.DTO
|
||||
namespace ManagerService.DTOs
|
||||
{
|
||||
public class UserDetailDTO
|
||||
{
|
||||
@ -1,88 +1,96 @@
|
||||
using Manager.Interfaces.DTO;
|
||||
using ManagerService.DTOs;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Manager.Interfaces.Models
|
||||
namespace ManagerService.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Configuration Information
|
||||
/// </summary>
|
||||
public class Configuration
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
|
||||
[Key]
|
||||
[Required]
|
||||
/*[BsonId]
|
||||
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]*/
|
||||
public string Id { get; set; }
|
||||
|
||||
[BsonElement("Label")]
|
||||
[BsonRequired]
|
||||
/*[BsonElement("Label")]
|
||||
[BsonRequired]*/
|
||||
[Required]
|
||||
public string Label { get; set; }
|
||||
|
||||
[BsonElement("Title")]
|
||||
[BsonRequired]
|
||||
public List<TranslationDTO> Title { get; set; }
|
||||
/*[BsonElement("Title")]
|
||||
[BsonRequired]*/
|
||||
[Required]
|
||||
[Column(TypeName = "jsonb")]
|
||||
public List<Translation> Title { get; set; }
|
||||
|
||||
[BsonElement("ImageId")]
|
||||
/*[BsonElement("ImageId")]*/
|
||||
public string ImageId { get; set; }
|
||||
|
||||
[BsonElement("ImageSource")]
|
||||
/*[BsonElement("ImageSource")]*/
|
||||
public string ImageSource { get; set; }
|
||||
|
||||
[BsonElement("PrimaryColor")]
|
||||
/*[BsonElement("PrimaryColor")]*/
|
||||
public string PrimaryColor { get; set; }
|
||||
|
||||
[BsonElement("SecondaryColor")]
|
||||
/*[BsonElement("SecondaryColor")]*/
|
||||
public string SecondaryColor { get; set; }
|
||||
|
||||
[BsonElement("Languages")]
|
||||
/*[BsonElement("Languages")]*/
|
||||
public List<string> Languages { get; set; } // fr, en, de, nl => Sélection dans une liste déjà établie dans l'application !
|
||||
|
||||
[BsonElement("DateCreation")]
|
||||
/*[BsonElement("DateCreation")]*/
|
||||
public DateTime DateCreation { get; set; }
|
||||
|
||||
[BsonElement("IsMobile")]
|
||||
/*[BsonElement("IsMobile")]*/
|
||||
public bool IsMobile { get; set; }
|
||||
|
||||
[BsonElement("IsTablet")]
|
||||
/*[BsonElement("IsTablet")]*/
|
||||
public bool IsTablet { get; set; }
|
||||
|
||||
[BsonElement("IsOffline")]
|
||||
/*[BsonElement("IsOffline")]*/
|
||||
public bool IsOffline { get; set; }
|
||||
|
||||
[BsonElement("InstanceId")]
|
||||
[BsonRequired]
|
||||
/*[BsonElement("InstanceId")]
|
||||
[BsonRequired]*/
|
||||
[Required]
|
||||
public string InstanceId { get; set; }
|
||||
|
||||
[BsonElement("LoaderImageId")]
|
||||
/*[BsonElement("LoaderImageId")]*/
|
||||
public string LoaderImageId { get; set; }
|
||||
|
||||
[BsonElement("LoaderImageUrl")]
|
||||
/*[BsonElement("LoaderImageUrl")]*/
|
||||
public string LoaderImageUrl { get; set; }
|
||||
|
||||
[BsonElement("WeatherCity")]
|
||||
/*[BsonElement("WeatherCity")]*/
|
||||
public string WeatherCity { get; set; }
|
||||
|
||||
[BsonElement("WeatherUpdatedDate")]
|
||||
/*[BsonElement("WeatherUpdatedDate")]*/
|
||||
public DateTimeOffset? WeatherUpdatedDate { get; set; }
|
||||
|
||||
[BsonElement("WeatherResult")]
|
||||
/*[BsonElement("WeatherResult")]*/
|
||||
public string WeatherResult { get; set; }
|
||||
|
||||
[BsonElement("IsDate")]
|
||||
/*[BsonElement("IsDate")]*/
|
||||
public bool IsDate { get; set; }
|
||||
|
||||
[BsonElement("IsHour")]
|
||||
/*[BsonElement("IsHour")]*/
|
||||
public bool IsHour { get; set; }
|
||||
|
||||
[BsonElement("IsSectionImageBackground")]
|
||||
/*[BsonElement("IsSectionImageBackground")]*/
|
||||
public bool IsSectionImageBackground { get; set; }
|
||||
|
||||
[BsonElement("RoundedValue")]
|
||||
/*[BsonElement("RoundedValue")]*/
|
||||
public int? RoundedValue { get; set; }
|
||||
|
||||
[BsonElement("ScreenPercentageSectionsMainPage")]
|
||||
/*[BsonElement("ScreenPercentageSectionsMainPage")]*/
|
||||
public int? ScreenPercentageSectionsMainPage { get; set; }
|
||||
|
||||
public ConfigurationDTO ToDTO(List<string> sectionIds)
|
||||
@ -91,7 +99,7 @@ namespace Manager.Interfaces.Models
|
||||
{
|
||||
id = Id,
|
||||
label = Label,
|
||||
title = Title,
|
||||
title = Title.Select(c => c.ToDTO()).ToList(),
|
||||
imageId = ImageId,
|
||||
imageSource = ImageSource,
|
||||
loaderImageId = LoaderImageId,
|
||||
@ -121,7 +129,7 @@ namespace Manager.Interfaces.Models
|
||||
{
|
||||
id = Id,
|
||||
label = Label,
|
||||
title= Title,
|
||||
title= Title.Select(c => c.ToDTO()).ToList(),
|
||||
imageId = ImageId,
|
||||
imageSource = ImageSource,
|
||||
loaderImageId = LoaderImageId,
|
||||
@ -1,67 +1,72 @@
|
||||
using Manager.Interfaces.DTO;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using ManagerService.DTOs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Manager.Interfaces.Models
|
||||
namespace ManagerService.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Device Information (Tablet)
|
||||
/// </summary>
|
||||
public class Device
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
|
||||
[Key]
|
||||
[Required]
|
||||
/*[BsonId]
|
||||
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]*/
|
||||
public string Id { get; set; }
|
||||
|
||||
[BsonElement("Identifier")]
|
||||
//[BsonElement("Identifier")]
|
||||
public string Identifier { get; set; }
|
||||
|
||||
[BsonElement("Name")]
|
||||
//[BsonElement("Name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[BsonElement("IpAddressWLAN")]
|
||||
[BsonRequired]
|
||||
/*[BsonElement("IpAddressWLAN")]
|
||||
[BsonRequired]*/
|
||||
[Required]
|
||||
public string IpAddressWLAN { get; set; }
|
||||
|
||||
[BsonElement("IpAddressETH")]
|
||||
[BsonRequired]
|
||||
//[BsonElement("IpAddressETH")]
|
||||
//[BsonRequired]
|
||||
[Required]
|
||||
public string IpAddressETH { get; set; }
|
||||
|
||||
[BsonElement("Configuration")]
|
||||
//[BsonElement("Configuration")]
|
||||
public string Configuration { get; set; }
|
||||
|
||||
[BsonElement("ConfigurationId")]
|
||||
[BsonRequired]
|
||||
//[BsonElement("ConfigurationId")]
|
||||
//[BsonRequired]
|
||||
[Required]
|
||||
public string ConfigurationId { get; set; }
|
||||
|
||||
[BsonElement("Connected")]
|
||||
[BsonRequired]
|
||||
//[BsonElement("Connected")]
|
||||
//[BsonRequired]
|
||||
[Required]
|
||||
public bool Connected { get; set; }
|
||||
|
||||
[BsonElement("DateCreation")]
|
||||
//[BsonElement("DateCreation")]
|
||||
public DateTime DateCreation { get; set; }
|
||||
|
||||
[BsonElement("DateUpdate")]
|
||||
//[BsonElement("DateUpdate")]
|
||||
public DateTime DateUpdate { get; set; }
|
||||
|
||||
// BatteryLevel in case of powered devices
|
||||
[BsonElement("BatteryLevel")]
|
||||
//[BsonElement("BatteryLevel")]
|
||||
public string BatteryLevel { get; set; }
|
||||
|
||||
[BsonElement("LastBatteryLevel")]
|
||||
//[BsonElement("LastBatteryLevel")]
|
||||
public DateTime LastBatteryLevel { get; set; }
|
||||
|
||||
// ConnectionLevel wifi strength level
|
||||
[BsonElement("ConnectionLevel")]
|
||||
//[BsonElement("ConnectionLevel")]
|
||||
public string ConnectionLevel { get; set; }
|
||||
|
||||
[BsonElement("LastConnectionLevel")]
|
||||
//[BsonElement("LastConnectionLevel")]
|
||||
public DateTime LastConnectionLevel { get; set; }
|
||||
|
||||
[BsonElement("InstanceId")]
|
||||
[BsonRequired]
|
||||
/*[BsonElement("InstanceId")]
|
||||
[BsonRequired]*/
|
||||
[Required]
|
||||
public string InstanceId { get; set; }
|
||||
|
||||
public DeviceDTO ToDTO()
|
||||
@ -1,28 +1,29 @@
|
||||
using Manager.Interfaces.DTO;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using ManagerService.DTOs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Manager.Interfaces.Models
|
||||
namespace ManagerService.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Instance Information
|
||||
/// </summary>
|
||||
public class Instance
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
|
||||
[Key]
|
||||
[Required]
|
||||
/*[BsonId]
|
||||
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]*/
|
||||
public string Id { get; set; }
|
||||
|
||||
[BsonElement("Name")]
|
||||
[BsonRequired]
|
||||
/*[BsonElement("Name")]
|
||||
[BsonRequired]*/
|
||||
[Required]
|
||||
public string Name { get; set; } // UNIQUE !..
|
||||
|
||||
[BsonElement("DateCreation")]
|
||||
/*[BsonElement("DateCreation")]*/
|
||||
public DateTime DateCreation { get; set; }
|
||||
|
||||
[BsonElement("PinCode")]
|
||||
/*[BsonElement("PinCode")]*/
|
||||
public int? PinCode { get; set; }
|
||||
|
||||
public InstanceDTO ToDTO()
|
||||
33
ManagerService/Data/MyInfoMateDbContext.cs
Normal file
33
ManagerService/Data/MyInfoMateDbContext.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ManagerService.Data
|
||||
{
|
||||
public class MyInfoMateDbContext : DbContext
|
||||
{
|
||||
public MyInfoMateDbContext(DbContextOptions<MyInfoMateDbContext> options) : base(options) { }
|
||||
|
||||
public DbSet<Instance> Instances { get; set; }
|
||||
public DbSet<Configuration> Configurations { get; set; }
|
||||
public DbSet<Section> Sections { get; set; }
|
||||
public DbSet<Device> Devices { get; set; }
|
||||
public DbSet<Resource> Resources { get; set; }
|
||||
public DbSet<User> Users { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
modelBuilder.Entity<Configuration>()
|
||||
.Property(s => s.Title)
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
modelBuilder.Entity<Section>()
|
||||
.Property(s => s.Title)
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
modelBuilder.Entity<Section>()
|
||||
.Property(s => s.Description)
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,37 +1,39 @@
|
||||
using Manager.Interfaces.DTO;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using ManagerService.DTOs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
|
||||
namespace Manager.Interfaces.Models
|
||||
namespace ManagerService.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Resource Information
|
||||
/// </summary>
|
||||
public class Resource
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
|
||||
[Key]
|
||||
[Required]
|
||||
/*[BsonId]
|
||||
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]*/
|
||||
public string Id { get; set; }
|
||||
|
||||
[BsonElement("Type")]
|
||||
[BsonRequired]
|
||||
/*[BsonElement("Type")]
|
||||
[BsonRequired]*/
|
||||
[Required]
|
||||
public ResourceType Type { get; set; }
|
||||
|
||||
[BsonElement("Label")]
|
||||
[BsonRequired]
|
||||
/*[BsonElement("Label")]
|
||||
[BsonRequired]*/
|
||||
[Required]
|
||||
public string Label { get; set; }
|
||||
|
||||
[BsonElement("DateCreation")]
|
||||
/*[BsonElement("DateCreation")]*/
|
||||
public DateTime DateCreation { get; set; }
|
||||
|
||||
[BsonElement("InstanceId")]
|
||||
[BsonRequired]
|
||||
/*[BsonElement("InstanceId")]
|
||||
[BsonRequired]*/
|
||||
[Required]
|
||||
public string InstanceId { get; set; }
|
||||
|
||||
[BsonElement("URL")]
|
||||
/*[BsonElement("URL")]*/
|
||||
public string Url { get; set; } // Firebase url
|
||||
|
||||
public ResourceDTO ToDTO()
|
||||
@ -1,83 +1,96 @@
|
||||
using Manager.Interfaces.DTO;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using ManagerService.DTOs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace Manager.Interfaces.Models
|
||||
namespace ManagerService.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Section Information
|
||||
/// </summary>
|
||||
public class Section
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
|
||||
[Key]
|
||||
[Required]
|
||||
/*[BsonId]
|
||||
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]*/
|
||||
public string Id { get; set; }
|
||||
|
||||
[BsonElement("Label")]
|
||||
[BsonRequired]
|
||||
//[BsonElement("Label")]
|
||||
//[BsonRequired]
|
||||
[Required]
|
||||
public string Label { get; set; } // Use in manager
|
||||
|
||||
[BsonElement("Title")]
|
||||
[BsonRequired]
|
||||
public List<TranslationDTO> Title { get; set; }
|
||||
//[BsonElement("Title")]
|
||||
//[BsonRequired]
|
||||
[Required]
|
||||
[Column(TypeName = "jsonb")]
|
||||
public List<Translation> Title { get; set; }
|
||||
|
||||
[BsonElement("Description")]
|
||||
public List<TranslationDTO> Description { get; set; }
|
||||
//[BsonElement("Description")]
|
||||
[Column(TypeName = "jsonb")]
|
||||
public List<Translation> Description { get; set; }
|
||||
|
||||
[BsonElement("Order")]
|
||||
//[BsonElement("Order")]
|
||||
public int Order { get; set; }
|
||||
|
||||
[BsonElement("ConfigurationId")]
|
||||
[BsonRequired]
|
||||
//[BsonElement("ConfigurationId")]
|
||||
//[BsonRequired]
|
||||
[Required]
|
||||
public string ConfigurationId { get; set; } // Parent id
|
||||
|
||||
[BsonElement("ImageId")]
|
||||
[BsonRequired]
|
||||
//[BsonElement("ImageId")]
|
||||
//[BsonRequired]
|
||||
[Required]
|
||||
public string ImageId { get; set; }
|
||||
|
||||
[BsonElement("ImageSource")]
|
||||
[BsonRequired]
|
||||
//[BsonElement("ImageSource")]
|
||||
//[BsonRequired]
|
||||
[Required]
|
||||
public string ImageSource { get; set; }
|
||||
|
||||
[BsonElement("Type")]
|
||||
[BsonRequired]
|
||||
//[BsonElement("Type")]
|
||||
//[BsonRequired]
|
||||
[Required]
|
||||
public SectionType Type { get; set; }
|
||||
|
||||
[BsonElement("IsSubSection")]
|
||||
[BsonRequired]
|
||||
//[BsonElement("IsSubSection")]
|
||||
//[BsonRequired]
|
||||
[Required]
|
||||
public bool IsSubSection { get; set; }
|
||||
|
||||
[BsonElement("ParentId")]
|
||||
//[BsonElement("ParentId")]
|
||||
public string ParentId { get; set; } // only if it's an subsection
|
||||
|
||||
[BsonElement("DateCreation")]
|
||||
//[BsonElement("DateCreation")]
|
||||
public DateTime DateCreation { get; set; }
|
||||
|
||||
[BsonElement("Data")]
|
||||
[BsonRequired]
|
||||
//[BsonElement("Data")]
|
||||
//[BsonRequired]
|
||||
[Required]
|
||||
public string Data { get; set; } // Json encapsulated section info
|
||||
|
||||
[BsonElement("InstanceId")]
|
||||
[BsonRequired]
|
||||
//[BsonElement("InstanceId")]
|
||||
//[BsonRequired]
|
||||
[Required]
|
||||
public string InstanceId { get; set; }
|
||||
|
||||
[BsonElement("IsBeacon")]
|
||||
//[BsonElement("IsBeacon")]
|
||||
public bool IsBeacon { get; set; }
|
||||
|
||||
[BsonElement("BeaconId")]
|
||||
//[BsonElement("BeaconId")]
|
||||
public int? BeaconId { get; set; }
|
||||
|
||||
[BsonElement("Latitude")]
|
||||
//[BsonElement("Latitude")]
|
||||
public string Latitude { get; set; }
|
||||
|
||||
[BsonElement("Longitude")]
|
||||
//[BsonElement("Longitude")]
|
||||
public string Longitude { get; set; }
|
||||
|
||||
[BsonElement("MeterZoneGPS")]
|
||||
//[BsonElement("MeterZoneGPS")]
|
||||
public int? MeterZoneGPS { get; set; }
|
||||
|
||||
public SectionDTO ToDTO()
|
||||
@ -86,8 +99,8 @@ namespace Manager.Interfaces.Models
|
||||
{
|
||||
id = Id,
|
||||
label = Label,
|
||||
title = Title.OrderBy(t => t.language).ToList(),
|
||||
description = Description.OrderBy(d => d.language).ToList(),
|
||||
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
|
||||
description = Description.OrderBy(d => d.Language).Select(l => l.ToDTO()).ToList(),
|
||||
order = Order,
|
||||
type = Type,
|
||||
imageId = ImageId,
|
||||
46
ManagerService/Data/Translation.cs
Normal file
46
ManagerService/Data/Translation.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using ManagerService.DTOs;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ManagerService.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Translation
|
||||
/// </summary>
|
||||
public class Translation
|
||||
{
|
||||
[Key]
|
||||
[Required]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Language { get; set; }
|
||||
|
||||
public string Value { get; set; }
|
||||
|
||||
|
||||
public TranslationDTO ToDTO()
|
||||
{
|
||||
return new TranslationDTO()
|
||||
{
|
||||
language = Language,
|
||||
value = Value
|
||||
};
|
||||
}
|
||||
|
||||
public Translation FromDTO(TranslationDTO translationDTO)
|
||||
{
|
||||
return new Translation()
|
||||
{
|
||||
Language = translationDTO.language,
|
||||
Value = translationDTO.value
|
||||
};
|
||||
}
|
||||
|
||||
public enum TranslationType
|
||||
{
|
||||
Title,
|
||||
Description
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,45 +1,50 @@
|
||||
using Manager.Interfaces.DTO;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using ManagerService.DTOs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Manager.Interfaces.Models
|
||||
namespace ManagerService.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// User Information
|
||||
/// </summary>
|
||||
public class User
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
|
||||
[Key]
|
||||
[Required]
|
||||
/*[BsonId]
|
||||
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]*/
|
||||
public string Id { get; set; }
|
||||
|
||||
[BsonElement("Email")]
|
||||
[BsonRequired]
|
||||
//[BsonElement("Email")]
|
||||
//[BsonRequired]
|
||||
[Required]
|
||||
public string Email { get; set; } // UNIQUE !..
|
||||
|
||||
[BsonElement("Password")]
|
||||
[BsonRequired]
|
||||
//[BsonElement("Password")]
|
||||
//[BsonRequired]
|
||||
[Required]
|
||||
public string Password { get; set; }
|
||||
|
||||
[BsonElement("FirstName")]
|
||||
[BsonRequired]
|
||||
//[BsonElement("FirstName")]
|
||||
//[BsonRequired]
|
||||
public string FirstName { get; set; }
|
||||
|
||||
[BsonElement("LastName")]
|
||||
[BsonRequired]
|
||||
//[BsonElement("LastName")]
|
||||
//[BsonRequired]
|
||||
[Required]
|
||||
public string LastName { get; set; }
|
||||
|
||||
[BsonElement("Token")]
|
||||
[BsonRequired]
|
||||
//[BsonElement("Token")]
|
||||
//[BsonRequired]
|
||||
[Required]
|
||||
public string Token { get; set; }
|
||||
|
||||
[BsonElement("DateCreation")]
|
||||
//[BsonElement("DateCreation")]
|
||||
public DateTime DateCreation { get; set; }
|
||||
|
||||
[BsonElement("InstanceId")]
|
||||
[BsonRequired]
|
||||
/*[BsonElement("InstanceId")]
|
||||
[BsonRequired]*/
|
||||
[Required]
|
||||
public string InstanceId { get; set; }
|
||||
|
||||
public UserDetailDTO ToDTO()
|
||||
25
ManagerService/Deployment/.dockerignore
Normal file
25
ManagerService/Deployment/.dockerignore
Normal file
@ -0,0 +1,25 @@
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/azds.yaml
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
12
ManagerService/Deployment/.env
Normal file
12
ManagerService/Deployment/.env
Normal file
@ -0,0 +1,12 @@
|
||||
##
|
||||
# Copy and rename this file to ".env"
|
||||
##
|
||||
|
||||
# PostgreSQL
|
||||
POSTGRES_USER=mym
|
||||
POSTGRES_PASSWORD=mym
|
||||
POSTGRES_DATABASE=my_info_mate
|
||||
|
||||
# pgAdmin
|
||||
PGADMIN_EMAIL=local@mym.be
|
||||
PGADMIN_PASSWORD=mym
|
||||
12
ManagerService/Deployment/.env.docker-compose.example
Normal file
12
ManagerService/Deployment/.env.docker-compose.example
Normal file
@ -0,0 +1,12 @@
|
||||
##
|
||||
# Copy and rename this file to ".env"
|
||||
##
|
||||
|
||||
# PostgreSQL
|
||||
POSTGRES_USER=mym
|
||||
POSTGRES_PASSWORD=mym
|
||||
POSTGRES_DATABASE=my_info_mate
|
||||
|
||||
# pgAdmin
|
||||
PGADMIN_EMAIL=local@mym.be
|
||||
PGADMIN_PASSWORD=mym
|
||||
60
ManagerService/Deployment/docker-compose.dev.yaml
Normal file
60
ManagerService/Deployment/docker-compose.dev.yaml
Normal file
@ -0,0 +1,60 @@
|
||||
---
|
||||
version: '3.9'
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16
|
||||
container_name: myim_postgres
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
POSTGRES_DB: ${POSTGRES_DATABASE}
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- myim-network
|
||||
|
||||
# Admin Dashboard for PostgresSQL Database
|
||||
pgadmin:
|
||||
image: dpage/pgadmin4
|
||||
container_name: pgadmin
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_EMAIL}
|
||||
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_PASSWORD}
|
||||
ports:
|
||||
- "5050:80"
|
||||
volumes:
|
||||
- pgadmin-data:/var/lib/pgadmin
|
||||
networks:
|
||||
- myim-network
|
||||
depends_on:
|
||||
- postgres
|
||||
|
||||
# myim-api:
|
||||
# image: myim/myim-api
|
||||
# container_name: myim_api
|
||||
# build:
|
||||
# context: ../.
|
||||
# dockerfile: ./Dockerfile
|
||||
# args:
|
||||
# - mode=dev
|
||||
# restart: unless-stopped
|
||||
# ports:
|
||||
# - "5093:80"
|
||||
# networks:
|
||||
# - myim-network
|
||||
# depends_on:
|
||||
# - postgres
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
pgadmin-data:
|
||||
|
||||
networks:
|
||||
myim-network:
|
||||
driver: bridge
|
||||
name: myim-network
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using Manager.Interfaces.Models;
|
||||
using Manager.Services;
|
||||
using ManagerService.Data;
|
||||
using MQTTnet;
|
||||
using MQTTnet.Client;
|
||||
using MQTTnet.Client.Connecting;
|
||||
@ -19,8 +20,9 @@ namespace Mqtt.Client.AspNetCore.Services
|
||||
{
|
||||
private static IMqttClient mqttClient;
|
||||
private IMqttClientOptions options;
|
||||
static DeviceDatabaseService _deviceDatabaseService;
|
||||
static ConfigurationDatabaseService _configurationDatabaseService;
|
||||
/*static DeviceDatabaseService _deviceDatabaseService;
|
||||
static ConfigurationDatabaseService _configurationDatabaseService;*/
|
||||
static MyInfoMateDbContext _myInfoMateDbContext;
|
||||
|
||||
public static string lastTopic;
|
||||
public static long lastTimeTopic;
|
||||
@ -74,13 +76,19 @@ namespace Mqtt.Client.AspNetCore.Services
|
||||
var deviceId = (string)deserialized["deviceId"];
|
||||
var connectedStatus = (bool)deserialized["connected"];
|
||||
|
||||
Device device = _deviceDatabaseService.GetById(deviceId);
|
||||
// TODO
|
||||
|
||||
|
||||
|
||||
Device device = _myInfoMateDbContext.Devices.Find(deviceId); //_deviceDatabaseService.GetById(deviceId);
|
||||
|
||||
if (device != null)
|
||||
{
|
||||
device.Connected = connectedStatus;
|
||||
|
||||
_deviceDatabaseService.Update(device.Id, device);
|
||||
_myInfoMateDbContext.SaveChanges();
|
||||
|
||||
//_deviceDatabaseService.Update(device.Id, device);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -145,10 +153,10 @@ namespace Mqtt.Client.AspNetCore.Services
|
||||
await mqttClient.PublishAsync(mqttMessage);
|
||||
}
|
||||
|
||||
public static void SetServices(DeviceDatabaseService _DeviceDatabaseService, ConfigurationDatabaseService _ConfigurationDatabaseService)
|
||||
public static void SetServices(MyInfoMateDbContext myInfoMateDbContext/*DeviceDatabaseService _DeviceDatabaseService, ConfigurationDatabaseService _ConfigurationDatabaseService*/)
|
||||
{
|
||||
_deviceDatabaseService = _DeviceDatabaseService;
|
||||
_configurationDatabaseService = _ConfigurationDatabaseService;
|
||||
_myInfoMateDbContext = myInfoMateDbContext;
|
||||
//_configurationDatabaseService = _ConfigurationDatabaseService;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,24 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Manager.Interfaces.DTO;
|
||||
using Manager.Interfaces.Models;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MongoDB.Driver;
|
||||
using System.Collections.Generic;
|
||||
using ManagerService.Data;
|
||||
|
||||
namespace Manager.Helpers
|
||||
{
|
||||
public class LanguageInit
|
||||
{
|
||||
public static List<TranslationDTO> Init(string label, List<string> languages, bool toNull = false)
|
||||
public static List<Translation> Init(string label, List<string> languages, bool toNull = false)
|
||||
{
|
||||
List<TranslationDTO> translations = new List<TranslationDTO>();
|
||||
List<Translation> translations = new List<Translation>();
|
||||
|
||||
foreach (var language in languages)
|
||||
{
|
||||
var value = toNull ? null : $"{language} - {label}";
|
||||
translations.Add(new TranslationDTO() { language = language.ToUpper(), value = value });
|
||||
translations.Add(new Translation() { Language = language.ToUpper(), Value = value });
|
||||
}
|
||||
return translations;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Manager.Framework.Helpers
|
||||
namespace ManagerService.Helpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Password utils
|
||||
@ -1,11 +1,7 @@
|
||||
using Manager.Framework.Helpers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Manager.Framework.Business
|
||||
namespace ManagerService.Helpers
|
||||
{
|
||||
public class ProfileLogic
|
||||
{
|
||||
@ -1,26 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<UserSecretsId>d2e1a747-e204-4b43-bf93-abbd19c46417</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.30" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="7.2.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.19.0" />
|
||||
<PackageReference Include="MQTTnet.AspNetCore" Version="3.0.13" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.3" />
|
||||
<PackageReference Include="NSwag.AspNetCore" Version="13.10.8" />
|
||||
<PackageReference Include="Scrypt.NET" Version="1.3.0" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Manager.Framework\Manager.Framework.csproj" />
|
||||
<ProjectReference Include="..\Manager.Interfaces\Manager.Interfaces.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
|
||||
320
ManagerService/Migrations/20250305163047_InitialCreate.Designer.cs
generated
Normal file
320
ManagerService/Migrations/20250305163047_InitialCreate.Designer.cs
generated
Normal file
@ -0,0 +1,320 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ManagerService.Data;
|
||||
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("20250305163047_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <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>("Configuration")
|
||||
.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.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<int?>("PinCode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
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<string>("Data")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("DateCreation")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<List<Translation>>("Description")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
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<List<Translation>>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Sections");
|
||||
});
|
||||
|
||||
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");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
174
ManagerService/Migrations/20250305163047_InitialCreate.cs
Normal file
174
ManagerService/Migrations/20250305163047_InitialCreate.cs
Normal file
@ -0,0 +1,174 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ManagerService.Data;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ManagerService.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Configurations",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "text", nullable: false),
|
||||
Label = table.Column<string>(type: "text", nullable: false),
|
||||
Title = table.Column<List<Translation>>(type: "jsonb", nullable: false),
|
||||
ImageId = table.Column<string>(type: "text", nullable: true),
|
||||
ImageSource = table.Column<string>(type: "text", nullable: true),
|
||||
PrimaryColor = table.Column<string>(type: "text", nullable: true),
|
||||
SecondaryColor = table.Column<string>(type: "text", nullable: true),
|
||||
Languages = table.Column<List<string>>(type: "text[]", nullable: true),
|
||||
DateCreation = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
IsMobile = table.Column<bool>(type: "boolean", nullable: false),
|
||||
IsTablet = table.Column<bool>(type: "boolean", nullable: false),
|
||||
IsOffline = table.Column<bool>(type: "boolean", nullable: false),
|
||||
InstanceId = table.Column<string>(type: "text", nullable: false),
|
||||
LoaderImageId = table.Column<string>(type: "text", nullable: true),
|
||||
LoaderImageUrl = table.Column<string>(type: "text", nullable: true),
|
||||
WeatherCity = table.Column<string>(type: "text", nullable: true),
|
||||
WeatherUpdatedDate = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||
WeatherResult = table.Column<string>(type: "text", nullable: true),
|
||||
IsDate = table.Column<bool>(type: "boolean", nullable: false),
|
||||
IsHour = table.Column<bool>(type: "boolean", nullable: false),
|
||||
IsSectionImageBackground = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RoundedValue = table.Column<int>(type: "integer", nullable: true),
|
||||
ScreenPercentageSectionsMainPage = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Configurations", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Devices",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "text", nullable: false),
|
||||
Identifier = table.Column<string>(type: "text", nullable: true),
|
||||
Name = table.Column<string>(type: "text", nullable: true),
|
||||
IpAddressWLAN = table.Column<string>(type: "text", nullable: false),
|
||||
IpAddressETH = table.Column<string>(type: "text", nullable: false),
|
||||
Configuration = table.Column<string>(type: "text", nullable: true),
|
||||
ConfigurationId = table.Column<string>(type: "text", nullable: false),
|
||||
Connected = table.Column<bool>(type: "boolean", nullable: false),
|
||||
DateCreation = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
DateUpdate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
BatteryLevel = table.Column<string>(type: "text", nullable: true),
|
||||
LastBatteryLevel = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
ConnectionLevel = table.Column<string>(type: "text", nullable: true),
|
||||
LastConnectionLevel = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
InstanceId = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Devices", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Instances",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "text", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
DateCreation = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
PinCode = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Instances", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Resources",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "text", nullable: false),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
Label = table.Column<string>(type: "text", nullable: false),
|
||||
DateCreation = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
InstanceId = table.Column<string>(type: "text", nullable: false),
|
||||
Url = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Resources", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Sections",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "text", nullable: false),
|
||||
Label = table.Column<string>(type: "text", nullable: false),
|
||||
Title = table.Column<List<Translation>>(type: "jsonb", nullable: false),
|
||||
Description = table.Column<List<Translation>>(type: "jsonb", nullable: true),
|
||||
Order = table.Column<int>(type: "integer", nullable: false),
|
||||
ConfigurationId = table.Column<string>(type: "text", nullable: false),
|
||||
ImageId = table.Column<string>(type: "text", nullable: false),
|
||||
ImageSource = table.Column<string>(type: "text", nullable: false),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
IsSubSection = table.Column<bool>(type: "boolean", nullable: false),
|
||||
ParentId = table.Column<string>(type: "text", nullable: true),
|
||||
DateCreation = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Data = table.Column<string>(type: "text", nullable: false),
|
||||
InstanceId = table.Column<string>(type: "text", nullable: false),
|
||||
IsBeacon = table.Column<bool>(type: "boolean", nullable: false),
|
||||
BeaconId = table.Column<int>(type: "integer", nullable: true),
|
||||
Latitude = table.Column<string>(type: "text", nullable: true),
|
||||
Longitude = table.Column<string>(type: "text", nullable: true),
|
||||
MeterZoneGPS = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Sections", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "text", nullable: false),
|
||||
Email = table.Column<string>(type: "text", nullable: false),
|
||||
Password = table.Column<string>(type: "text", nullable: false),
|
||||
FirstName = table.Column<string>(type: "text", nullable: true),
|
||||
LastName = table.Column<string>(type: "text", nullable: false),
|
||||
Token = table.Column<string>(type: "text", nullable: false),
|
||||
DateCreation = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
InstanceId = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Users", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Configurations");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Devices");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Instances");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Resources");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Sections");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users");
|
||||
}
|
||||
}
|
||||
}
|
||||
317
ManagerService/Migrations/MyInfoMateDbContextModelSnapshot.cs
Normal file
317
ManagerService/Migrations/MyInfoMateDbContextModelSnapshot.cs
Normal file
@ -0,0 +1,317 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ManagerService.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ManagerService.Migrations
|
||||
{
|
||||
[DbContext(typeof(MyInfoMateDbContext))]
|
||||
partial class MyInfoMateDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(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>("Configuration")
|
||||
.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.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<int?>("PinCode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
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<string>("Data")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("DateCreation")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<List<Translation>>("Description")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
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<List<Translation>>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Sections");
|
||||
});
|
||||
|
||||
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");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
19
ManagerService/Readme.md
Normal file
19
ManagerService/Readme.md
Normal file
@ -0,0 +1,19 @@
|
||||
# Migrations
|
||||
|
||||
## Invite de commande
|
||||
|
||||
Ouvrir un invite de commande dans le répertoire de la solution
|
||||
|
||||
## Supprimer la dernière migration
|
||||
|
||||
A faire uniquement si elle n'a pas encore été appliquée à la base de données
|
||||
|
||||
>dotnet ef migrations remove
|
||||
|
||||
# Ajouter une migration
|
||||
|
||||
>dotnet ef migrations add <Migration name>
|
||||
|
||||
# Mise à jour de la base de données
|
||||
|
||||
>dotnet ef database update
|
||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Manager.Interfaces.Models;
|
||||
using ManagerService.Data;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MongoDB.Driver;
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Manager.Interfaces.Models;
|
||||
using ManagerService.Data;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MongoDB.Driver;
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Manager.Interfaces.Models;
|
||||
using ManagerService.Data;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MongoDB.Driver;
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Manager.Interfaces.Models;
|
||||
using ManagerService.Data;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MongoDB.Driver;
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Manager.Interfaces.Models;
|
||||
using ManagerService.Data;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MongoDB.Driver;
|
||||
|
||||
|
||||
@ -1,19 +1,17 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Security.Cryptography;
|
||||
using Manager.Interfaces.Models;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Manager.Framework.Business;
|
||||
using Manager.Interfaces.DTO;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using Manager.Services;
|
||||
using ManagerService.Helpers;
|
||||
using ManagerService.DTOs;
|
||||
using ManagerService.Data;
|
||||
|
||||
namespace ManagerService.Service.Services
|
||||
{
|
||||
@ -25,7 +23,8 @@ namespace ManagerService.Service.Services
|
||||
private readonly ILogger<TokensService> _logger;
|
||||
private readonly TokensSettings _tokenSettings;
|
||||
private readonly ProfileLogic _profileLogic;
|
||||
private InstanceDatabaseService _instanceService;
|
||||
/*private InstanceDatabaseService _instanceService;*/
|
||||
private readonly MyInfoMateDbContext _myInfoMateDbContext;
|
||||
|
||||
private readonly SigningCredentials _signingCredentials;
|
||||
|
||||
@ -37,12 +36,12 @@ namespace ManagerService.Service.Services
|
||||
/// <param name="context">Database context</param>
|
||||
/// <param name="profileLogic">Profile logic</param>
|
||||
/// <param name="emailClient">Email client</param>
|
||||
public TokensService(ILogger<TokensService> logger, IOptions<TokensSettings> tokenSettings, ProfileLogic profileLogic, InstanceDatabaseService instanceService)
|
||||
public TokensService(ILogger<TokensService> logger, IOptions<TokensSettings> tokenSettings, ProfileLogic profileLogic, MyInfoMateDbContext myInfoMateDbContext)
|
||||
{
|
||||
_logger = logger;
|
||||
_tokenSettings = tokenSettings.Value;
|
||||
_profileLogic = profileLogic;
|
||||
_instanceService = instanceService;
|
||||
_myInfoMateDbContext = myInfoMateDbContext;
|
||||
|
||||
var key = Encoding.UTF8.GetBytes(_tokenSettings.Secret);
|
||||
_signingCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature);
|
||||
@ -76,7 +75,9 @@ namespace ManagerService.Service.Services
|
||||
};
|
||||
var token = tokenHandler.CreateToken(tokenDescriptor);
|
||||
|
||||
var instance = _instanceService.GetById(user.InstanceId);
|
||||
//var instance = _instanceService.GetById(user.InstanceId);
|
||||
|
||||
var instance = _myInfoMateDbContext.Instances.Find(user.InstanceId);
|
||||
|
||||
return new TokenDTO()
|
||||
{
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Manager.Interfaces.Models;
|
||||
using ManagerService.Data;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MongoDB.Driver;
|
||||
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
using Manager.Framework.Business;
|
||||
using Manager.Framework.Models;
|
||||
using Manager.Helpers;
|
||||
using Manager.Interfaces;
|
||||
using Manager.Interfaces.Models;
|
||||
using Manager.Services;
|
||||
using ManagerService.Data;
|
||||
using ManagerService.Extensions;
|
||||
using ManagerService.Helpers;
|
||||
using ManagerService.Service;
|
||||
using ManagerService.Service.Services;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
@ -14,6 +16,7 @@ using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.AspNetCore.HttpsPolicy;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
@ -138,13 +141,18 @@ namespace ManagerService
|
||||
#endif
|
||||
services.AddScoped(typeof(ProfileLogic));
|
||||
services.AddScoped<TokensService>();
|
||||
services.AddScoped<UserDatabaseService>();
|
||||
/*services.AddScoped<UserDatabaseService>();
|
||||
services.AddScoped<SectionDatabaseService>();
|
||||
services.AddScoped<ConfigurationDatabaseService>();
|
||||
services.AddScoped<ResourceDatabaseService>();
|
||||
services.AddScoped<ResourceDatabaseService>();*/
|
||||
services.AddScoped<LanguageInit>();
|
||||
services.AddScoped<DeviceDatabaseService>();
|
||||
services.AddScoped<InstanceDatabaseService>();
|
||||
/*services.AddScoped<DeviceDatabaseService>();
|
||||
services.AddScoped<InstanceDatabaseService>();*/
|
||||
|
||||
var connectionString = Configuration.GetConnectionString("PostgresConnection");
|
||||
|
||||
services.AddDbContext<MyInfoMateDbContext>(options =>
|
||||
options.UseNpgsql(connectionString));
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
|
||||
@ -1,4 +1,13 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
//"TabletDb": "mongodb://admin:MioTech4ever!@localhost:27017" //DEV
|
||||
//"TabletDb": "mongodb://admin:MioTech4ever!@localhost:27017", //PROD - Thomas
|
||||
//"TabletDb": "mongodb://admin:MioTech4ever!@192.168.31.140:27017" //PROD - Thomas
|
||||
//"TabletDb": "mongodb://admin:mdlf2021!@localhost:27017" //PROD MDLF
|
||||
"TabletDb": "mongodb://admin:MyMuseum2022!@51.77.222.154:27017", //PROD MyMuseum
|
||||
//"TabletDb": "mongodb://admin:MyInfoMate2023!@135.125.232.116:27017" //PROD MyInfoMate
|
||||
"PostgresConnection": "Host=localhost;Database=my_info_mate;Username=mym;Password=mym"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
/*"ConnectionStrings": {
|
||||
//"TabletDb": "mongodb://admin:MioTech4ever!@localhost:27017" //DEV
|
||||
//"TabletDb": "mongodb://admin:MioTech4ever!@localhost:27017", //PROD - Thomas
|
||||
//"TabletDb": "mongodb://admin:MioTech4ever!@192.168.31.140:27017" //PROD - Thomas
|
||||
//"TabletDb": "mongodb://admin:mdlf2021!@localhost:27017" //PROD MDLF
|
||||
//"TabletDb": "mongodb://admin:MyMuseum2022!@51.77.222.154:27017", //PROD MyMuseum
|
||||
"TabletDb": "mongodb://admin:MyInfoMate2023!@135.125.232.116:27017" //PROD MyInfoMate
|
||||
},
|
||||
"TabletDb": "mongodb://admin:MyMuseum2022!@51.77.222.154:27017", //PROD MyMuseum
|
||||
//"TabletDb": "mongodb://admin:MyInfoMate2023!@135.125.232.116:27017" //PROD MyInfoMate
|
||||
"PostgresConnection": "Host=localhost;Database=my_info_mate;Username=mym;Password=mym"
|
||||
},*/
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user