diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Controllers/Features/Categories/CategoriesController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Controllers/Features/Categories/CategoriesController.cs index 55cf3ac..7ce3aac 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Controllers/Features/Categories/CategoriesController.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Controllers/Features/Categories/CategoriesController.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using O2NextGen.CertificateManagement.Application.Controllers.ViewModels; +using O2NextGen.CertificateManagement.Application.Services.Interfaces; using O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.CreateCategory; using O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.DeleteCategory; using O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategories; @@ -20,18 +21,21 @@ public class CategoriesController : ControllerBase { #region Ctors - public CategoriesController(IMediator mediator, ILogger logger) + public CategoriesController(IMediator mediator, ILogger logger, ISubscribeService subscribeService) { _mediator = mediator ?? throw new ArgumentNullException(nameof(mediator)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); + _subscribeService = subscribeService ?? throw new ArgumentNullException(nameof(subscribeService));; } #endregion + #region Fields private readonly IMediator _mediator; private readonly ILogger _logger; + private readonly ISubscribeService _subscribeService; private static readonly string GetByIdActionName = nameof(GetByIdAsync).Replace("Async", string.Empty); @@ -77,6 +81,8 @@ public async Task> AddAsync( [FromBody] CategoryViewModel viewModel, CancellationToken ct) { + var productId = _subscribeService.GetProductId(); + var tenantId = _subscribeService.GetTenantInfo(); var result = await _mediator.Send( new CreateCategoryCommand( viewModel.CategoryName, diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/CustomExtensionsMethods.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/CustomExtensionsMethods.cs index 85c89e9..45cc980 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/CustomExtensionsMethods.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/CustomExtensionsMethods.cs @@ -1,4 +1,5 @@ using O2NextGen.CertificateManagement.Application.Services; +using O2NextGen.CertificateManagement.Application.Services.Interfaces; namespace O2NextGen.CertificateManagement.Application; @@ -15,7 +16,7 @@ public static IServiceCollection AddCustomIntegrations(this IServiceCollection s services.AddHttpClient(); - //services.AddHttpClient(); + services.AddHttpClient(); return services; } } \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/Interfaces/ISubscribeService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/Interfaces/ISubscribeService.cs new file mode 100644 index 0000000..e9bc1ac --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/Interfaces/ISubscribeService.cs @@ -0,0 +1,8 @@ +namespace O2NextGen.CertificateManagement.Application.Services.Interfaces; + +public interface ISubscribeService +{ + Guid GetTenantInfo(); + + Guid GetProductId(); +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/SubscribeService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/SubscribeService.cs new file mode 100644 index 0000000..684a454 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/SubscribeService.cs @@ -0,0 +1,28 @@ +using Microsoft.Extensions.Options; +using O2NextGen.CertificateManagement.Application.Services.Interfaces; + +namespace O2NextGen.CertificateManagement.Application.Services; + +public class SubscribeService : ISubscribeService +{ + private readonly Guid _fakeTenantId = Guid.Parse("A9D99999-CF70-4EEF-8340-BCBAA4B60C4A"); + private readonly Guid _fakeProductId = Guid.Parse("A1D11999-CF99-4EEF-8340-BCBAA4B60C4A"); + private readonly IOptions _config; + private readonly HttpClient _httpClient; + + public SubscribeService(HttpClient httpClient, IOptions config) + { + _httpClient = httpClient; + _config = config; + } + + public Guid GetTenantInfo() + { + return _fakeTenantId; + } + + public Guid GetProductId() + { + return _fakeProductId; + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommandHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryHandler.cs similarity index 86% rename from src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommandHandler.cs rename to src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryHandler.cs index 138e272..5af2218 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommandHandler.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryHandler.cs @@ -4,11 +4,11 @@ namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.CreateCategory; -public class CreateCategoryCommandHandler : IRequestHandler +public class CreateCategoryHandler : IRequestHandler { private readonly IRepository categoryRepository; - public CreateCategoryCommandHandler(IRepository categoryRepository) + public CreateCategoryHandler(IRepository categoryRepository) { this.categoryRepository = categoryRepository; } @@ -28,7 +28,7 @@ public async Task Handle(CreateCategoryCommand requ IsDeleted = request.IsDeleted, TimeLifeInDays = request.TimeLifeInDays, QuantityCertificates = request.QuantityCertificates, - QuantityPublishCode = request.QuantityPublishCode + QuantityPublishCode = request.QuantityPublishCode, }; var addedCertificate = await categoryRepository.AddAsync(category, cancellationToken);