Add instance model, dto, controller and service + update other objects and controllers

This commit is contained in:
Fransolet Thomas 2022-10-06 17:07:11 +02:00
parent 35e2d8296b
commit 3b6c480cc6
26 changed files with 399 additions and 36 deletions

View File

@ -20,5 +20,6 @@ namespace Manager.Interfaces.DTO
public bool isOffline { get; set; } // MyVisit - True if MyVisit is full offline public bool isOffline { get; set; } // MyVisit - True if MyVisit is full offline
/*public string latitude { get; set; } // MyVisit - latitude of visit ? (MyVisit) /*public string latitude { get; set; } // MyVisit - latitude of visit ? (MyVisit)
public string longitude { get; set; } // MyVisit - True if for mobile (MyVisit)*/ public string longitude { get; set; } // MyVisit - True if for mobile (MyVisit)*/
public string instanceId { get; set; }
} }
} }

View File

@ -16,6 +16,7 @@ namespace Manager.Interfaces.DTO
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 class DeviceDetailDTO : DeviceDTO public class DeviceDetailDTO : DeviceDTO

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Manager.Interfaces.DTO
{
public class InstanceDTO
{
public string id { get; set; }
public string name { get; set; }
public DateTime dateCreation { get; set; }
}
}

View File

@ -12,5 +12,6 @@ namespace Manager.Interfaces.DTO
public string label { get; set; } public string label { get; set; }
public DateTime dateCreation { get; set; } public DateTime dateCreation { get; set; }
public string data { get; set; } public string data { get; set; }
public string instanceId { get; set; }
} }
} }

View File

@ -20,5 +20,6 @@ namespace Manager.Interfaces.DTO
public string data { get; set; } // == Include section type info public string data { get; set; } // == Include section type info
public DateTime dateCreation { get; set; } // == Include section type info public DateTime dateCreation { get; set; } // == Include section type info
public int order { get; set; } // Order to show public int order { get; set; } // Order to show
public string instanceId { get; set; }
} }
} }

View File

@ -10,5 +10,6 @@ namespace Manager.Interfaces.DTO
public string token_type { get; set; } public string token_type { get; set; }
public int expires_in { get; set; } public int expires_in { get; set; }
public DateTimeOffset expiration { get; set; } public DateTimeOffset expiration { get; set; }
public string instanceId { get; set; }
} }
} }

View File

@ -50,6 +50,10 @@ namespace Manager.Interfaces.Models
[BsonElement("IsOffline")] [BsonElement("IsOffline")]
public bool IsOffline { get; set; } public bool IsOffline { get; set; }
[BsonElement("InstanceId")]
[BsonRequired]
public string InstanceId { get; set; }
public ConfigurationDTO ToDTO() public ConfigurationDTO ToDTO()
{ {
return new ConfigurationDTO() return new ConfigurationDTO()
@ -65,7 +69,8 @@ namespace Manager.Interfaces.Models
secondaryColor = SecondaryColor, secondaryColor = SecondaryColor,
isMobile = IsMobile, isMobile = IsMobile,
isTablet = IsTablet, isTablet = IsTablet,
isOffline = IsOffline isOffline = IsOffline,
instanceId = InstanceId,
}; };
} }
@ -85,7 +90,8 @@ namespace Manager.Interfaces.Models
isTablet = IsTablet, isTablet = IsTablet,
isOffline = IsOffline, isOffline = IsOffline,
sections = sections, sections = sections,
resources = resources resources = resources,
instanceId = InstanceId,
}; };
} }
} }

View File

