fix login

add logging
add scripts for server
This commit is contained in:
Alex Bezdieniezhnykh
2024-12-04 12:40:56 +02:00
parent 0914c8c39e
commit 6d8ea6c74f
9 changed files with 43 additions and 18 deletions
+3 -1
View File
@@ -4,6 +4,7 @@ using Azaion.Common.Database;
using Azaion.Common.Entities;
using LinqToDB;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace Azaion.Services;
@@ -14,7 +15,7 @@ public interface IResourcesService
Task SaveResource(IFormFile data, CancellationToken cancellationToken = default);
}
public class ResourcesService(IOptions<ResourcesConfig> resourcesConfig) : IResourcesService
public class ResourcesService(IOptions<ResourcesConfig> resourcesConfig, ILogger<ResourcesService> logger) : IResourcesService
{
public async Task<Stream> GetEncryptedResource(string fileName, string key, CancellationToken cancellationToken = default)
{
@@ -37,5 +38,6 @@ public class ResourcesService(IOptions<ResourcesConfig> resourcesConfig) : IReso
var resourcePath = Path.Combine(resourcesConfig.Value.ResourcesFolder, data.FileName);
await using var fileStream = new FileStream(resourcePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
await data.CopyToAsync(fileStream, cancellationToken);
logger.LogInformation($"Resource {data.FileName} Saved Successfully");
}
}