Admin ItemDeleter, Logging
This commit is contained in:
@@ -7,4 +7,5 @@ public interface IRemoteConnection
|
||||
Task Exit();
|
||||
Task CreateContainerAsync(string contentProviderId, FullName fullName);
|
||||
Task CreateElementAsync(string contentProviderId, FullName fullName);
|
||||
Task DeleteItemAsync(string contentProviderId, FullName fullName);
|
||||
}
|
||||
@@ -5,4 +5,5 @@ public interface ISignalRHub
|
||||
Task Exit();
|
||||
Task CreateContainerAsync(string contentProviderId, string fullName);
|
||||
Task CreateElementAsync(string contentProviderId, string fullName);
|
||||
Task DeleteItemAsync(string contentProviderId, string fullName);
|
||||
}
|
||||
@@ -39,4 +39,10 @@ public class SignalRConnection : IRemoteConnection, IAsyncInitable<string>
|
||||
var client = CreateClient();
|
||||
await client.CreateElementAsync(contentProviderId, fullName.Path);
|
||||
}
|
||||
|
||||
public async Task DeleteItemAsync(string contentProviderId, FullName fullName)
|
||||
{
|
||||
var client = CreateClient();
|
||||
await client.DeleteItemAsync(contentProviderId, fullName.Path);
|
||||
}
|
||||
}
|
||||
@@ -42,4 +42,11 @@ public class ConnectionHub : Hub<ISignalRClient>, ISignalRHub
|
||||
var itemCreator = _contentAccessorFactory.GetItemCreator(contentProvider);
|
||||
await itemCreator.CreateElementAsync(contentProvider, new FullName(fullName));
|
||||
}
|
||||
|
||||
public async Task DeleteItemAsync(string contentProviderId, string fullName)
|
||||
{
|
||||
var contentProvider = _contentProviderRegistry.ContentProviders.First(p => p.Name == contentProviderId);
|
||||
var itemDeleter = _contentAccessorFactory.GetItemDeleter(contentProvider);
|
||||
await itemDeleter.DeleteAsync(contentProvider, new FullName(fullName));
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using FileTime.Providers.Local;
|
||||
using FileTime.Server.App;
|
||||
using FileTime.Server.Common;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Serilog;
|
||||
|
||||
@@ -52,7 +53,8 @@ IContainer CreateRootDiContainer(IConfigurationRoot configuration)
|
||||
var serviceCollection = DependencyInjection
|
||||
.RegisterDefaultServices(configuration)
|
||||
.AddLocalProviderServices()
|
||||
.AddServerServices();
|
||||
.AddServerServices()
|
||||
.AddLogging(loggingBuilder => loggingBuilder.AddSerilog());
|
||||
|
||||
serviceCollection.TryAddSingleton<IApplicationStopper>(
|
||||
new ApplicationStopper(() => applicationCancellation.Cancel())
|
||||
|
||||
Reference in New Issue
Block a user