@ -60,6 +60,9 @@ namespace Manager.Interfaces.Models
[BsonElement("LastConnectionLevel")] [BsonElement("LastConnectionLevel")]
public DateTime LastConnectionLevel { get; set; } public DateTime LastConnectionLevel { get; set; }
[BsonElement("InstanceId")]
[BsonRequired]
public string InstanceId { get; set; }
public DeviceDTO ToDTO() public DeviceDTO ToDTO()
{ {
@ -74,7 +77,8 @@ namespace Manager.Interfaces.Models
configuration = Configuration, configuration = Configuration,
configurationId = ConfigurationId, configurationId = ConfigurationId,
dateUpdate = DateUpdate, dateUpdate = DateUpdate,
dateCreation = DateCreation dateCreation = DateCreation,
instanceId = InstanceId
}; };
} }
@ -95,7 +99,8 @@ namespace Manager.Interfaces.Models
batteryLevel = BatteryLevel, batteryLevel = BatteryLevel,
lastBatteryLevel = LastBatteryLevel, lastBatteryLevel = LastBatteryLevel,
dateUpdate = DateUpdate, dateUpdate = DateUpdate,
dateCreation = DateCreation dateCreation = DateCreation,
instanceId = InstanceId
}; };
} }
} }

View File

@ -0,0 +1,36 @@
using Manager.Interfaces.DTO;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Text;
namespace Manager.Interfaces.Models
{
/// <summary>
/// Instance Information
/// </summary>
public class Instance
{
[BsonId]
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
public string Id { get; set; }
[BsonElement("Name")]
[BsonRequired]
public string Name { get; set; } // UNIQUE !..
[BsonElement("DateCreation")]
public DateTime DateCreation { get; set; }
public InstanceDTO ToDTO()
{
return new InstanceDTO()
{
id = Id,
name = Name,
dateCreation = DateCreation
};
}
}
}

View File

