Erste checks

This commit is contained in:
Simon Martens
2023-05-11 01:00:26 +02:00
parent 51c7a79667
commit 0ef63bfde4
24 changed files with 400 additions and 25 deletions

View File

@@ -9,6 +9,7 @@ using HaWeb.Filters;
using HaWeb.FileHelpers;
using HaWeb.XMLParser;
using HaWeb.Models;
using HaWeb.XMLTests;
using System.Text.Json.Serialization;
using System.Text.Json;
using HaDocument.Interfaces;
@@ -28,17 +29,19 @@ public class APIController : Controller {
private readonly string _targetFilePath;
private readonly IXMLService _xmlService;
private readonly IXMLProvider _xmlProvider;
private readonly IXMLTestService _testService;
// Options
private static readonly string[] _permittedExtensions = { ".xml" };
private static readonly FormOptions _defaultFormOptions = new FormOptions();
public APIController(IHaDocumentWrappper lib, IReaderService readerService, IXMLService xmlService, IXMLProvider xmlProvider, IConfiguration config) {
public APIController(IHaDocumentWrappper lib, IReaderService readerService, IXMLService xmlService, IXMLProvider xmlProvider, IXMLTestService testService, IConfiguration config) {
_lib = lib;
_xmlProvider = xmlProvider;
_readerService = readerService;
_xmlService = xmlService;
_testService = testService;
_fileSizeLimit = config.GetValue<long>("FileSizeLimit");
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
_targetFilePath = config.GetValue<string>("StoredFilePathWindows");
@@ -154,6 +157,7 @@ public class APIController : Controller {
};
string json = JsonSerializer.Serialize(docs);
_testService.Test();
return Created(nameof(UploadController), json);
}
@@ -260,11 +264,12 @@ public class APIController : Controller {
}
}
_xmlService.UnUse(id);
if (newUsed != null && newUsed.Any()) {
_xmlService.UnUse(id);
newUsed.ForEach(x => _xmlService.Use(x));
}
_testService.Test();
return Created("/", newUsed);
}