Integration von RemoveIfControllerConvention zur bedingten Ausschließung von Test-Controllern
Implementierung von RemoveIfControllerConvention in der Startup-Klasse, um Controller, die mit "Test" beginnen, basierend auf einem Konfigurationsflag auszuschließen, was die Flexibilität der Dienstregistrierung erhöht.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using DigitalData.Core.API;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
public class TestConfigController : TestControllerBase<TestConfigController, IConfigService, IConfigRepository, ConfigDto, Config, int>
|
||||
{
|
||||
public TestConfigController(ILogger<TestConfigController> logger, IConfigService service) : base(logger, service)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
21
EnvelopeGenerator.Web/Controllers/Test/TestControllerBase.cs
Normal file
21
EnvelopeGenerator.Web/Controllers/Test/TestControllerBase.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using DigitalData.Core.API;
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using DigitalData.Core.Contracts.Infrastructure;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
//[NonController]
|
||||
[ApiController]
|
||||
[Route("api/test/[controller]")]
|
||||
public class TestControllerBase<TOriginalController, TCRUDService, TCRUDRepository, TDto, TEntity, TId> : BasicCRUDControllerBase<TOriginalController, TCRUDService, TCRUDRepository, TDto, TEntity, TId> where TOriginalController : CRUDControllerBase<TOriginalController, TCRUDService, TCRUDRepository, TDto, TDto, TDto, TEntity, TId> where TCRUDService : ICRUDService<TCRUDRepository, TDto, TDto, TDto, TEntity, TId> where TCRUDRepository : ICRUDRepository<TEntity, TId> where TDto : class where TEntity : class
|
||||
{
|
||||
public TestControllerBase(ILogger<TOriginalController> logger, TCRUDService service) : base(logger, service)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using DigitalData.Core.API;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
public class TestDocumentReceiverElementController : TestControllerBase<TestDocumentReceiverElementController, IDocumentReceiverElementService, IDocumentReceiverElementRepository, DocumentReceiverElementDto, DocumentReceiverElement, int>
|
||||
{
|
||||
public TestDocumentReceiverElementController(ILogger<TestDocumentReceiverElementController> logger, IDocumentReceiverElementService service) : base(logger, service)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using DigitalData.Core.API;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
public class TestDocumentStatusController : TestControllerBase<TestDocumentStatusController, IDocumentStatusService, IDocumentStatusRepository, DocumentStatusDto, DocumentStatus, int>
|
||||
{
|
||||
public TestDocumentStatusController(ILogger<TestDocumentStatusController> logger, IDocumentStatusService service) : base(logger, service)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
public class TestEmailTemplateController : TestControllerBase<TestEmailTemplateController, IEmailTemplateService, IEmailTemplateRepository, EmailTemplateDto, EmailTemplate, int>
|
||||
{
|
||||
public TestEmailTemplateController(ILogger<TestEmailTemplateController> logger, IEmailTemplateService service) : base(logger, service)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using DigitalData.Core.API;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
public class TestEnvelopeCertificateController : TestControllerBase<TestEnvelopeCertificateController, IEnvelopeCertificateService, IEnvelopeCertificateRepository, EnvelopeCertificateDto, EnvelopeCertificate, int>
|
||||
{
|
||||
public TestEnvelopeCertificateController(ILogger<TestEnvelopeCertificateController> logger, IEnvelopeCertificateService service) : base(logger, service)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Application.Services;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
public class TestEnvelopeController : TestControllerBase<TestEnvelopeController, IEnvelopeService, IEnvelopeRepository, EnvelopeDto, Envelope, int>
|
||||
{
|
||||
public TestEnvelopeController(ILogger<TestEnvelopeController> logger, IEnvelopeService service) : base(logger, service)
|
||||
{
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public override Task<IActionResult> GetAll()
|
||||
{
|
||||
return base.GetAll();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public virtual async Task<IActionResult> GetAll([FromQuery] string? envelopeKey = default, [FromQuery] bool withDocuments = false, [FromQuery] bool withReceivers = false, [FromQuery] bool withHistory = false, [FromQuery] bool withDocumentReceiverElement = false, [FromQuery] bool withAll = true)
|
||||
{
|
||||
if(envelopeKey is not null)
|
||||
{
|
||||
var decoded = envelopeKey.DecodeEnvelopeReceiverId();
|
||||
|
||||
var envlopeServiceResult = await _service.ReadByUuidAsync(
|
||||
uuid: decoded.EnvelopeUuid,
|
||||
signature: decoded.ReceiverSignature,
|
||||
withDocuments: withDocuments, withReceivers: withReceivers, withHistory: withHistory, withDocumentReceiverElement:withDocumentReceiverElement, withAll:withAll);
|
||||
|
||||
if (envlopeServiceResult.IsSuccess)
|
||||
{
|
||||
return Ok(envlopeServiceResult.Data);
|
||||
}
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var result = await _service.ReadAllWithAsync(documents: withDocuments, receivers: withReceivers, history: withHistory);
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
return Ok(result);
|
||||
}
|
||||
return NotFound(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using DigitalData.Core.API;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
public class TestEnvelopeDocumentController : TestControllerBase<TestEnvelopeDocumentController, IEnvelopeDocumentService, IEnvelopeDocumentRepository, EnvelopeDocumentDto, EnvelopeDocument, int>
|
||||
{
|
||||
public TestEnvelopeDocumentController(ILogger<TestEnvelopeDocumentController> logger, IEnvelopeDocumentService service) : base(logger, service)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using DigitalData.Core.API;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
public class TestEnvelopeHistoryController : TestControllerBase<TestEnvelopeHistoryController, IEnvelopeHistoryService, IEnvelopeHistoryRepository, EnvelopeHistoryDto, EnvelopeHistory, long>
|
||||
{
|
||||
public TestEnvelopeHistoryController(ILogger<TestEnvelopeHistoryController> logger, IEnvelopeHistoryService service) : base(logger, service)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using DigitalData.Core.API;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
public class TestEnvelopeReceiverController : TestControllerBase<TestEnvelopeReceiverController, IEnvelopeReceiverService, IEnvelopeReceiverRepository, EnvelopeReceiverDto, EnvelopeReceiver, int>
|
||||
{
|
||||
public TestEnvelopeReceiverController(ILogger<TestEnvelopeReceiverController> logger, IEnvelopeReceiverService service) : base(logger, service)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using DigitalData.Core.API;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
public class TestEnvelopeTypeController : TestControllerBase<TestEnvelopeTypeController, IEnvelopeTypeService, IEnvelopeTypeRepository, EnvelopeTypeDto, EnvelopeType, int>
|
||||
{
|
||||
public TestEnvelopeTypeController(ILogger<TestEnvelopeTypeController> logger, IEnvelopeTypeService service) : base(logger, service)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using DigitalData.Core.API;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
public class TestReceiverController : TestControllerBase<TestReceiverController, IReceiverService, IReceiverRepository, ReceiverDto, Receiver, int>
|
||||
{
|
||||
public TestReceiverController(ILogger<TestReceiverController> logger, IReceiverService service) : base(logger, service)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using DigitalData.Core.API;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
public class TestUserReceiverController : TestControllerBase<TestUserReceiverController, IUserReceiverService, IUserReceiverRepository, UserReceiverDto, UserReceiver, int>
|
||||
{
|
||||
public TestUserReceiverController(ILogger<TestUserReceiverController> logger, IUserReceiverService service) : base(logger, service)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user