@ -31,6 +31,10 @@ namespace Manager.Interfaces.Models
[BsonRequired] [BsonRequired]
public string Data { get; set; } public string Data { get; set; }
[BsonElement("InstanceId")]
[BsonRequired]
public string InstanceId { get; set; }
public ResourceDTO ToDTO(bool isExport = false) public ResourceDTO ToDTO(bool isExport = false)
{ {
return new ResourceDTO() return new ResourceDTO()

View File

@ -61,6 +61,10 @@ namespace Manager.Interfaces.Models
[BsonRequired] [BsonRequired]
public string Data { get; set; } // Json encapsulated section info public string Data { get; set; } // Json encapsulated section info
[BsonElement("InstanceId")]
[BsonRequired]
public string InstanceId { get; set; }
public SectionDTO ToDTO() public SectionDTO ToDTO()
{ {
return new SectionDTO() return new SectionDTO()

View File

@ -38,6 +38,10 @@ namespace Manager.Interfaces.Models
[BsonElement("DateCreation")] [BsonElement("DateCreation")]
public DateTime DateCreation { get; set; } public DateTime DateCreation { get; set; }
[BsonElement("InstanceId")]
[BsonRequired]
public string InstanceId { get; set; }
public UserDetailDTO ToDTO() public UserDetailDTO ToDTO()
{ {
return new UserDetailDTO() return new UserDetailDTO()

View File

@ -42,15 +42,16 @@ namespace ManagerService.Controllers
/// <summary> /// <summary>
/// Get a list of all configuration (summary) /// Get a list of all configuration (summary)
/// </summary> /// </summary>
/// <param name="id">id instance</param>
[AllowAnonymous] [AllowAnonymous]
[ProducesResponseType(typeof(List<ConfigurationDTO>), 200)] [ProducesResponseType(typeof(List<ConfigurationDTO>), 200)]
[ProducesResponseType(typeof(string), 500)] [ProducesResponseType(typeof(string), 500)]
[HttpGet] [HttpGet]
public ObjectResult Get() public ObjectResult Get([FromQuery] string instanceId)
{ {
try try
{ {
List<Configuration> configurations = _configurationService.GetAll(); List<Configuration> configurations = _configurationService.GetAll(instanceId);
return new OkObjectResult(configurations.Select(r => r.ToDTO())); return new OkObjectResult(configurations.Select(r => r.ToDTO()));
} }

View File

@ -37,14 +37,15 @@ namespace ManagerService.Controllers
/// <summary> /// <summary>
/// Get a list of all devices /// Get a list of all devices
/// </summary> /// </summary>
/// <param name="id">id instance</param>
[ProducesResponseType(typeof(List<DeviceDTO>), 200)] [ProducesResponseType(typeof(List<DeviceDTO>), 200)]
[ProducesResponseType(typeof(string), 500)] [ProducesResponseType(typeof(string), 500)]
[HttpGet] [HttpGet]
public ObjectResult Get() public ObjectResult Get([FromQuery] string instanceId)
{ {
try try
{ {
List<Device> devices = _deviceService.GetAll(); List<Device> devices = _deviceService.GetAll(instanceId);
return new OkObjectResult(devices.Select(d => d.ToDTO())); return new OkObjectResult(devices.Select(d => d.ToDTO()));
} }

View File

@ -0,0 +1,216 @@
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 Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using NSwag.Annotations;
namespace ManagerService.Controllers
{
[Authorize] // TODO Add ROLES (Roles = "Admin")
[ApiController, Route("api/[controller]")]
[OpenApiTag("Instance", Description = "Instance management")]
public class InstanceController : ControllerBase
{
private InstanceDatabaseService _instanceService;
private UserDatabaseService _userService;
private readonly ILogger<InstanceController> _logger;
private readonly ProfileLogic _profileLogic;
public InstanceController(ILogger<InstanceController> logger, InstanceDatabaseService instanceService, UserDatabaseService userService, ProfileLogic profileLogic)
{
_logger = logger;
_instanceService = instanceService;
_userService = userService;
_profileLogic = profileLogic;
}
/// <summary>
/// Get a list of instance
/// </summary>
[ProducesResponseType(typeof(List<Instance>), 200)]
[ProducesResponseType(typeof(string), 500)]
[HttpGet]
public ObjectResult Get()
{
try
{
List<Instance> instances = _instanceService.GetAll();
return new OkObjectResult(instances);
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}
/// <summary>
/// Get a specific instance
/// </summary>
/// <param name="id">id instance</param>
[ProducesResponseType(typeof(InstanceDTO), 200)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpGet("{id}")]
public ObjectResult GetDetail(string id)
{
try
{
Instance instance = _instanceService.GetById(id);
if (instance == null)
throw new KeyNotFoundException("This instance was not found");
return new OkObjectResult(instance.ToDTO());
}
catch (KeyNotFoundException ex)
{
return new NotFoundObjectResult(ex.Message) {};
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}
/// <summary>
/// Create an instance
/// </summary>
/// <param name="newInstance">New instance info</param>
//[AllowAnonymous]
[ProducesResponseType(typeof(InstanceDTO), 200)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 409)]
[ProducesResponseType(typeof(string), 500)]
[HttpPost]
public ObjectResult CreateInstance([FromBody] Instance newInstance)
{
try
{
if (newInstance == null)
throw new ArgumentNullException("instance param is null");
newInstance.DateCreation = DateTime.Now;
List<Instance> instances = _instanceService.GetAll();
if (instances.Select(i => i.Name).Contains(newInstance.Name))
throw new InvalidOperationException("This name is already used");
Instance instanceCreated = _instanceService.Create(newInstance);
return new OkObjectResult(instanceCreated.ToDTO());
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) {};
}
catch (InvalidOperationException ex)
{
return new ConflictObjectResult(ex.Message) {};
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}
/// <summary>
/// Update an instance
/// </summary>
/// <param name="updatedinstance">instance to update</param>
[ProducesResponseType(typeof(InstanceDTO), 200)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpPut]
public ObjectResult Updateinstance([FromBody] Instance updatedInstance)
{
try
{
if (updatedInstance == null)
throw new ArgumentNullException("instance param is null");
Instance instance = _instanceService.GetById(updatedInstance.Id);
if (instance == null)
throw new KeyNotFoundException("instance does not exist");
Instance instanceModified = _instanceService.Update(updatedInstance.Id, instance);
return new OkObjectResult(instanceModified.ToDTO());
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) {};
}
catch (KeyNotFoundException ex)
{
return new NotFoundObjectResult(ex.Message) {};
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}
/// <summary>
/// Delete an instance
/// </summary>
/// <param name="id">Id of instance to delete</param>
[ProducesResponseType(typeof(string), 202)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpDelete("{id}")]
public ObjectResult DeleteInstance(string id)
{
try
{
if (id == null)
throw new ArgumentNullException("instance param is null");
Instance instance = _instanceService.GetById(id);
// Delete all user in instance
List<User> users = _userService.GetByInstanceId(instance.Id);
foreach(var user in users)
{
_userService.Remove(user.Id);
}
if (instance == null)
throw new KeyNotFoundException("instance does not exist");
_instanceService.Remove(id);
return new ObjectResult("The instance has been deleted") { StatusCode = 202 };
}
catch (ArgumentNullException ex)
{
return new BadRequestObjectResult(ex.Message) { };
}
catch (KeyNotFoundException ex)
{
return new NotFoundObjectResult(ex.Message) { };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}
}
}

View File

@ -39,14 +39,15 @@ namespace ManagerService.Controllers
/// <summary> /// <summary>
/// Get a list of all resources (summary) /// Get a list of all resources (summary)
/// </summary> /// </summary>
/// <param name="id">id instance</param>
[ProducesResponseType(typeof(List<ResourceDTO>), 200)] [ProducesResponseType(typeof(List<ResourceDTO>), 200)]
[ProducesResponseType(typeof(string), 500)] [ProducesResponseType(typeof(string), 500)]
[HttpGet] [HttpGet]
public ObjectResult Get() public ObjectResult Get([FromQuery] string instanceId)
{ {
try try
{ {
List<Resource> resources = _resourceService.GetAll(); List<Resource> resources = _resourceService.GetAll(instanceId);
return new OkObjectResult(resources.Select(r => r.ToDTO(r.Type == ResourceType.ImageUrl))); return new OkObjectResult(resources.Select(r => r.ToDTO(r.Type == ResourceType.ImageUrl)));
} }
@ -135,15 +136,12 @@ namespace ManagerService.Controllers
[ProducesResponseType(typeof(string), 404)] [ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)] [ProducesResponseType(typeof(string), 500)]
[HttpPost("upload"), DisableRequestSizeLimit] [HttpPost("upload"), DisableRequestSizeLimit]
public IActionResult Upload([FromForm] string label, [FromForm] string type) // Create but with local //[FromBody] ResourceDetailDTO uploadResource public IActionResult Upload([FromForm] string label, [FromForm] string type, [FromForm] string instanceId) // Create but with local //[FromBody] ResourceDetailDTO uploadResource
{ {
try try
{ {
if (label == null || type == null) if (label == null || type == null || instanceId == null)
throw new ArgumentNullException("One of resource params is null"); throw new ArgumentNullException("One of resource params is null");
ResourceDTO uploadResource = new ResourceDTO();
uploadResource.type = (ResourceType) Enum.Parse(typeof(ResourceType), type);
uploadResource.label = label;
List<Resource> resources = new List<Resource>(); List<Resource> resources = new List<Resource>();
@ -163,10 +161,11 @@ namespace ManagerService.Controllers
} }
// Todo add some verification ? // Todo add some verification ?
Resource resource = new Resource(); Resource resource = new Resource();
resource.Label = uploadResource.label; resource.Label = label;
resource.Type = uploadResource.type; resource.Type = (ResourceType)Enum.Parse(typeof(ResourceType), type);
resource.DateCreation = DateTime.Now; resource.DateCreation = DateTime.Now;
resource.Data = stringResult; resource.Data = stringResult;
resource.InstanceId = instanceId;
Resource resourceCreated = _resourceService.Create(resource); Resource resourceCreated = _resourceService.Create(resource);
resources.Add(resourceCreated); resources.Add(resourceCreated);
} }
@ -209,6 +208,7 @@ namespace ManagerService.Controllers
resource.Type = newResource.type; resource.Type = newResource.type;
resource.DateCreation = DateTime.Now; resource.DateCreation = DateTime.Now;
resource.Data = newResource.data; resource.Data = newResource.data;
resource.InstanceId = newResource.instanceId;
Resource resourceCreated = _resourceService.Create(resource); Resource resourceCreated = _resourceService.Create(resource);
@ -290,12 +290,13 @@ namespace ManagerService.Controllers
if (id == null) if (id == null)
throw new ArgumentNullException("Resource param is null"); throw new ArgumentNullException("Resource param is null");
if (!_resourceService.IsExist(id)) var ressource = _resourceService.GetById(id);
if (ressource == null)
throw new KeyNotFoundException("Resource does not exist"); throw new KeyNotFoundException("Resource does not exist");
// Delete all resource occurence // Delete all resource occurence
foreach (var section in _sectionService.GetAll()) foreach (var section in _sectionService.GetAll(ressource.InstanceId))
{ {
if (section.ImageId == id) if (section.ImageId == id)
{ {

View File

@ -35,14 +35,15 @@ namespace ManagerService.Controllers
/// <summary> /// <summary>
/// Get a list of all section (summary) /// Get a list of all section (summary)
/// </summary> /// </summary>
/// <param name="id">id instance</param>
[ProducesResponseType(typeof(List<SectionDTO>), 200)] [ProducesResponseType(typeof(List<SectionDTO>), 200)]
[ProducesResponseType(typeof(string), 500)] [ProducesResponseType(typeof(string), 500)]
[HttpGet] [HttpGet]
public ObjectResult Get() public ObjectResult Get([FromQuery] string instanceId)
{ {
try try
{ {
List<Section> sections = _sectionService.GetAll(); List<Section> sections = _sectionService.GetAll(instanceId);
return new OkObjectResult(sections.Select(r => r.ToDTO())); return new OkObjectResult(sections.Select(r => r.ToDTO()));
} }

View File

@ -18,9 +18,9 @@ namespace Manager.Services
var database = client.GetDatabase("TabletDb"); var database = client.GetDatabase("TabletDb");
_Configurations = database.GetCollection<Configuration>("Configurations"); _Configurations = database.GetCollection<Configuration>("Configurations");
} }
public List<Configuration> GetAll() public List<Configuration> GetAll(string instanceId)
{ {
return _Configurations.Find(d => true).ToList(); return _Configurations.Find(d => d.InstanceId == instanceId).ToList();
} }
public Configuration GetById(string id) public Configuration GetById(string id)

View File

@ -19,9 +19,9 @@ namespace Manager.Services
_Devices = database.GetCollection<Device>("Devices"); _Devices = database.GetCollection<Device>("Devices");
} }
public List<Device> GetAll() public List<Device> GetAll(string instanceId)
{ {
return _Devices.Find(d => true).ToList(); return _Devices.Find(d => d.InstanceId == instanceId).ToList();
} }
public List<Device> GetAllConnected() public List<Device> GetAllConnected()

View File

@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Manager.Interfaces.Models;
using Microsoft.Extensions.Configuration;
using MongoDB.Driver;
namespace Manager.Services
{
public class InstanceDatabaseService
{
private readonly IMongoCollection<Instance> _Instances;
public InstanceDatabaseService(IConfiguration config)
{
var client = new MongoClient(config.GetConnectionString("TabletDb"));
var database = client.GetDatabase("TabletDb");
_Instances = database.GetCollection<Instance>("Instances");
}
public List<Instance> GetAll()
{
return _Instances.Find(m => true).ToList();
}
public Instance GetByName(string name)
{
return _Instances.Find<Instance>(i => i.Name == name).FirstOrDefault();
}
public Instance GetById(string id)
{
return _Instances.Find<Instance>(i => i.Id == id).FirstOrDefault();
}
public bool IsExist(string id)
{
return _Instances.Find<Instance>(i => i.Id == id).FirstOrDefault() != null ? true : false;
}
public Instance Create(Instance instance)
{
_Instances.InsertOne(instance);
return instance;
}
public Instance Update(string id, Instance instanceIn)
{
_Instances.ReplaceOne(instance => instance.Id == id, instanceIn);
return instanceIn;
}
public void Remove(string id)
{
_Instances.DeleteOne(instance => instance.Id == id);
}
}
}

View File

@ -18,9 +18,9 @@ namespace Manager.Services
var database = client.GetDatabase("TabletDb"); var database = client.GetDatabase("TabletDb");
_Resources = database.GetCollection<Resource>("Resources"); _Resources = database.GetCollection<Resource>("Resources");
} }
public List<Resource> GetAll() public List<Resource> GetAll(string instanceId)
{ {
return _Resources.Find(r => true).ToList(); return _Resources.Find(r => r.InstanceId == instanceId).ToList();
} }
public Resource GetByType(ResourceType type) public Resource GetByType(ResourceType type)

View File

@ -19,9 +19,9 @@ namespace Manager.Services
_Sections = database.GetCollection<Section>("Sections"); _Sections = database.GetCollection<Section>("Sections");
} }
public List<Section> GetAll() public List<Section> GetAll(string instanceId)
{ {
return _Sections.Find(s => !s.IsSubSection).ToList(); return _Sections.Find(s => !s.IsSubSection && s.InstanceId == instanceId).ToList();
} }
public List<Section> GetAllFromConfiguration(string configurationId) public List<Section> GetAllFromConfiguration(string configurationId)

View File

@ -79,7 +79,8 @@ namespace ManagerService.Service.Services
expires_in = _tokenSettings.AccessTokenExpiration * 60, expires_in = _tokenSettings.AccessTokenExpiration * 60,
expiration = new DateTimeOffset(token.ValidTo), expiration = new DateTimeOffset(token.ValidTo),
token_type = "Bearer", token_type = "Bearer",
scope = Security.Scope scope = Security.Scope,
instanceId = user.InstanceId
}; };
} }
catch (UnauthorizedAccessException ex) catch (UnauthorizedAccessException ex)

View File

@ -20,22 +20,27 @@ namespace Manager.Services
} }
public List<User> GetAll() public List<User> GetAll()
{ {
return _Users.Find(m => true).ToList(); return _Users.Find(u => true).ToList();
} }
public User GetByEmail(string email) public User GetByEmail(string email)
{ {
return _Users.Find<User>(m => m.Email == email).FirstOrDefault(); return _Users.Find<User>(u => u.Email == email).FirstOrDefault();
} }
public User GetById(string id) public User GetById(string id)
{ {
return _Users.Find<User>(m => m.Id == id).FirstOrDefault(); return _Users.Find<User>(u => u.Id == id).FirstOrDefault();
}
public List<User> GetByInstanceId(string id)
{
return _Users.Find<User>(u => u.InstanceId == id).ToList();
} }
public bool IsExist(string id) public bool IsExist(string id)
{ {
return _Users.Find<User>(d => d.Id == id).FirstOrDefault() != null ? true : false; return _Users.Find<User>(u => u.Id == id).FirstOrDefault() != null ? true : false;
} }
public User Create(User user) public User Create(User user)

View File

@ -141,6 +141,7 @@ namespace ManagerService
services.AddScoped<ResourceDatabaseService>(); services.AddScoped<ResourceDatabaseService>();
services.AddScoped<LanguageInit>(); services.AddScoped<LanguageInit>();
services.AddScoped<DeviceDatabaseService>(); services.AddScoped<DeviceDatabaseService>();
services.AddScoped<InstanceDatabaseService>();
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

View File

@ -2,9 +2,9 @@
"ConnectionStrings": { "ConnectionStrings": {
//"TabletDb": "mongodb://admin:MioTech4ever!@localhost:27017" //DEV //"TabletDb": "mongodb://admin:MioTech4ever!@localhost:27017" //DEV
//"TabletDb": "mongodb://admin:MioTech4ever!@localhost:27017", //PROD - Thomas //"TabletDb": "mongodb://admin:MioTech4ever!@localhost:27017", //PROD - Thomas
//"TabletDb": "mongodb://admin:MioTech4ever!@192.168.31.140: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:mdlf2021!@localhost:27017" //PROD MDLF
"TabletDb": "mongodb://admin:MyMuseum2022!@51.77.222.154:27017" //PROD MyMuseum //"TabletDb": "mongodb://admin:MyMuseum2022!@51.77.222.154:27017" //PROD MyMuseum
}, },
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {