Skip to content

Commit

Permalink
Merge pull request #74 from buildersoftdev/v2.1/feature/73
Browse files Browse the repository at this point in the history
v2.1/feature/73 TenantUpdatedDetails
  • Loading branch information
eneshoxha authored Feb 7, 2022
2 parents b9357fe + b8ca3eb commit f4ce4ef
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ private void XNodeEventService_TenantCreated(Model.Events.Tenants.TenantCreatedA

private void XNodeEventService_TenantUpdated(Model.Events.Tenants.TenantUpdatedArgs obj)
{
// SKIPED for next release v2.1
tenantIOService.TryUpdateTenantDirectory(obj.Name, new Model.App.Tenants.Tenant() { Id = obj.Id, Name = obj.Name, Settings = obj.Settings });
logger.LogInformation($"Tenant '{obj.Name}' settings updated");
}

private void XNodeEventService_ProductCreated(Model.Events.Products.ProductCreatedArgs obj)
Expand Down
7 changes: 7 additions & 0 deletions src/Storage.IO/Readers/TenantReader.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Buildersoft.Andy.X.Storage.IO.Locations;
using Buildersoft.Andy.X.Storage.Model.App.Consumers;
using Buildersoft.Andy.X.Storage.Model.App.Tenants;
using Buildersoft.Andy.X.Storage.Model.App.Topics;
using Buildersoft.Andy.X.Storage.Utility.Extensions.Json;
using System.Collections.Generic;
Expand All @@ -9,6 +10,12 @@ namespace Buildersoft.Andy.X.Storage.IO.Readers
{
public static class TenantReader
{
public static Tenant ReadTenantConfigFile(string tenantName)
{
return File
.ReadAllText(TenantLocations.GetTenantConfigFile(tenantName))
.JsonToObjectAndDecrypt<Tenant>();
}
public static Topic ReadTopicConfigFile(string tenant, string product, string component, string topic)
{
return File
Expand Down
12 changes: 9 additions & 3 deletions src/Storage.IO/Services/TenantIOService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Threading;
using System.Threading.Tasks;

namespace Buildersoft.Andy.X.Storage.IO.Services
{
Expand All @@ -36,15 +36,15 @@ private void InitializeTenantConfigFileProcessor()
if (IsTenantConfigFilesWorking != true)
{
IsTenantConfigFilesWorking = true;
new Thread(() => TenantConfigiFileProcessor()).Start();
new Task(() => TenantConfigiFileProcessor()).Start();
}
}
private void InitializeTenantLoggingProcessor()
{
if (IsTenantLoggingWorking != true)
{
IsTenantLoggingWorking = true;
new Thread(() => TenantLoggingProcessor()).Start();
new Task(() => TenantLoggingProcessor()).Start();
}
}

Expand Down Expand Up @@ -111,6 +111,12 @@ public bool TryCreateTenantDirectory(string tenantName, Tenant tenantDetails)
}
}

public bool TryUpdateTenantDirectory(string tenantName, Tenant tenantDetails)
{
Tenant TenantIOReader
return true;
}

public bool TryCreateProductDirectory(string tenant, Product product)
{
try
Expand Down
12 changes: 10 additions & 2 deletions src/Storage.Model/Events/Tenants/TenantUpdatedArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ namespace Buildersoft.Andy.X.Storage.Model.Events.Tenants
{
public class TenantUpdatedArgs
{
public Guid TenantId { get; set; }
public string TenantName { get; set; }
public Guid Id { get; set; }
public string Name { get; set; }
public string DigitalSignature { get; set; }

public TenantSettings Settings { get; set; }

public TenantUpdatedArgs()
{
Settings = new TenantSettings();
}
}
}

0 comments on commit f4ce4ef

Please sign in to comment.