diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj
index 3f2a4725..20cc1aa7 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj
@@ -1,74 +1,74 @@
-
- net6.0
- e238f36a-3514-4436-b624-9b4f799bb82d
- Linux
- ..\..\..
- ../docker-compose.dcproj
-
+
+ net6.0
+ e238f36a-3514-4436-b624-9b4f799bb82d
+ Linux
+ ..\..\..
+ ../docker-compose.dcproj
+
-
-
-
-
-
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
- <_ContentIncludedByDefault Remove="Views\Certificates\Create.cshtml" />
- <_ContentIncludedByDefault Remove="Views\Certificates\Detail.cshtml" />
- <_ContentIncludedByDefault Remove="Views\Certificates\Index.cshtml" />
- <_ContentIncludedByDefault Remove="Views\_ViewImports.cshtml" />
-
+
+ <_ContentIncludedByDefault Remove="Views\Certificates\Create.cshtml"/>
+ <_ContentIncludedByDefault Remove="Views\Certificates\Detail.cshtml"/>
+ <_ContentIncludedByDefault Remove="Views\Certificates\Index.cshtml"/>
+ <_ContentIncludedByDefault Remove="Views\_ViewImports.cshtml"/>
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Controllers/VersionController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Controllers/VersionController.cs
index 2b79c796..848adf62 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Controllers/VersionController.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Controllers/VersionController.cs
@@ -1,43 +1,47 @@
+using System.Reflection;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-using System.Reflection;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Logging;
-namespace O2NextGen.CertificateManagement.Application.Controllers
-{
+namespace O2NextGen.CertificateManagement.Application.Controllers;
- [AllowAnonymous]
- public class VersionController : ControllerBase
- {
- #region Fields
+[AllowAnonymous]
+[ApiController]
+[Route("[controller]")]
+public class VersionController : ControllerBase
+{
+ #region Fields
- private readonly IWebHostEnvironment _environment;
- private readonly ILogger _logger;
+ private readonly IWebHostEnvironment _environment;
+ private readonly ILogger _logger;
- #endregion
+ #endregion
- #region Ctors
+ #region Ctors
- public VersionController(IWebHostEnvironment environment, ILogger logger)
- {
- _environment = environment;
- _logger = logger;
- }
+ public VersionController(IWebHostEnvironment environment, ILogger logger)
+ {
+ _environment = environment;
+ _logger = logger;
+ }
- #endregion
+ #endregion
- [HttpGet("[controller]")]
- public object Index()
+ [HttpGet]
+ public object Index()
+ {
+ var exVersion = GetVersion();
+ _logger.LogInformation($"get version - {exVersion}");
+ return new
{
- var exVersion = Assembly.GetExecutingAssembly().GetName().Version;
- _logger.LogInformation($"get version - {exVersion}");
- return new
- {
- Environment = _environment.EnvironmentName,
- Version = exVersion.ToString()
- };
- }
+ Environment = _environment.EnvironmentName,
+ Version = exVersion?.ToString()
+ };
+ }
+
+ protected virtual Version GetVersion()
+ {
+ var exVersion = Assembly.GetExecutingAssembly().GetName().Version;
+ return exVersion ?? throw new InvalidOperationException();
}
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/CustomExtensionsMethods.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/CustomExtensionsMethods.cs
new file mode 100644
index 00000000..a939989f
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/CustomExtensionsMethods.cs
@@ -0,0 +1,19 @@
+using O2NextGen.CertificateManagement.Application.Services;
+
+internal static class CustomExtensionsMethods
+{
+ public static IServiceCollection AddCustomIntegrations(this IServiceCollection services,
+ IConfiguration configuration)
+ {
+ services.AddSingleton();
+ services.AddTransient();
+ services.AddTransient();
+ if (configuration["isTest"] == bool.FalseString.ToLowerInvariant())
+ services.AddHttpClient();
+
+
+ services.AddHttpClient();
+ // services.AddHttpClient();
+ return services;
+ }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Dockerfile b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Dockerfile
index 4d8e2e66..054627ca 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Dockerfile
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Dockerfile
@@ -1,15 +1,16 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
+RUN apt-get update && apt-get install -y libgdiplus
WORKDIR /app
-EXPOSE 80
+EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
-COPY ["O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj", "O2NextGen.CertificateManagement.Application/"]
-COPY ["O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj", "O2NextGen.CertificateManagement.Domain/"]
-COPY ["O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.csproj", "O2NextGen.CertificateManagement.Infrastructure/"]
+COPY ["O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj", "O2NextGen.CertificateManagement.Application/"]
+COPY ["O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj", "O2NextGen.CertificateManagement.Domain/"]
+COPY ["O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.csproj", "O2NextGen.CertificateManagement.Infrastructure/"]
COPY ["O2NextGen.CertificateManagement.StartupTasks/O2NextGen.CertificateManagement.StartupTasks.csproj", "O2NextGen.CertificateManagement.StartupTasks/"]
RUN dotnet restore "O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj"
COPY . .
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CategoriesController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CategoriesController.cs
index 4259dabf..e01b87ba 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CategoriesController.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CategoriesController.cs
@@ -6,111 +6,115 @@
using O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategory;
using O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.UpdateCategory;
-namespace O2NextGen.CertificateManagement.Application.Features.Categories
+namespace O2NextGen.CertificateManagement.Application.Features.Categories;
+
+//[ApiVersion("1.0")]
+[ApiController]
+[ApiVersion("1.0")]
+[ApiVersion("1.1")]
+// ReSharper disable once RouteTemplates.RouteParameterConstraintNotResolved
+[Route("api/v{v:apiVersion}/[controller]")]
+public class CategoriesController : ControllerBase
{
- [Route("api/[controller]")]
- //[ApiVersion("1.0")]
- [ApiController]
- public class CategoriesController : ControllerBase
- {
- #region Fields
+ #region Ctors
- private readonly IMediator _mediator;
- private readonly ILogger _logger;
+ public CategoriesController(IMediator mediator, ILogger logger)
+ {
+ _mediator = mediator ?? throw new ArgumentNullException(nameof(mediator));
+ _logger = logger ?? throw new ArgumentNullException(nameof(logger));
+ }
- private static readonly string GetByIdActionName
- = nameof(GetByIdAsync).Replace("Async", string.Empty);
+ #endregion
- #endregion
+ #region Fields
+ private readonly IMediator _mediator;
+ private readonly ILogger _logger;
- #region Ctors
+ private static readonly string GetByIdActionName
+ = nameof(GetByIdAsync).Replace("Async", string.Empty);
- public CategoriesController(IMediator mediator, ILogger logger)
- {
- _mediator = mediator ?? throw new ArgumentNullException(nameof(mediator));
- _logger = logger ?? throw new ArgumentNullException(nameof(logger));
- }
+ #endregion
- #endregion
+ #region Methods
- #region Methods
+ [MapToApiVersion("1.0")]
+ [HttpGet]
+ [Route("{id}")]
+ public async Task GetByIdAsync(long id, CancellationToken ct)
+ {
+ _logger.LogInformation("Call API method {ByIdAsyncName}: id = {Id}", nameof(GetByIdAsync), id);
- [HttpGet]
- [Route("{id}")]
- public async Task GetByIdAsync(long id, CancellationToken ct)
- {
- _logger.LogInformation("Call API method {ByIdAsyncName}: id = {Id}", nameof(GetByIdAsync), id);
-
- var result = await _mediator.Send(new GetCategoryQuery(id), ct);
-
- if (result is null)
- {
- _logger.LogError("GetByIdAsync: not found id = {Id}", id);
- return NotFound();
- }
-
- _logger.LogInformation("GetByIdAsync: OK");
- return Ok(result);
- }
+ var result = await _mediator.Send(new GetCategoryQuery(id), ct);
- [HttpGet]
- [Route("")]
- public async Task GetAllAsync()
+ if (result is null)
{
- var result = await _mediator.Send(new GetCategoriesQuery());
- return Ok(result.Categories);
+ _logger.LogError("GetByIdAsync: not found id = {Id}", id);
+ return NotFound();
}
- [HttpPut]
- [HttpPost]
- [Route("")]
- public async Task> AddAsync(
- [FromBody] CreateCategoryModel model,
- CancellationToken ct)
- {
- var result = await _mediator.Send(
- new CreateCategoryCommand(
- model.CategoryName,
- model.QuantityCertificates,
- model.CategoryDescription,
- model.CategorySeries),
- ct);
- return CreatedAtAction(GetByIdActionName,
- new {id = result.Id}, result);
- }
+ _logger.LogInformation("GetByIdAsync: OK");
+ return Ok(result);
+ }
+
+ [MapToApiVersion("1.0")]
+ [HttpGet]
+ [Route("")]
+ public async Task GetAllAsync()
+ {
+ var result = await _mediator.Send(new GetCategoriesQuery());
+ return Ok(result.Categories);
+ }
- [HttpPut]
- [Route("{id}")]
- public async Task> UpdateAsync(
- long id, [FromBody] UpdateCategoryModel model, CancellationToken ct)
- {
- var result = await _mediator.Send(
- new UpdateCategoryDetailsCommand(
- model.Id,
- model.CategoryName,
- model.CategoryDescription,
- model.CategorySeries,
- model.CustomerId,
- model.QuantityCertificates,
- model.QuantityPublishCode), ct);
-
- if (result is null)
- {
- return NotFound();
- }
-
- return result;
- }
+ [MapToApiVersion("1.0")]
+ [HttpPut]
+ [HttpPost]
+ [Route("")]
+ public async Task> AddAsync(
+ [FromBody] CreateCategoryModel model,
+ CancellationToken ct)
+ {
+ var result = await _mediator.Send(
+ new CreateCategoryCommand(
+ model.CategoryName,
+ model.QuantityCertificates,
+ model.CategoryDescription,
+ model.CategorySeries),
+ ct);
+ return CreatedAtAction(GetByIdActionName,
+ new {id = result.Id}, result);
+ }
- [HttpDelete]
- [Route("{id}")]
- public async Task RemoveAsync(long id, CancellationToken ct)
- {
- await _mediator.Send(new DeleteCategoryCommand(id), ct);
- return NoContent();
- }
- #endregion
+ [MapToApiVersion("1.0")]
+ [HttpPut]
+ [Route("{id}")]
+ public async Task> UpdateAsync(
+ long id, [FromBody] UpdateCategoryModel model, CancellationToken ct)
+ {
+ var result = await _mediator.Send(
+ new UpdateCategoryDetailsCommand(
+ model.Id,
+ model.CategoryName,
+ model.CategoryDescription,
+ model.CategorySeries,
+ model.CustomerId,
+ model.QuantityCertificates,
+ model.QuantityPublishCode), ct);
+
+ if (result is null) return NotFound();
+
+ return result;
}
+
+ [MapToApiVersion("1.0")]
+ [HttpDelete]
+ [Route("{id}")]
+ public async Task RemoveAsync(long id, CancellationToken ct)
+ {
+ await _mediator.Send(new DeleteCategoryCommand(id), ct);
+ return NoContent();
+ }
+
+ #endregion
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CreateCategoryModel.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CreateCategoryModel.cs
index 636ca9bc..fdcf576a 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CreateCategoryModel.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/CreateCategoryModel.cs
@@ -1,19 +1,16 @@
-using System.Runtime.Serialization;
+namespace O2NextGen.CertificateManagement.Application.Features.Categories;
-namespace O2NextGen.CertificateManagement.Application.Features.Categories
+public class CreateCategoryModel : ICreateCategoryModel
{
- public class CreateCategoryModel : ICreateCategoryModel
- {
- public string CategoryName { get; set; }
- public string CategoryDescription { get; set; }
- public string CategorySeries { get; set; }
- public string CustomerId { get; set; }
- public long? AddedDate { get; set; }
- public long? ModifiedDate { get; set; }
- public long? DeletedDate { get; set; }
- public bool? IsDeleted { get; set; }
- public int TimeLifeInDays { get; set; }
- public int QuantityCertificates { get; set; }
- public int QuantityPublishCode { get; set; }
- }
+ public long? AddedDate { get; set; }
+ public long? ModifiedDate { get; set; }
+ public long? DeletedDate { get; set; }
+ public bool? IsDeleted { get; set; }
+ public int TimeLifeInDays { get; set; }
+ public string CategoryName { get; set; }
+ public string CategoryDescription { get; set; }
+ public string CategorySeries { get; set; }
+ public string CustomerId { get; set; }
+ public int QuantityCertificates { get; set; }
+ public int QuantityPublishCode { get; set; }
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/ResponseDto.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/ResponseDto.cs
index 2f2daeb2..abd8f522 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/ResponseDto.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/ResponseDto.cs
@@ -2,5 +2,4 @@ namespace O2NextGen.CertificateManagement.Application.Features.Categories;
public class ResponseDto
{
-
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/UpdateCategoryModel.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/UpdateCategoryModel.cs
index f86f7efb..630eee95 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/UpdateCategoryModel.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Categories/UpdateCategoryModel.cs
@@ -2,5 +2,5 @@ namespace O2NextGen.CertificateManagement.Application.Features.Categories;
public class UpdateCategoryModel : CreateCategoryModel
{
- public long Id { get; set; }
+ public long Id { get; set; }
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CertificatesController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CertificatesController.cs
index f5410efa..9f8680fd 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CertificatesController.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CertificatesController.cs
@@ -6,127 +6,127 @@
using O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificates;
using O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.UpdateCertificate;
-namespace O2NextGen.CertificateManagement.Application.Features.Certificates
+namespace O2NextGen.CertificateManagement.Application.Features.Certificates;
+
+//[Authorize]
+[ApiController]
+[ApiVersion("1.0")]
+//[ApiVersion("1.1")]
+// ReSharper disable once RouteTemplates.RouteParameterConstraintNotResolved
+[Route("api/v{v:apiVersion}/[controller]")]
+public class CertificatesController : ControllerBase
{
- [Route("api/[controller]")]
- [ApiController]
- public partial class CertificatesController : ControllerBase
+ #region Ctors
+
+ public CertificatesController(IMediator mediator, ILogger logger)
+ {
+ _mediator = mediator;
+ _logger = logger;
+ }
+
+ #endregion
+
+ #region Fields
+
+ private readonly IMediator _mediator;
+ private readonly ILogger _logger;
+
+ private static readonly string GetByIdActionName
+ = nameof(GetByIdAsync).Replace("Async", string.Empty);
+
+ #endregion
+
+
+ #region Methods
+
+ [HttpGet]
+ [Route("{id}")]
+ public async Task GetByIdAsync(long id, CancellationToken ct)
+ {
+ var result = await _mediator.Send(new GetCertificateQuery(id), ct);
+
+ if (result is null)
+ return NotFound();
+
+ return Ok(result);
+ }
+
+ [HttpGet]
+ [Route("")]
+ public async Task GetAllAsync()
{
- #region Fields
-
- private readonly IMediator _mediator;
- private readonly ILogger _logger;
-
- private static readonly string GetByIdActionName
- = nameof(GetByIdAsync).Replace("Async", string.Empty);
- #endregion
-
-
- #region Ctors
-
- public CertificatesController(IMediator mediator, ILogger logger)
- {
- _mediator = mediator;
- _logger = logger;
- }
-
- #endregion
-
-
- #region Methods
-
- [HttpGet]
- [Route("{id}")]
- public async Task GetByIdAsync(long id, CancellationToken ct)
- {
- var result = await _mediator.Send(new GetCertificateQuery(id), ct);
-
- if (result is null)
- return NotFound();
-
- return Ok(result);
- }
-
- [HttpGet]
- [Route("")]
- public async Task GetAllAsync()
- {
- var result = await _mediator.Send(new GetCertificatesQuery());
- return Ok(result.Certificates);
- }
-
- [HttpPut]
- [Route("id")]
- public async Task> UpdateAsync(
- long id, [FromBody] UpdateCertificateDetailsCommandModel model, CancellationToken ct)
- {
- var result = await _mediator.Send(
- new UpdateCertificateDetailsCommand(
- id,
- model.ExternalId,
- model.ModifiedDate,
- model.AddedDate,
- model.DeletedDate,
- model.IsDeleted,
- model.OwnerAccountId,
- model.CustomerId,
- model.ExpiredDate,
- model.PublishDate,
- model.CreatorId,
- model.PublishCode,
- model.IsVisible,
- model.CategoryId,
- model.Category,
- model.Lock,
- model.LockedDate,
- model.LockInfo,
- model.LanguageInfos));
-
- if (result is null)
- {
- return NotFound();
- }
-
- return result;
- }
-
- [HttpPut]
- [HttpPost]
- [Route("")]
- public async Task> AddAsync(
- [FromBody] CreateCertificateDetailsCommandModel model,
- CancellationToken ct)
- {
- var result = await _mediator.Send(
- new CreateCertificateCommand(
- model.ExternalId,
- model.IsDeleted,
- model.OwnerAccountId,
- model.CustomerId,
- model.ExpiredDate,
- model.PublishDate,
- model.CreatorId,
- model.PublishCode,
- model.IsVisible,
- model.CategoryId,
- model.Category,
- model.Lock,
- model.LockedDate,
- model.LockInfo,
- model.LanguageInfos
- ));
- return CreatedAtAction(GetByIdActionName,
- new { id = result.Id }, result);
- }
-
- [HttpDelete]
- [Route("{id}")]
- public async Task RemoveAsync(long id, CancellationToken ct)
- {
- await _mediator.Send(new DeleteCertificateCommand(id));
- return NoContent();
- }
-
- #endregion
+ var result = await _mediator.Send(new GetCertificatesQuery());
+ return Ok(result.Certificates);
}
-}
+
+ [HttpPut]
+ [Route("id")]
+ public async Task> UpdateAsync(
+ long id, [FromBody] UpdateCertificateDetailsCommandModel model, CancellationToken ct)
+ {
+ var result = await _mediator.Send(
+ new UpdateCertificateDetailsCommand(
+ id,
+ model.ExternalId,
+ model.ModifiedDate,
+ model.AddedDate,
+ model.DeletedDate,
+ model.IsDeleted,
+ model.OwnerAccountId,
+ model.CustomerId,
+ model.ExpiredDate,
+ model.PublishDate,
+ model.CreatorId,
+ model.PublishCode,
+ model.IsVisible,
+ model.CategoryId,
+ model.Category,
+ model.Lock,
+ model.LockedDate,
+ model.LockInfo,
+ model.LanguageInfos));
+
+ if (result is null) return NotFound();
+
+ return result;
+ }
+
+ [HttpPut]
+ [HttpPost]
+ [Route("")]
+ public async Task> AddAsync(
+ [FromBody] CreateCertificateDetailsCommandModel model,
+ CancellationToken ct)
+ {
+ var result = await _mediator.Send(
+ new CreateCertificateCommand(
+ model.ExternalId,
+ model.IsDeleted,
+ model.OwnerAccountId,
+ model.CustomerId,
+ model.ExpiredDate,
+ model.PublishDate,
+ model.CreatorId,
+ model.PublishCode,
+ model.IsVisible,
+ model.CategoryId,
+ model.Category,
+ model.Lock,
+ model.LockedDate,
+ model.LockInfo,
+ model.LanguageInfos
+ ));
+ return CreatedAtAction(GetByIdActionName,
+ new {id = result.Id}, result);
+ }
+
+ [HttpDelete]
+ [Route("{id}")]
+ public async Task RemoveAsync(long id, CancellationToken ct)
+ {
+ await _mediator.Send(new DeleteCertificateCommand(id));
+ return NoContent();
+ }
+
+ #endregion
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Generator/GeneratorController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Generator/GeneratorController.cs
new file mode 100644
index 00000000..894c752e
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Generator/GeneratorController.cs
@@ -0,0 +1,187 @@
+using System.Drawing;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using O2NextGen.CertificateManagement.Application.Helpers;
+using O2NextGen.CertificateManagement.Application.Services;
+
+namespace O2NextGen.CertificateManagement.Application.Features.Generator;
+
+[ApiVersion("1.0")]
+ [ApiVersion("1.1")]
+ [ApiController]
+ // ReSharper disable once RouteTemplates.RouteParameterConstraintNotResolved
+ [Route("api/v{v:apiVersion}/generator")]
+ public class GeneratorController : ControllerBase
+ {
+
+ // #region Ctors
+ //
+ // public GeneratorController(
+ // ITemplateService templateService,
+ // IQrCodeService qrCodeService)
+ // {
+ // _templateService = templateService;
+ // _qrCodeService = qrCodeService;
+ // }
+ //
+ // #endregion
+
+ // #region Methods
+ //
+ // [AllowAnonymous]
+ // [HttpGet]
+ // public async Task GetCertificate([FromQuery(Name = "certificateId")] long certificateId)
+ // {
+ // var languageId = 1;
+ // var existCertificate = await _certificateService.GetAsync(certificateId);
+ //
+ // if (existCertificate == null)
+ // throw new ArgumentException($"Certificate {nameof(existCertificate)} not found");
+ //
+ // //category
+ // var catId = existCertificate.CategoryId;
+ // var category = await _categoryService.GetAsync(catId);
+ // existCertificate.CategoryModel = category;
+ // var fio = string.Empty;
+ // //LanguageInfoModel infoLanguage;
+ // // if (languageId == 1)
+ // // {
+ // // infoLanguage = existCertificate.LanguageInfos.Where(x => x.LanguageId == 1).FirstOrDefault();
+ // // if (!string.IsNullOrEmpty(infoLanguage.Lastname))
+ // // fio = infoLanguage.Lastname.Trim();
+ // //
+ // // if (!string.IsNullOrEmpty(infoLanguage.Firstname))
+ // // fio = fio + " " + infoLanguage.Firstname.Trim();
+ // //
+ // // if (!string.IsNullOrEmpty(infoLanguage.Middlename))
+ // // fio = fio + "\n" + infoLanguage.Middlename.Trim();
+ // // }
+ // //
+ // // if (languageId == 2)
+ // // {
+ // // infoLanguage = existCertificate.LanguageInfos.Where(x => x.LanguageId == 1).FirstOrDefault();
+ // // if (!string.IsNullOrEmpty(infoLanguage.Firstname))
+ // // fio = infoLanguage.Firstname.Trim();
+ // // if (!string.IsNullOrEmpty(infoLanguage.Lastname))
+ // // fio = fio + " " + infoLanguage.Lastname.Trim();
+ // //
+ // // }
+ //
+ //
+ //
+ // var certificateNumber =
+ // existCertificate.CategoryModel.CategorySeries + " - " + existCertificate.PublishCode;
+ //
+ // if (category == null)
+ // throw new ArgumentException($"CategoryModel {nameof(category)} not found");
+ //
+ //
+ // var categoryModelId = existCertificate.CategoryModel.Id;
+ //
+ // var templateImage = _templateService.GetTemplate(categoryModelId);
+ //
+ // var bitmapClear = new Bitmap(templateImage.Width, templateImage.Height);
+ //
+ // var template = _templateService.GetSettingsOtTemplate(categoryModelId);
+ //
+ // var templateSettings = template.Items;
+ //
+ // Image qrCodeImage = null;
+ //
+ // if (templateSettings.Any(x => x.ElementType == TemplateService.ElementType.QrCode))
+ // {
+ // var templateSetting = templateSettings.Where(x => x.ElementType == TemplateService.ElementType.QrCode)
+ // .FirstOrDefault();
+ // qrCodeImage = await _qrCodeService.GetQrCodeBasicCertificate(existCertificate.CategoryId,
+ // templateSetting.Width);
+ // }
+ //
+ //
+ // using (var graphics = Graphics.FromImage(bitmapClear))
+ // {
+ // graphics.DrawImage(templateImage, 0, 0, templateImage.Width, templateImage.Height);
+ //
+ // var myTaskList = new List();
+ //
+ //
+ // foreach (var templateSetting in templateSettings)
+ // switch (templateSetting.ElementType)
+ // {
+ // case TemplateService.ElementType.QrCode:
+ // {
+ // //var taskR = new Task(
+ // // () =>
+ // // {
+ //
+ // // For pedagogical use only: in general, don't do this!
+ //
+ // graphics.DrawImage(qrCodeImage, templateSetting.PointX, templateSetting.PointY,
+ // qrCodeImage.Width, qrCodeImage.Height);
+ // // });
+ // //myTaskList.Add(taskR);
+ // }
+ // break;
+ // case TemplateService.ElementType.Text:
+ // {
+ // //var taskR = new Task(
+ // // () =>
+ // // {
+ // ImageHelper.AddedText(fio, bitmapClear, graphics, "Arial", 95, Brushes.Black,
+ // templateSetting.PointY,
+ // StringAlignment.Center, StringAlignment.Center);
+ // // });
+ // //myTaskList.Add(taskR);
+ // }
+ // break;
+ // case TemplateService.ElementType.SpecialNumber:
+ // {
+ // //var taskR = new Task(
+ // // () =>
+ // // {
+ // ImageHelper.AddedText(certificateNumber, bitmapClear, graphics, "Arial", 45, Brushes.Red,
+ // templateSetting.PointY,
+ // StringAlignment.Center, StringAlignment.Near);
+ // // });
+ // //myTaskList.Add(taskR);
+ // }
+ // break;
+ // case TemplateService.ElementType.Signature:
+ // break;
+ // case TemplateService.ElementType.Stamp:
+ // break;
+ // default:
+ // throw new ArgumentOutOfRangeException();
+ // }
+ //
+ // Parallel.ForEach(myTaskList, task => task.Start());
+ //
+ // //ImageHelper.AddedText(fio, bitmapClear, graphics, "Arial", 95, Brushes.Black, 1550,
+ // // StringAlignment.Center, StringAlignment.Center);
+ //
+ // //added serial_number
+ //
+ // //graphics.DrawImage(qrCodeImage, 1070, 2901, qrCodeImage.Width, qrCodeImage.Height);
+ // }
+ //
+ // var bitmapBytes = ImageHelper.BitmapToBytes(bitmapClear); //Convert bitmap into a byte array
+ //
+ // return File(bitmapBytes, "image/jpeg");
+ // }
+ //
+ // #endregion
+ //
+ //
+ // #region Fields
+ //
+ // private readonly ICertificateReService _certificateService;
+ // private readonly ICategoryReService _categoryService;
+ //
+ // private readonly
+ // ICertificateManagementHistoryReService _certificateManagementHistoryRe;
+ //
+ // private readonly ITemplateService _templateService;
+ //
+ // private readonly IQrCodeService _qrCodeService;
+ //
+ // #endregion
+ }
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/ImportExport/ServiceController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/ImportExport/ServiceController.cs
new file mode 100644
index 00000000..a4ed29d3
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/ImportExport/ServiceController.cs
@@ -0,0 +1,9 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace O2NextGen.CertificateManagement.Application.Features.ImportExport;
+
+[Route("api/[controller]")]
+[ApiController]
+public class ServiceController : ControllerBase
+{
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Projects/CreateProjectModel.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Projects/CreateProjectModel.cs
new file mode 100644
index 00000000..262a222e
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Projects/CreateProjectModel.cs
@@ -0,0 +1,6 @@
+namespace O2NextGen.CertificateManagement.Application.Features.Projects;
+
+public class CreateProjectModel
+{
+
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Projects/ProjectsController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Projects/ProjectsController.cs
index 934e41eb..479bba50 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Projects/ProjectsController.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Projects/ProjectsController.cs
@@ -4,25 +4,27 @@
namespace O2NextGen.CertificateManagement.Application.Features.Projects;
-[Route("api/[controller]")]
+[ApiVersion("1.0")]
+[ApiVersion("1.1")]
+[ApiController]
+// ReSharper disable once RouteTemplates.RouteParameterConstraintNotResolved
+[Route("api/v{v:apiVersion}/[controller]")]
public class ProjectsController : ControllerBase
{
private readonly ICustomerService _customerService;
- private List memoryList { get; }
-
public ProjectsController(ICustomerService customerService)
{
_customerService = customerService;
memoryList = new List
{
- new ProjectViewModel
+ new()
{
Name = "PROJECT PFR",
Description = "Project of PFR CENTER",
TenantId = _customerService.CustomerId
},
- new ProjectViewModel()
+ new()
{
Name = "PROJECT PFR 2",
Description = "Project of PFR CENTER",
@@ -31,6 +33,8 @@ public ProjectsController(ICustomerService customerService)
};
}
+ private List memoryList { get; }
+
[HttpGet]
[ProducesResponseType((int) HttpStatusCode.NotFound)]
[ProducesResponseType((int) HttpStatusCode.BadRequest)]
@@ -77,6 +81,6 @@ public async Task AddAsync()
[ProducesResponseType((int) HttpStatusCode.NoContent)]
public async Task RemoveAsync(long id, CancellationToken ct)
{
- return NoContent();
+ return NoContent();
}
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/QRCodes/QrCodeController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/QRCodes/QrCodeController.cs
new file mode 100644
index 00000000..79f7a96f
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/QRCodes/QrCodeController.cs
@@ -0,0 +1,191 @@
+using System.Drawing;
+using System.Drawing.Imaging;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using O2NextGen.CertificateManagement.Application.Helpers;
+using O2NextGen.CertificateManagement.Application.Services;
+using QRCoder;
+
+namespace O2NextGen.CertificateManagement.Application.Features.QRCodes;
+
+[ApiVersion("1.0")]
+[ApiVersion("1.1")]
+[ApiController]
+// ReSharper disable once RouteTemplates.RouteParameterConstraintNotResolved
+[Route("api/v{v:apiVersion}/[controller]")]
+public class QrCodeController : ControllerBase
+{
+ #region Ctors
+
+ public QrCodeController(ICustomerService customerService, IIdentityService identityService)
+ {
+ _customerService = customerService;
+ _identityService = identityService;
+ }
+
+ #endregion
+
+ [AllowAnonymous]
+ [HttpGet("profile/{accountId}")]
+ public IActionResult GetProfile([FromQuery] Guid accountId, [FromQuery] int size = 500)
+ {
+ var description = _customerService.CustomerDescription;
+ var registerShortLink = _customerService.AccountLink + "/" + accountId;
+
+ var qrCodeContent = "Profile of Specialist #PF_R" + " " + registerShortLink;
+ var qrCodeSize = new QrCodeSize {Width = size, Height = size};
+
+ var qrCodeBitmap = new Bitmap(qrCodeSize.Width, qrCodeSize.Height, PixelFormat.Format24bppRgb);
+
+ var qrGenerator = new QRCodeGenerator();
+ var qrCodeData = qrGenerator.CreateQrCode(
+ qrCodeContent,
+ QRCodeGenerator.ECCLevel.H);
+ var qrCode = new QRCode(qrCodeData);
+
+ var qrCodeImage = qrCode.GetGraphic(20, Color.Black, Color.White, null);
+ var bitmapClear = new Bitmap(qrCodeSize.Width, qrCodeSize.Height);
+ using (var graphics = Graphics.FromImage(bitmapClear))
+ {
+ graphics.DrawImage(qrCodeBitmap, 0, 0, qrCodeBitmap.Width, qrCodeBitmap.Height);
+ //var image = Image.FromFile("Files/pfr-community_logo.png");
+ //int left = (qrCodeBitmap.Width / 2) - (image.Width / 2);
+ //int top = (qrCodeBitmap.Height / 2) - (image.Height / 2);
+ graphics.DrawImage(qrCodeImage, 0, 0, qrCodeSize.Width, qrCodeSize.Height);
+ //graphics.DrawImage(image, new Point(left, top));
+ //var fullNumber = certificationSerial + certificationNumber;
+ //ImageHelper.AddedText(fullNumber, qrCodeBitmap, graphics, "Arial", 18, Brushes.Black, top + 30,
+ // StringAlignment.Center, StringAlignment.Center);
+ graphics.Save();
+ }
+
+ var bitmapBytes = ImageHelper.BitmapToBytes(bitmapClear); //Convert bitmap into a byte array
+
+ return File(bitmapBytes, "image/jpeg");
+ }
+
+ [AllowAnonymous]
+ [HttpGet("register")]
+ public IActionResult GetQrCodeOfRegisterPage([FromQuery] int size = 500)
+ {
+ var certificationSerial = "A";
+ var certificationNumber = "020619890";
+
+ //Todo: I will add the short link
+ var registerShortLink = _customerService.RegisterLink;
+ var qrCodeContent = _customerService.CustomerDescription + " " + registerShortLink;
+
+ var qrCodeSize = new QrCodeSize {Width = size, Height = size};
+
+ var qrCodeBitmap = new Bitmap(qrCodeSize.Width, qrCodeSize.Height, PixelFormat.Format24bppRgb);
+
+ var qrGenerator = new QRCodeGenerator();
+ var qrCodeData = qrGenerator.CreateQrCode(
+ qrCodeContent,
+ QRCodeGenerator.ECCLevel.H);
+ var qrCode = new QRCode(qrCodeData);
+
+ var qrCodeImage = qrCode.GetGraphic(20, Color.Black, Color.White, null);
+ var bitmapClear = new Bitmap(qrCodeSize.Width, qrCodeSize.Height);
+ using (var graphics = Graphics.FromImage(bitmapClear))
+ {
+ graphics.DrawImage(qrCodeBitmap, 0, 0, qrCodeBitmap.Width, qrCodeBitmap.Height);
+ var image = Image.FromFile("Files/pfr-community_logo.png");
+ var left = qrCodeBitmap.Width / 2 - image.Width / 2;
+ var top = qrCodeBitmap.Height / 2 - image.Height / 2;
+ graphics.DrawImage(qrCodeImage, 0, 0, qrCodeSize.Width, qrCodeSize.Height);
+ graphics.DrawImage(image, new Point(left, top));
+ var fullNumber = certificationSerial + certificationNumber;
+ ImageHelper.AddedText(fullNumber, qrCodeBitmap, graphics, "Arial", 18, Brushes.Black, top + 30,
+ StringAlignment.Center, StringAlignment.Center);
+ graphics.Save();
+ }
+
+ var bitmapBytes = ImageHelper.BitmapToBytes(bitmapClear); //Convert bitmap into a byte array
+
+ return File(bitmapBytes, "image/jpeg");
+ }
+
+ [AllowAnonymous]
+ [HttpGet("qrcode-basic")]
+ public IActionResult GetQrCodeBasicCertificate([FromQuery(Name = "size")] int size = 500)
+ {
+ var certificationAccountId = "";
+ var qrCodeContent = "Profile of Specialist #PF_R" + " https://pfr-centr.com/pages/profile/" +
+ certificationAccountId;
+ var qrCodeSize = new QrCodeSize {Width = size, Height = size};
+
+ var qrCodeBitmap = new Bitmap(qrCodeSize.Width, qrCodeSize.Height, PixelFormat.Format24bppRgb);
+
+ var qrGenerator = new QRCodeGenerator();
+ var qrCodeData = qrGenerator.CreateQrCode(
+ qrCodeContent,
+ QRCodeGenerator.ECCLevel.H);
+ var qrCode = new QRCode(qrCodeData);
+
+ var qrCodeImage = qrCode.GetGraphic(20, Color.Black, Color.White, null);
+ var bitmapClear = new Bitmap(qrCodeSize.Width, qrCodeSize.Height);
+ using (var graphics = Graphics.FromImage(bitmapClear))
+ {
+ graphics.DrawImage(qrCodeBitmap, 0, 0, qrCodeBitmap.Width, qrCodeBitmap.Height);
+ //var image = Image.FromFile("Files/pfr-community_logo.png");
+ //int left = (qrCodeBitmap.Width / 2) - (image.Width / 2);
+ //int top = (qrCodeBitmap.Height / 2) - (image.Height / 2);
+ graphics.DrawImage(qrCodeImage, 0, 0, qrCodeSize.Width, qrCodeSize.Height);
+ //graphics.DrawImage(image, new Point(left, top));
+ //var fullNumber = certificationSerial + certificationNumber;
+ //ImageHelper.AddedText(fullNumber, qrCodeBitmap, graphics, "Arial", 18, Brushes.Black, top + 30,
+ // StringAlignment.Center, StringAlignment.Center);
+ graphics.Save();
+ }
+
+ var bitmapBytes = ImageHelper.BitmapToBytes(bitmapClear); //Convert bitmap into a byte array
+
+ return File(bitmapBytes, "image/jpeg");
+ }
+
+ [AllowAnonymous]
+ [HttpGet("qrcode-signup")]
+ public IActionResult GetQrCodeBasicSignUp([FromQuery(Name = "size")] int size = 500)
+ {
+ var certificationAccountId = "";
+ var qrCodeContent = "Profile of Specialist #PF_R" + " https://pfr-centr.com/pages/profile/" +
+ certificationAccountId;
+ var qrCodeSize = new QrCodeSize {Width = size, Height = size};
+
+ var qrCodeBitmap = new Bitmap(qrCodeSize.Width, qrCodeSize.Height, PixelFormat.Format24bppRgb);
+
+ var qrGenerator = new QRCodeGenerator();
+ var qrCodeData = qrGenerator.CreateQrCode(
+ qrCodeContent,
+ QRCodeGenerator.ECCLevel.H);
+ var qrCode = new QRCode(qrCodeData);
+
+ var qrCodeImage = qrCode.GetGraphic(20, Color.Black, Color.White, null);
+ var bitmapClear = new Bitmap(qrCodeSize.Width, qrCodeSize.Height);
+ using (var graphics = Graphics.FromImage(bitmapClear))
+ {
+ graphics.DrawImage(qrCodeBitmap, 0, 0, qrCodeBitmap.Width, qrCodeBitmap.Height);
+ //var image = Image.FromFile("Files/pfr-community_logo.png");
+ //int left = (qrCodeBitmap.Width / 2) - (image.Width / 2);
+ //int top = (qrCodeBitmap.Height / 2) - (image.Height / 2);
+ graphics.DrawImage(qrCodeImage, 0, 0, qrCodeSize.Width, qrCodeSize.Height);
+ //graphics.DrawImage(image, new Point(left, top));
+ //var fullNumber = certificationSerial + certificationNumber;
+ //ImageHelper.AddedText(fullNumber, qrCodeBitmap, graphics, "Arial", 18, Brushes.Black, top + 30,
+ // StringAlignment.Center, StringAlignment.Center);
+ graphics.Save();
+ }
+
+ var bitmapBytes = ImageHelper.BitmapToBytes(bitmapClear); //Convert bitmap into a byte array
+
+ return File(bitmapBytes, "image/jpeg");
+ }
+
+ #region Fields
+
+ private readonly ICustomerService _customerService;
+ private readonly IIdentityService _identityService;
+
+ #endregion
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/QRCodes/QrCodeSize.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/QRCodes/QrCodeSize.cs
new file mode 100644
index 00000000..92221fe1
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/QRCodes/QrCodeSize.cs
@@ -0,0 +1,7 @@
+namespace O2NextGen.CertificateManagement.Application.Features.QRCodes;
+
+public class QrCodeSize
+{
+ public int Width { get; set; }
+ public int Height { get; set; }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Templates/TemplateController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Templates/TemplateController.cs
new file mode 100644
index 00000000..c315cc77
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Templates/TemplateController.cs
@@ -0,0 +1,23 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace O2NextGen.CertificateManagement.Application.Features.Templates;
+
+[ApiVersion("1.0")]
+// [ApiVersion("1.1")]
+[ApiController]
+// ReSharper disable once RouteTemplates.RouteParameterConstraintNotResolved
+[Route("api/v{v:apiVersion}/[controller]")]
+public class TemplateController : ControllerBase
+{
+ [HttpGet]
+ public IActionResult GetTemplate()
+ {
+ return Ok();
+ }
+
+ [HttpGet("settings")]
+ public IActionResult GetSettingsOtTemplate()
+ {
+ return Ok();
+ }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/A/A0002092019_cert_tr.png b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/A/A0002092019_cert_tr.png
new file mode 100644
index 00000000..64ff0648
Binary files /dev/null and b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/A/A0002092019_cert_tr.png differ
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/A/pft_template_cert.png b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/A/pft_template_cert.png
new file mode 100644
index 00000000..19841a76
Binary files /dev/null and b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/A/pft_template_cert.png differ
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/A/pft_template_cert_en.png b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/A/pft_template_cert_en.png
new file mode 100644
index 00000000..0c0a32cc
Binary files /dev/null and b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/A/pft_template_cert_en.png differ
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/A/pft_template_cert_tr.png b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/A/pft_template_cert_tr.png
new file mode 100644
index 00000000..cf47b20b
Binary files /dev/null and b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/A/pft_template_cert_tr.png differ
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/AA/certificate-ab_en.png b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/AA/certificate-ab_en.png
new file mode 100644
index 00000000..0de8f9e1
Binary files /dev/null and b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/AA/certificate-ab_en.png differ
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/AA/certificate-ab_ru.png b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/AA/certificate-ab_ru.png
new file mode 100644
index 00000000..c7dda924
Binary files /dev/null and b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/AA/certificate-ab_ru.png differ
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/AA/certificate-ab_tr.png b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/AA/certificate-ab_tr.png
new file mode 100644
index 00000000..a5cf54a9
Binary files /dev/null and b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/AA/certificate-ab_tr.png differ
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/AB/certificate-bb_ru.png b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/AB/certificate-bb_ru.png
new file mode 100644
index 00000000..8c8b02fe
Binary files /dev/null and b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/AB/certificate-bb_ru.png differ
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/B/pfr_template_cert_b.png b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/B/pfr_template_cert_b.png
new file mode 100644
index 00000000..09cabbe9
Binary files /dev/null and b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/B/pfr_template_cert_b.png differ
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/B/pfr_template_cert_b_en.png b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/B/pfr_template_cert_b_en.png
new file mode 100644
index 00000000..1a8836e8
Binary files /dev/null and b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/B/pfr_template_cert_b_en.png differ
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/B/pfr_template_cert_b_ru.png b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/B/pfr_template_cert_b_ru.png
new file mode 100644
index 00000000..f0440f6d
Binary files /dev/null and b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/B/pfr_template_cert_b_ru.png differ
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/B/pft_template_cert_b.png b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/B/pft_template_cert_b.png
new file mode 100644
index 00000000..c8c4a664
Binary files /dev/null and b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/B/pft_template_cert_b.png differ
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/BB/certificate-b2_ru.png b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/BB/certificate-b2_ru.png
new file mode 100644
index 00000000..619d5466
Binary files /dev/null and b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/BB/certificate-b2_ru.png differ
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/T/template-hypnos.png b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/T/template-hypnos.png
new file mode 100644
index 00000000..a8aa3f86
Binary files /dev/null and b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/Templates/Certificates/T/template-hypnos.png differ
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/pfr-community_logo.png b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/pfr-community_logo.png
new file mode 100644
index 00000000..7b3cb32b
Binary files /dev/null and b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Files/pfr-community_logo.png differ
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Helpers/ActionDescriptorExtensions.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Helpers/ActionDescriptorExtensions.cs
new file mode 100644
index 00000000..611d47dd
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Helpers/ActionDescriptorExtensions.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc.Abstractions;
+using Microsoft.AspNetCore.Mvc.Versioning;
+
+namespace O2NextGen.CertificateManagement.Application.Helpers;
+
+public static class ActionDescriptorExtensions
+{
+ public static ApiVersionModel GetApiVersion(this ActionDescriptor actionDescriptor)
+ {
+ return actionDescriptor?.Properties
+ .Where((kvp) => ((Type)kvp.Key).Equals(typeof(ApiVersionModel)))
+ .Select(kvp => kvp.Value as ApiVersionModel).FirstOrDefault();
+ }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Helpers/ImageHelper.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Helpers/ImageHelper.cs
new file mode 100644
index 00000000..1184fe6b
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Helpers/ImageHelper.cs
@@ -0,0 +1,121 @@
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
+
+namespace O2NextGen.CertificateManagement.Application.Helpers;
+
+public static class ImageHelper
+{
+ public static void AddedText(string text, Bitmap cert, Graphics graphics, string fontFamily, int sizeFont,
+ Brush brush, int y, StringAlignment alignment, StringAlignment lineAlignment)
+ {
+ graphics.SmoothingMode = SmoothingMode.AntiAlias;
+ graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
+ graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
+ var strFont = new Font(fontFamily, sizeFont);
+
+
+ //SizeF size = graphics.MeasureString(text, strFont);
+ using (var sf = new StringFormat
+ {
+ Alignment = alignment,
+ LineAlignment = lineAlignment
+ })
+ {
+ graphics.DrawString(text, strFont, brush, cert.Width / 2, y, sf);
+ }
+
+ graphics.Flush();
+ }
+
+ public static void AddedTextX(string text, Bitmap cert, Graphics graphics, string fontFamily, int sizeFont,
+ Brush brush, int y, int x, StringAlignment alignment, StringAlignment lineAlignment)
+ {
+ graphics.SmoothingMode = SmoothingMode.AntiAlias;
+ graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
+ graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
+ var strFont = new Font(fontFamily, sizeFont);
+
+
+ //SizeF size = graphics.MeasureString(text, strFont);
+ using (var sf = new StringFormat
+ {
+ Alignment = alignment,
+ LineAlignment = lineAlignment
+ })
+ {
+ graphics.DrawString(text, strFont, brush, x, y, sf);
+ }
+
+ graphics.Flush();
+ }
+
+ // This method is for converting bitmap into a byte array
+ public static byte[] BitmapToBytes(Bitmap img)
+ {
+ using (var stream = new MemoryStream())
+ {
+ img.Save(stream, ImageFormat.Png);
+ return stream.ToArray();
+ }
+ }
+
+ public static Image resizeImage(int newWidth, int newHeight, string stPhotoPath)
+ {
+ var imgPhoto = Image.FromFile(stPhotoPath);
+
+ var sourceWidth = imgPhoto.Width;
+ var sourceHeight = imgPhoto.Height;
+
+ //Consider vertical pics
+ if (sourceWidth < sourceHeight)
+ {
+ var buff = newWidth;
+
+ newWidth = newHeight;
+ newHeight = buff;
+ }
+
+ int sourceX = 0, sourceY = 0, destX = 0, destY = 0;
+ float nPercent = 0, nPercentW = 0, nPercentH = 0;
+
+ nPercentW = newWidth / (float) sourceWidth;
+ nPercentH = newHeight / (float) sourceHeight;
+ if (nPercentH < nPercentW)
+ {
+ nPercent = nPercentH;
+ destX = Convert.ToInt16((newWidth -
+ sourceWidth * nPercent) / 2);
+ }
+ else
+ {
+ nPercent = nPercentW;
+ destY = Convert.ToInt16((newHeight -
+ sourceHeight * nPercent) / 2);
+ }
+
+ var destWidth = (int) (sourceWidth * nPercent);
+ var destHeight = (int) (sourceHeight * nPercent);
+
+
+ var bmPhoto = new Bitmap(newWidth, newHeight,
+ PixelFormat.Format24bppRgb);
+
+ bmPhoto.SetResolution(imgPhoto.HorizontalResolution,
+ imgPhoto.VerticalResolution);
+
+ var grPhoto = Graphics.FromImage(bmPhoto);
+ grPhoto.Clear(Color.Black);
+ grPhoto.InterpolationMode =
+ InterpolationMode.HighQualityBicubic;
+
+ grPhoto.DrawImage(imgPhoto,
+ new Rectangle(destX, destY, destWidth, destHeight),
+ new Rectangle(sourceX, sourceY, sourceWidth, sourceHeight),
+ GraphicsUnit.Pixel);
+
+ grPhoto.Dispose();
+ imgPhoto.Dispose();
+ return bmPhoto;
+ }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Helpers/RemoveVersionFromParameter.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Helpers/RemoveVersionFromParameter.cs
new file mode 100644
index 00000000..363aaaed
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Helpers/RemoveVersionFromParameter.cs
@@ -0,0 +1,14 @@
+using Microsoft.OpenApi.Models;
+using Swashbuckle.AspNetCore.SwaggerGen;
+
+namespace O2NextGen.CertificateManagement.Application.Helpers;
+
+public class RemoveVersionFromParameter : IOperationFilter
+{
+
+ public void Apply(OpenApiOperation operation, OperationFilterContext context)
+ {
+ var versionParameter = operation.Parameters.SingleOrDefault(p => p.Name.ToLower() == "v");
+ operation.Parameters.Remove(versionParameter);
+ }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Helpers/ReplaceVersionWithExactValueInPath.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Helpers/ReplaceVersionWithExactValueInPath.cs
new file mode 100644
index 00000000..9accccc9
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Helpers/ReplaceVersionWithExactValueInPath.cs
@@ -0,0 +1,22 @@
+using Microsoft.OpenApi.Models;
+using Swashbuckle.AspNetCore.SwaggerGen;
+
+namespace O2NextGen.CertificateManagement.Application.Helpers;
+
+public class ReplaceVersionWithExactValueInPath : IDocumentFilter
+{
+ public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
+ {
+ if (swaggerDoc == null)
+ throw new ArgumentNullException(nameof(swaggerDoc));
+
+ var replacements = new OpenApiPaths();
+
+ foreach (var (key, value) in swaggerDoc.Paths)
+ {
+ replacements.Add(key.Replace("v{v}", swaggerDoc.Info.Version, StringComparison.InvariantCulture), value);
+ }
+
+ swaggerDoc.Paths = replacements;
+ }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IServiceUrl.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IUrlsConfig.cs
similarity index 79%
rename from src/Services/c-gen/O2NextGen.CertificateManagement.Application/IServiceUrl.cs
rename to src/Services/c-gen/O2NextGen.CertificateManagement.Application/IUrlsConfig.cs
index 77b88296..87a402ae 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IServiceUrl.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IUrlsConfig.cs
@@ -1,8 +1,8 @@
namespace O2NextGen.CertificateManagement.Application;
-public interface IServiceUrl
+public interface IUrlsConfig
{
string IdentityUrl { get; set; }
-
+
string CGenUrl { get; set; }
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IoC/HttpContentExtensions.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IoC/HttpContentExtensions.cs
new file mode 100644
index 00000000..d88cba59
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IoC/HttpContentExtensions.cs
@@ -0,0 +1,33 @@
+namespace O2NextGen.CertificateManagement.Application.Services;
+
+public static class HttpContentExtensions
+{
+ public static Task ReadAsFileAsync(this HttpContent content, string filename, bool overwrite)
+ {
+ string pathname = Path.GetFullPath(filename);
+ if (!overwrite && File.Exists(filename))
+ {
+ throw new InvalidOperationException(string.Format("File {0} already exists.", pathname));
+ }
+
+ FileStream fileStream = null;
+ try
+ {
+ fileStream = new FileStream(pathname, FileMode.Create, FileAccess.Write, FileShare.None);
+ return content.CopyToAsync(fileStream).ContinueWith(
+ (copyTask) =>
+ {
+ fileStream.Close();
+ });
+ }
+ catch(Exception exception)
+ {
+ if (fileStream != null)
+ {
+ fileStream.Close();
+ }
+
+ throw;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IoC/ServiceCollectionExtensions.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IoC/ServiceCollectionExtensions.cs
index 4aefec4a..58d439da 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IoC/ServiceCollectionExtensions.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IoC/ServiceCollectionExtensions.cs
@@ -4,64 +4,61 @@
using O2NextGen.CertificateManagement.Domain.Data.Queries;
using O2NextGen.CertificateManagement.Infrastructure.Data;
-namespace O2NextGen.CertificateManagement.Application.IoC
+namespace O2NextGen.CertificateManagement.Application.IoC;
+
+public static class ServiceCollectionExtensions
{
- public static class ServiceCollectionExtensions
+ public static IServiceCollection AddBusiness(this IServiceCollection services)
{
- public static IServiceCollection AddBusiness(this IServiceCollection services)
- {
- services.AddMediatR(
- typeof(CertificateQuery));
+ services.AddMediatR(
+ typeof(CertificateQuery));
- return services;
- }
+ return services;
+ }
- public static TConfig ConfigurePOCO(this IServiceCollection services, IConfiguration configuration)
- where TConfig : class, new()
- {
- if (services == null) throw new ArgumentNullException(nameof(services));
- if (configuration == null) throw new ArgumentNullException(nameof(configuration));
+ public static TConfig ConfigurePOCO(this IServiceCollection services, IConfiguration configuration)
+ where TConfig : class, new()
+ {
+ if (services == null) throw new ArgumentNullException(nameof(services));
+ if (configuration == null) throw new ArgumentNullException(nameof(configuration));
- var config = new TConfig();
- configuration.Bind(config);
- services.AddSingleton(config);
- return config;
- }
+ var config = new TConfig();
+ configuration.Bind(config);
+ services.AddSingleton(config);
+ return config;
+ }
- public static IServiceCollection AddConfigEf(this IServiceCollection services, ConfigurationManager configuration)
- {
- var connectionString = configuration["ConnectionString"];
- services.AddDbContext(x =>
- x.UseSqlServer(connectionString));
- return services;
- }
+ public static IServiceCollection AddConfigEf(this IServiceCollection services, ConfigurationManager configuration)
+ {
+ var connectionString = configuration["ConnectionString"];
+ services.AddDbContext(x =>
+ x.UseSqlServer(connectionString));
+ return services;
+ }
- public static IServiceCollection AddInfrastructure(this IServiceCollection services)
- {
- //services.AddSingleton();
+ public static IServiceCollection AddInfrastructure(this IServiceCollection services)
+ {
+ //services.AddSingleton();
- services.Scan(scan =>
- scan
- .FromAssembliesOf(typeof(CGenDbContext))
- .AddClasses(classes => classes.AssignableTo(typeof(IRepository<>)))
- .AsImplementedInterfaces()
- .WithScopedLifetime()
- .AddClasses(classes => classes.AssignableTo(typeof(IQueryHandler<,>)))
- .AsImplementedInterfaces()
- .WithScopedLifetime()
- );
+ services.Scan(scan =>
+ scan
+ .FromAssembliesOf(typeof(CGenDbContext))
+ .AddClasses(classes => classes.AssignableTo(typeof(IRepository<>)))
+ .AsImplementedInterfaces()
+ .WithScopedLifetime()
+ .AddClasses(classes => classes.AssignableTo(typeof(IQueryHandler<,>)))
+ .AsImplementedInterfaces()
+ .WithScopedLifetime()
+ );
- // without Scrutor (or an alternative) we'd need to do everything by hand, like:
- /*
- services.AddScoped, EfRepository>();
- services.AddScoped, EfRepository>();
- services.AddScoped>, UserGroupsQueryHandler>();
- services.AddScoped, UserGroupQueryHandler>();
- // ...
- */
- return services;
- }
+ // without Scrutor (or an alternative) we'd need to do everything by hand, like:
+ /*
+ services.AddScoped, EfRepository>();
+ services.AddScoped, EfRepository>();
+ services.AddScoped>, UserGroupsQueryHandler>();
+ services.AddScoped, UserGroupQueryHandler>();
+ // ...
+ */
+ return services;
}
-
-}
-
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Logging/ElasticJsonFormatter.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Logging/ElasticJsonFormatter.cs
index 57a6457c..d3d431c5 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Logging/ElasticJsonFormatter.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Logging/ElasticJsonFormatter.cs
@@ -2,5 +2,4 @@ namespace O2NextGen.CertificateManagement.Application.Logging;
public class ElasticJsonFormatter
{
-
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj
index 0aec1770..309fb465 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj
@@ -1,56 +1,68 @@
-
- net6.0
- disable
- enable
-
+
+ net6.0
+ disable
+ enable
+
-
-
-
-
-
-
-
-
-
-
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Program.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Program.cs
index b14b74a0..ff90ade8 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Program.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Program.cs
@@ -1,4 +1,7 @@
-using O2NextGen.CertificateManagement.Application;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.OpenApi.Models;
+using O2NextGen.CertificateManagement.Application;
+using O2NextGen.CertificateManagement.Application.Helpers;
using O2NextGen.CertificateManagement.Application.IoC;
using O2NextGen.CertificateManagement.Infrastructure.Data;
using O2NextGen.CertificateManagement.StartupTasks.DatabaseInitializer;
@@ -10,7 +13,46 @@
// Add services to the container.
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
-builder.Services.AddSwaggerGen();
+builder.Services.AddApiVersioning(o =>
+{
+ o.ReportApiVersions = true;
+ o.AssumeDefaultVersionWhenUnspecified = true;
+ o.DefaultApiVersion = new ApiVersion(1, 0);
+});
+
+builder.Services.AddCustomIntegrations(configuration);
+
+builder.Services.AddSwaggerGen(options =>
+{
+ options.SwaggerDoc("v1.1",
+ new OpenApiInfo
+ {
+ Title = "Versioned Api v1.1", Version = "v1.1"
+ });
+ options.SwaggerDoc("v1.0",
+ new OpenApiInfo
+ {
+ Title = "Versioned Api v1.0",
+ Version = "v1.0"
+ }
+ );
+ options.DescribeAllParametersInCamelCase();
+
+ // Apply the filters
+ options.OperationFilter();
+ options.DocumentFilter();
+
+ options.DocInclusionPredicate((docName, apiDesc) =>
+ {
+ var actionApiVersionModel = apiDesc.ActionDescriptor?.GetApiVersion();
+
+ if (actionApiVersionModel == null) return true;
+
+ return actionApiVersionModel.DeclaredApiVersions.Any()
+ ? actionApiVersionModel.DeclaredApiVersions.Any(v => $"v{v.ToString()}" == docName)
+ : actionApiVersionModel.ImplementedApiVersions.Any(v => $"v{v.ToString()}" == docName);
+ });
+});
builder.Services
.AddConfigEf(configuration)
.AddDatabaseInitializer()
@@ -21,16 +63,20 @@
var scope = app.Services.CreateScope();
var context = scope.ServiceProvider.GetRequiredService();
-SeedData.SeedAsync(context).Wait();
+SeedData.SeedAsync(context, configuration).Wait();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
-
-
}
+
app.UseSwagger();
-app.UseSwaggerUI();
+app.UseSwaggerUI(options =>
+{
+ options.SwaggerEndpoint("/swagger/v1.1/swagger.json", "O2Certificate Management API V1.1");
+ options.SwaggerEndpoint("/swagger/v1.0/swagger.json", "O2Certificate Management API V1.0");
+ //options.OAuthClientId("swaggerca");
+});
app.Use(async (context, next) =>
{
context.Response.OnStarting(() =>
@@ -50,3 +96,6 @@
app.Run();
+public partial class Program
+{
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/SeedData.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/SeedData.cs
index 00686c2c..8c384c4a 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/SeedData.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/SeedData.cs
@@ -7,30 +7,34 @@ namespace O2NextGen.CertificateManagement.Application;
public class SeedData
{
- public static async Task SeedAsync(CGenDbContext context)
+ public static async Task SeedAsync(CGenDbContext context, ConfigurationManager configuration)
{
- context.Database.Migrate();
-
- if (!context.Categories.Any())
- {
- context.Categories.AddRange(
- GetPreconfiguredCategories());
- await context.SaveChangesAsync();
- }
-
- if (!context.Certificates.Any())
+ // context.Database.EnsureDeleted();
+ if (bool.Parse(configuration["IsTests"]) == false)
{
- context.Certificates.AddRange(
- GetPreconfiguredCertificates(context));
- await context.SaveChangesAsync();
+ await context.Database.MigrateAsync();
+
+ if (!context.Categories.Any())
+ {
+ context.Categories.AddRange(
+ GetPreconfiguredCategories());
+ await context.SaveChangesAsync();
+ }
+
+ if (!context.Certificates.Any())
+ {
+ context.Certificates.AddRange(
+ GetPreconfiguredCertificates(context));
+ await context.SaveChangesAsync();
+ }
}
}
private static Certificate[] GetPreconfiguredCertificates(CGenDbContext cGenDbContext)
{
- return new Certificate[]
+ return new[]
{
- new Certificate()
+ new()
{
Category = cGenDbContext.Categories.FirstOrDefault(),
CustomerId = Guid.NewGuid().ToString(),
@@ -40,7 +44,7 @@ private static Certificate[] GetPreconfiguredCertificates(CGenDbContext cGenDbCo
CreatorId = Guid.NewGuid().ToString(),
ExpiredDate = DateTime.Now.AddYears(1).ConvertToUnixTime()
},
- new Certificate()
+ new Certificate
{
Category = cGenDbContext.Categories.FirstOrDefault(),
CustomerId = Guid.NewGuid().ToString(),
@@ -50,7 +54,7 @@ private static Certificate[] GetPreconfiguredCertificates(CGenDbContext cGenDbCo
CreatorId = Guid.NewGuid().ToString(),
ExpiredDate = DateTime.Now.AddYears(1).ConvertToUnixTime()
},
- new Certificate()
+ new Certificate
{
Category = cGenDbContext.Categories.FirstOrDefault(),
CustomerId = Guid.NewGuid().ToString(),
@@ -60,7 +64,7 @@ private static Certificate[] GetPreconfiguredCertificates(CGenDbContext cGenDbCo
CreatorId = Guid.NewGuid().ToString(),
ExpiredDate = DateTime.Now.AddYears(1).ConvertToUnixTime()
},
- new Certificate()
+ new Certificate
{
Category = cGenDbContext.Categories.FirstOrDefault(),
CustomerId = Guid.NewGuid().ToString(),
@@ -71,7 +75,7 @@ private static Certificate[] GetPreconfiguredCertificates(CGenDbContext cGenDbCo
ExpiredDate = DateTime.Now.AddYears(1).ConvertToUnixTime()
},
- new Certificate()
+ new Certificate
{
Category = cGenDbContext.Categories.FirstOrDefault(),
CustomerId = Guid.NewGuid().ToString(),
@@ -86,15 +90,16 @@ private static Certificate[] GetPreconfiguredCertificates(CGenDbContext cGenDbCo
private static Category[] GetPreconfiguredCategories()
{
- return new Category[] {
- new Category()
+ return new[]
+ {
+ new()
{
CategoryName = "AA Category",
CategorySeries = "A",
CategoryDescription = "desc category A",
QuantityCertificates = 120
},
- new Category()
+ new Category
{
CategoryName = "B Category",
CategorySeries = "B",
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/CustomerService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/CustomerService.cs
index ca96efca..5c024d57 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/CustomerService.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/CustomerService.cs
@@ -1,19 +1,17 @@
-namespace O2NextGen.CertificateManagement.Application.Services
-{
- public class CustomerService : ICustomerService
- {
- // ReSharper disable once NotAccessedField.Local
- private IHttpContextAccessor _context;
+namespace O2NextGen.CertificateManagement.Application.Services;
- public CustomerService(IHttpContextAccessor context)
- {
- _context = context ?? throw new ArgumentNullException(nameof(context));
- }
+public class CustomerService : ICustomerService
+{
+ // ReSharper disable once NotAccessedField.Local
+ private IHttpContextAccessor _context;
- public Guid CustomerId { get; } = Guid.Parse("A6D86517-CF70-4EEF-8340-BCBAA4B60C4A");
- public string CustomerDescription { get; set; } = "#PF_R Community";
- public string RegisterLink { get; set; } = "https://pfr-centr.com";
- public string AccountLink { get; set; } = "https://pfr-centr.com";
+ public CustomerService(IHttpContextAccessor context)
+ {
+ _context = context ?? throw new ArgumentNullException(nameof(context));
}
-}
+ public Guid CustomerId { get; } = Guid.Parse("A6D86517-CF70-4EEF-8340-BCBAA4B60C4A");
+ public string CustomerDescription { get; set; } = "#PF_R Community";
+ public string RegisterLink { get; set; } = "https://pfr-centr.com";
+ public string AccountLink { get; set; } = "https://pfr-centr.com";
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/ICustomerService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/ICustomerService.cs
index 4921d27c..32e16564 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/ICustomerService.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/ICustomerService.cs
@@ -1,11 +1,16 @@
-namespace O2NextGen.CertificateManagement.Application.Services
-{
- public interface ICustomerService
+using System.Drawing;
+
+namespace O2NextGen.CertificateManagement.Application.Services;
+
+ public interface ITemplateService
{
- Guid CustomerId { get; }
- string CustomerDescription { get; set; }
- string RegisterLink { get; set; }
- string AccountLink { get; set; }
+ Image GetTemplate(long categoryModelId);
+ TemplateService.TemplateCertificate GetSettingsOtTemplate(long categoryModelId);
}
-}
-
+public interface ICustomerService
+{
+ Guid CustomerId { get; }
+ string CustomerDescription { get; set; }
+ string RegisterLink { get; set; }
+ string AccountLink { get; set; }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IIdentityService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IIdentityService.cs
index 73f75c43..069938ae 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IIdentityService.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IIdentityService.cs
@@ -1,10 +1,8 @@
-namespace O2NextGen.CertificateManagement.Application.Services
-{
- public interface IIdentityService
- {
- string GetUserIdentity();
+namespace O2NextGen.CertificateManagement.Application.Services;
- string GetUserName();
- }
-}
+public interface IIdentityService
+{
+ string GetUserIdentity();
+ string GetUserName();
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IKeyGenerator.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IKeyGenerator.cs
new file mode 100644
index 00000000..2f9eae9f
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IKeyGenerator.cs
@@ -0,0 +1,7 @@
+namespace O2NextGen.CertificateManagement.Application.Services;
+
+public interface IKeyGenerator
+{
+ string Generate(int length);
+ bool Validate(int maxLength, string key);
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IQrCodeService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IQrCodeService.cs
new file mode 100644
index 00000000..1f25b20b
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IQrCodeService.cs
@@ -0,0 +1,8 @@
+using System.Drawing;
+
+namespace O2NextGen.CertificateManagement.Application.Services;
+
+public interface IQrCodeService
+{
+ Task GetQrCodeBasicCertificate(long certificateId, int sizeQrCode);
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IViewModel.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IViewModel.cs
new file mode 100644
index 00000000..31c4c100
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IViewModel.cs
@@ -0,0 +1,11 @@
+namespace O2NextGen.CertificateManagement.Application.Services;
+
+public interface IViewModel
+{
+ long Id { get; set; }
+ string ExternalId { get; set; }
+ long? ModifiedDate { get; set; }
+ long? AddedDate { get; set; }
+ long? DeletedDate { get; set; }
+ bool? IsDeleted { get; set; }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IdentityService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IdentityService.cs
index 67a65962..bdf8392c 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IdentityService.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IdentityService.cs
@@ -1,23 +1,21 @@
-namespace O2NextGen.CertificateManagement.Application.Services
-{
- public class IdentityService : IIdentityService
- {
- private IHttpContextAccessor _context;
+namespace O2NextGen.CertificateManagement.Application.Services;
- public IdentityService(IHttpContextAccessor context)
- {
- _context = context ?? throw new ArgumentNullException(nameof(context));
- }
+public class IdentityService : IIdentityService
+{
+ private readonly IHttpContextAccessor _context;
- public string GetUserIdentity()
- {
- return _context.HttpContext.User.FindFirst("sub").Value;
- }
+ public IdentityService(IHttpContextAccessor context)
+ {
+ _context = context ?? throw new ArgumentNullException(nameof(context));
+ }
- public string GetUserName()
- {
- return _context.HttpContext.User.Identity.Name;
- }
+ public string GetUserIdentity()
+ {
+ return _context.HttpContext.User.FindFirst("sub").Value;
}
-}
+ public string GetUserName()
+ {
+ return _context.HttpContext.User.Identity.Name;
+ }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/IntegrationTests.O2NextGen.CertificateManagement.Application.v3.ncrunchproject b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IntegrationTests.O2NextGen.CertificateManagement.Application.v3.ncrunchproject
similarity index 100%
rename from src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/IntegrationTests.O2NextGen.CertificateManagement.Application.v3.ncrunchproject
rename to src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/IntegrationTests.O2NextGen.CertificateManagement.Application.v3.ncrunchproject
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/KeyGenerator.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/KeyGenerator.cs
new file mode 100644
index 00000000..62061a37
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/KeyGenerator.cs
@@ -0,0 +1,47 @@
+using O2NextGen.CertificateManagement.Application.Template;
+
+namespace O2NextGen.CertificateManagement.Application.Services;
+
+public class KeyGenerator:
+ Singleton, IKeyGenerator
+{
+ // private const string ValidChars = "abcdefghjkmnprstwxz2345789"; // Letters and numbers that are not easily mixed with others when reading
+ private const string ValidChars = "ABCDEFHJKLMNPRSTUWXYZ012345789";
+ private static readonly Dictionary ValidCharLookup = new Dictionary();
+ private static readonly Random Rnd = new Random();
+
+ static KeyGenerator()
+ {
+ // Set up a quick lookup dictionary for all valid characters
+ foreach (var c in ValidChars.ToUpperInvariant())
+ ValidCharLookup.Add(c, true);
+ }
+
+ public string Generate(int length)
+ {
+ var ret = new char[length];
+ for (var i = 0; i < length; i++)
+ {
+ int c;
+ lock (Rnd)
+ {
+ c = Rnd.Next(0, ValidChars.Length);
+ }
+
+ ret[i] = ValidChars[c];
+ }
+
+ return new string(ret);
+ }
+
+ public bool Validate(int maxLength, string key)
+ {
+ if (key.Length > maxLength)
+ return false;
+
+ foreach (var c in key.ToUpperInvariant())
+ if (!ValidCharLookup.ContainsKey(c))
+ return false;
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/QrCodeService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/QrCodeService.cs
new file mode 100644
index 00000000..136ab51f
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/QrCodeService.cs
@@ -0,0 +1,42 @@
+using System.Drawing;
+using Microsoft.Extensions.Options;
+using O2NextGen.Sdk.NetCore.Extensions;
+
+namespace O2NextGen.CertificateManagement.Application.Services;
+
+public class QrCodeService : IQrCodeService
+{
+ private readonly IOptions _config;
+ private readonly HttpClient _httpClient;
+
+ public QrCodeService(HttpClient httpClient, IOptions config)
+ {
+ _httpClient = httpClient;
+ _config = config;
+ }
+
+ public async Task GetQrCodeBasicCertificate(long certificateId, int sizeQrCode)
+ {
+ var timeFile = DateTime.Now.ConvertToUnixTime();
+ var rootDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
+ var response =
+ await _httpClient.GetAsync(_config.Value.CGenUrl + $"/api/v1.0/qrcode/qrcode-basic?size=" + sizeQrCode);
+ //Log.Debug("get users: {response}", response);
+ //Directory.SetCurrentDirectory(rootDir);
+ if (!Directory.Exists("Cache"))
+ {
+ Directory.CreateDirectory("Cache");
+ }
+
+ var randomId = new Random(1000);
+ await response.Content.ReadAsFileAsync(@"Cache\certificate" + "_" + timeFile + "_" + randomId + ".jpg", true);
+ var image = Image.FromFile(@"Cache\certificate" + "_" + timeFile + "_" + randomId + ".jpg");
+ //await Task.Factory.StartNew(() =>
+ //{
+ // File.Delete(@"Cache\certificate" + "_" + timeFile + "_" + randomId + ".jpg");
+ //});
+
+ //var obj = JsonConvert.DeserializeObject>(json);
+ return image;
+ }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/TemplateService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/TemplateService.cs
new file mode 100644
index 00000000..982addd7
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Services/TemplateService.cs
@@ -0,0 +1,159 @@
+using System.Drawing;
+using Microsoft.Extensions.Options;
+using O2NextGen.Sdk.NetCore.Extensions;
+
+namespace O2NextGen.CertificateManagement.Application.Services;
+
+public abstract class TemplateService : ITemplateService
+{
+ public enum ElementType
+ {
+ QrCode,
+ Text,
+ SpecialNumber,
+ Signature,
+ Stamp
+ }
+
+ private readonly IOptions _config;
+ private readonly HttpClient _httpClient;
+
+ protected TemplateService(HttpClient httpClient, IOptions config)
+ {
+ _httpClient = httpClient;
+ _config = config;
+ }
+
+ public Image GetTemplate(long categoryModelId)
+ {
+ return categoryModelId switch
+ {
+ //Todo: Int to Guid (this is bug)
+ 1 => Image.FromFile("Files/Templates/Certificates/A/pft_template_cert.png"),
+ 2 => Image.FromFile("Files/Templates/Certificates/AA/certificate-ab_ru.png"),
+ 3 => Image.FromFile("Files/Templates/Certificates/AB/certificate-bb_ru.png"),
+ 4 => Image.FromFile("Files/Templates/Certificates/B/pfr_template_cert_b_ru.png"),
+ 5 => Image.FromFile("Files/Templates/Certificates/BB/certificate-b2_ru.png"),
+ _ => null
+ };
+ }
+
+ public TemplateCertificate GetSettingsOtTemplate(long categoryModelId)
+ {
+ var templates = new List
+ {
+ new TemplateCertificate
+ {
+ CategoryId = 2,
+ Items = new List
+ {
+ new TemplateConfig
+ {
+ Id = 1,
+ ExternalId = KeyGenerator.Instance.Generate(9),
+ ModifiedDate = DateTime.Now.ConvertToUnixTime(),
+ AddedDate = DateTime.Now.ConvertToUnixTime(),
+ ElementType = ElementType.Text,
+ PointY = 1150
+ },
+ new TemplateConfig
+ {
+ Id = 1,
+ ExternalId = KeyGenerator.Instance.Generate(9),
+ ModifiedDate = DateTime.Now.ConvertToUnixTime(),
+ AddedDate = DateTime.Now.ConvertToUnixTime(),
+ ElementType = ElementType.SpecialNumber,
+ PointY = 2204
+ },
+ new TemplateConfig
+ {
+ Id = 3,
+ ExternalId = KeyGenerator.Instance.Generate(9),
+ ModifiedDate = DateTime.Now.ConvertToUnixTime(),
+ AddedDate = DateTime.Now.ConvertToUnixTime(),
+ ElementType = ElementType.QrCode,
+ PointY = 2654,
+ PointX = 1600,
+ Width = 320
+ },
+ new TemplateConfig
+ {
+ Id = 4,
+ ExternalId = KeyGenerator.Instance.Generate(9),
+ ModifiedDate = DateTime.Now.ConvertToUnixTime(),
+ AddedDate = DateTime.Now.ConvertToUnixTime(),
+ ElementType = ElementType.QrCode,
+ PointY = 2654,
+ PointX = 1900,
+ Width = 320
+ }
+ }
+ },
+ new TemplateCertificate
+ {
+ CategoryId = 1,
+ Items = new List
+ {
+ new TemplateConfig
+ {
+ Id = 5,
+ ExternalId = KeyGenerator.Instance.Generate(9),
+ ModifiedDate = DateTime.Now.ConvertToUnixTime(),
+ AddedDate = DateTime.Now.ConvertToUnixTime(),
+ ElementType = ElementType.Text,
+ PointY = 1550
+ },
+
+ new TemplateConfig
+ {
+ Id = 6,
+ ExternalId = KeyGenerator.Instance.Generate(9),
+ ModifiedDate = DateTime.Now.ConvertToUnixTime(),
+ AddedDate = DateTime.Now.ConvertToUnixTime(),
+ ElementType = ElementType.QrCode,
+ PointY = 2901,
+ PointX = 1070,
+ Width = 400
+ },
+ new TemplateConfig
+ {
+ Id = 7,
+ ExternalId = KeyGenerator.Instance.Generate(9),
+ ModifiedDate = DateTime.Now.ConvertToUnixTime(),
+ AddedDate = DateTime.Now.ConvertToUnixTime(),
+ ElementType = ElementType.SpecialNumber,
+ PointY = 2727
+ }
+ }
+ }
+ };
+
+ return templates.Single(x => x.CategoryId == categoryModelId);
+ }
+
+ public class TemplateCertificate
+ {
+ public List Items { get; set; }
+ public long CategoryId { get; set; }
+ }
+
+
+ public class TemplateConfig : IViewModel
+ {
+ public ElementType ElementType { get; set; }
+ public int PointX { get; set; }
+ public int PointY { get; set; }
+ public int Width { get; set; }
+ public long Id { get; set; }
+
+ #region Basic fields
+
+ public string ExternalId { get; set; }
+ public long? ModifiedDate { get; set; }
+ public long? AddedDate { get; set; }
+ public long? DeletedDate { get; set; }
+ public bool? IsDeleted { get; set; }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Template/Singleton.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Template/Singleton.cs
new file mode 100644
index 00000000..485b2cc6
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Template/Singleton.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+
+namespace O2NextGen.CertificateManagement.Application.Template;
+
+public class Singleton where T : class
+{
+ private static T _instance;
+
+ protected Singleton()
+ {
+ }
+
+ private static T CreateInstance()
+ {
+ var cInfo = typeof(T).GetConstructor(
+ BindingFlags.Instance | BindingFlags.NonPublic,
+ null,
+ new Type[0],
+ new ParameterModifier[0]);
+
+ return (T)cInfo.Invoke(null);
+ }
+
+ public static T Instance
+ {
+ get
+ {
+ if (_instance == null)
+ {
+ _instance = CreateInstance();
+ }
+
+ return _instance;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/ServiceUrls.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/UrlsConfig.cs
similarity index 76%
rename from src/Services/c-gen/O2NextGen.CertificateManagement.Application/ServiceUrls.cs
rename to src/Services/c-gen/O2NextGen.CertificateManagement.Application/UrlsConfig.cs
index 81148220..e21719e8 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/ServiceUrls.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/UrlsConfig.cs
@@ -1,8 +1,8 @@
namespace O2NextGen.CertificateManagement.Application;
-public class ServiceUrls: IServiceUrl
+public class UrlsConfig : IUrlsConfig
{
public string IdentityUrl { get; set; }
-
+
public string CGenUrl { get; set; }
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.Development.json b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.Development.json
index 43bc444f..d7209ff6 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.Development.json
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.Development.json
@@ -9,7 +9,7 @@
"Microsoft.AspNetCore": "Information"
}
},
- "Urls": {
+ "UrlsConfig": {
"Auth": "http://localhost:10001"
}
}
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.Tests.json b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.Tests.json
new file mode 100644
index 00000000..c2d96b50
--- /dev/null
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.Tests.json
@@ -0,0 +1,18 @@
+{
+ "DatabaseInitializerSettings": {
+ "Initialize": true
+ },
+ "IsTests": "true",
+ "ConnectionString": "Server=52.185.108.164;Initial Catalog=O2NextGen.CertificateDb-Tests;Persist Security Info=False;User ID=sa;Password=yourStrong(!)Password;Connection Timeout=30;",
+ "Urls": {
+ "Auth": "http://localhost:10001"
+ },
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Information"
+ }
+ },
+ "AllowedHosts": "*"
+}
+
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.json b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.json
index bcc9a7da..0cf18173 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.json
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.json
@@ -1,4 +1,5 @@
{
+ "IsTests": "false",
"DatabaseInitializerSettings": {
"Initialize": true
},
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Business/O2NextGen.CertificateManagement.Business.csproj b/src/Services/c-gen/O2NextGen.CertificateManagement.Business/O2NextGen.CertificateManagement.Business.csproj
index e012af3e..79ae02b8 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Business/O2NextGen.CertificateManagement.Business.csproj
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Business/O2NextGen.CertificateManagement.Business.csproj
@@ -1,13 +1,13 @@
-
- net6.0
-
+
+ net6.0
+
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Data/O2NextGen.CertificateManagement.Data.csproj b/src/Services/c-gen/O2NextGen.CertificateManagement.Data/O2NextGen.CertificateManagement.Data.csproj
index d5302b71..82073925 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Data/O2NextGen.CertificateManagement.Data.csproj
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Data/O2NextGen.CertificateManagement.Data.csproj
@@ -1,15 +1,15 @@
-
- net6.0
-
+
+ net6.0
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IEntity.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IEntity.cs
index b04a206a..43f184ee 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IEntity.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IEntity.cs
@@ -1,7 +1,5 @@
-namespace O2NextGen.CertificateManagement.Domain.Data
-{
- public interface IEntity
- {
- }
-}
+namespace O2NextGen.CertificateManagement.Domain.Data;
+public interface IEntity
+{
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IQuery.cs
index 9b2f9689..197da543 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IQuery.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IQuery.cs
@@ -1,8 +1,5 @@
-namespace O2NextGen.CertificateManagement.Domain.Data
-{
- public interface IQuery
- {
-
- }
-}
+namespace O2NextGen.CertificateManagement.Domain.Data;
+public interface IQuery
+{
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IQueryHandler.cs
index ce841088..e149570a 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IQueryHandler.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IQueryHandler.cs
@@ -1,11 +1,6 @@
-using System.Threading;
-using System.Threading.Tasks;
+namespace O2NextGen.CertificateManagement.Domain.Data;
-namespace O2NextGen.CertificateManagement.Domain.Data
+public interface IQueryHandler where TQuery : IQuery
{
- public interface IQueryHandler where TQuery : IQuery
- {
- Task HandleAsync(TQuery query, CancellationToken ct);
- }
-}
-
+ Task HandleAsync(TQuery query, CancellationToken ct);
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IRepository.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IRepository.cs
index ad19cffd..8864738d 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IRepository.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IRepository.cs
@@ -1,13 +1,8 @@
-using System.Threading;
-using System.Threading.Tasks;
+namespace O2NextGen.CertificateManagement.Domain.Data;
-namespace O2NextGen.CertificateManagement.Domain.Data
+public interface IRepository
{
- public interface IRepository
- {
- Task AddAsync(T entity, CancellationToken ct);
- Task UpdateAsync(T entity, CancellationToken ct);
- Task DeleteAsync(T entity, CancellationToken ct);
- }
-}
-
+ Task AddAsync(T entity, CancellationToken ct);
+ Task UpdateAsync(T entity, CancellationToken ct);
+ Task DeleteAsync(T entity, CancellationToken ct);
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CategoriesQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CategoriesQuery.cs
index c152c550..fc55361e 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CategoriesQuery.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CategoriesQuery.cs
@@ -1,11 +1,7 @@
-using System.Collections.Generic;
-using O2NextGen.CertificateManagement.Domain.Entities;
+using O2NextGen.CertificateManagement.Domain.Entities;
-namespace O2NextGen.CertificateManagement.Domain.Data.Queries
-{
- public class CategoriesQuery : IQuery>
- {
-
- }
-}
+namespace O2NextGen.CertificateManagement.Domain.Data.Queries;
+public class CategoriesQuery : IQuery>
+{
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CategoryQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CategoryQuery.cs
index 50c70be8..cbce93fc 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CategoryQuery.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CategoryQuery.cs
@@ -1,18 +1,17 @@
-namespace O2NextGen.CertificateManagement.Domain.Data.Queries
-{
- public class CategoryQuery : IQuery
- {
- public long Id { get; set; }
- public string CategoryName { get; set; }
- public int QuantityCertificates { get; set; }
- public string CategoryDescription { get; set; }
- public string CategorySeries { get; set; }
+using O2NextGen.CertificateManagement.Domain.Entities;
- public CategoryQuery(long id)
- {
- Id = id;
- }
+namespace O2NextGen.CertificateManagement.Domain.Data.Queries;
+public class CategoryQuery : IQuery
+{
+ public CategoryQuery(long id)
+ {
+ Id = id;
}
-}
+ public long Id { get; set; }
+ public string CategoryName { get; set; }
+ public int QuantityCertificates { get; set; }
+ public string CategoryDescription { get; set; }
+ public string CategorySeries { get; set; }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificateQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificateQuery.cs
index 1ac47ad2..b666c090 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificateQuery.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificateQuery.cs
@@ -1,50 +1,47 @@
-using System.Collections.Generic;
-using O2NextGen.CertificateManagement.Domain.Entities;
+using O2NextGen.CertificateManagement.Domain.Entities;
-namespace O2NextGen.CertificateManagement.Domain.Data.Queries
+namespace O2NextGen.CertificateManagement.Domain.Data.Queries;
+
+public class CertificateQuery : IQuery
{
- public class CertificateQuery : IQuery
+ public CertificateQuery(long id)
{
- public CertificateQuery(long id)
- {
- Id = id;
- }
-
- public CertificateQuery(string externalId, bool? isDeleted, string customerId, long expiredDate, long publishDate,
- string creatorId, string publishCode, bool isVisible, long categoryId, Category category,
- bool @lock, long lockedDate, string lockInfo, ICollection languageInfos)
- {
- ExternalId = externalId;
- IsDeleted = isDeleted;
- CustomerId = customerId;
- ExpiredDate = expiredDate;
- PublishDate = publishDate;
- CreatorId = creatorId;
- PublishCode = publishCode;
- IsVisible = isVisible;
- CategoryId = categoryId;
- Category = category;
- Lock = @lock;
- LockedDate = lockedDate;
- LockInfo = lockInfo;
- LanguageInfos = languageInfos;
- }
+ Id = id;
+ }
- public long Id { get; }
- public string ExternalId { get; }
- public bool? IsDeleted { get; }
- public string CustomerId { get; }
- public long ExpiredDate { get; }
- public long PublishDate { get; }
- public string CreatorId { get; }
- public string PublishCode { get; }
- public bool IsVisible { get; }
- public long CategoryId { get; }
- public Category Category { get; }
- public bool Lock { get; }
- public long LockedDate { get; }
- public string LockInfo { get; }
- public ICollection LanguageInfos { get; }
+ public CertificateQuery(string externalId, bool? isDeleted, string customerId, long expiredDate, long publishDate,
+ string creatorId, string publishCode, bool isVisible, long categoryId, Category category,
+ bool @lock, long lockedDate, string lockInfo, ICollection languageInfos)
+ {
+ ExternalId = externalId;
+ IsDeleted = isDeleted;
+ CustomerId = customerId;
+ ExpiredDate = expiredDate;
+ PublishDate = publishDate;
+ CreatorId = creatorId;
+ PublishCode = publishCode;
+ IsVisible = isVisible;
+ CategoryId = categoryId;
+ Category = category;
+ Lock = @lock;
+ LockedDate = lockedDate;
+ LockInfo = lockInfo;
+ LanguageInfos = languageInfos;
}
-}
+ public long Id { get; }
+ public string ExternalId { get; }
+ public bool? IsDeleted { get; }
+ public string CustomerId { get; }
+ public long ExpiredDate { get; }
+ public long PublishDate { get; }
+ public string CreatorId { get; }
+ public string PublishCode { get; }
+ public bool IsVisible { get; }
+ public long CategoryId { get; }
+ public Category Category { get; }
+ public bool Lock { get; }
+ public long LockedDate { get; }
+ public string LockInfo { get; }
+ public ICollection LanguageInfos { get; }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificatesQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificatesQuery.cs
index ccc4d174..db905f54 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificatesQuery.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificatesQuery.cs
@@ -1,11 +1,7 @@
-using System.Collections.Generic;
-using O2NextGen.CertificateManagement.Domain.Entities;
+using O2NextGen.CertificateManagement.Domain.Entities;
-namespace O2NextGen.CertificateManagement.Domain.Data.Queries
-{
- public class CertificatesQuery : IQuery>
- {
-
- }
-}
+namespace O2NextGen.CertificateManagement.Domain.Data.Queries;
+public class CertificatesQuery : IQuery>
+{
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/Category.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/Category.cs
index 9312d93f..89ee944d 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/Category.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/Category.cs
@@ -1,19 +1,18 @@
-namespace O2NextGen.CertificateManagement.Domain.Entities
+namespace O2NextGen.CertificateManagement.Domain.Entities;
+
+public class Category
{
- public class Category
- {
- public long Id { get; set; }
- public long ModifiedDate { get; set; }
- public long AddedDate { get; set; }
- public long? DeletedDate { get; set; }
- public bool? IsDeleted { get; set; }
+ public long Id { get; set; }
+ public long ModifiedDate { get; set; }
+ public long AddedDate { get; set; }
+ public long? DeletedDate { get; set; }
+ public bool? IsDeleted { get; set; }
- public string CustomerId { get; set; }
- public string CategorySeries { get; set; }
- public int QuantityCertificates { get; set; }
- public int QuantityPublishCode { get; set; }
- public string CategoryName { get; set; }
- public string CategoryDescription { get; set; }
- public int TimeLifeInDays { get; set; }
- }
+ public string CustomerId { get; set; }
+ public string CategorySeries { get; set; }
+ public int QuantityCertificates { get; set; }
+ public int QuantityPublishCode { get; set; }
+ public string CategoryName { get; set; }
+ public string CategoryDescription { get; set; }
+ public int TimeLifeInDays { get; set; }
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/Certificate.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/Certificate.cs
index ed5e2920..a55a0cb9 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/Certificate.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/Certificate.cs
@@ -1,30 +1,27 @@
-using System.Collections.Generic;
+namespace O2NextGen.CertificateManagement.Domain.Entities;
-namespace O2NextGen.CertificateManagement.Domain.Entities
+public class Certificate
{
- public class Certificate
- {
- public long Id { get; set; }
- public string ExternalId { get; set; }
- public long ModifiedDate { get; set; }
- public long AddedDate { get; set; }
- public long? DeletedDate { get; set; }
- public bool? IsDeleted { get; set; }
+ public long Id { get; set; }
+ public string ExternalId { get; set; }
+ public long ModifiedDate { get; set; }
+ public long AddedDate { get; set; }
+ public long? DeletedDate { get; set; }
+ public bool? IsDeleted { get; set; }
- public string OwnerAccountId { get; set; }
- public string CustomerId { get; set; }
- public long ExpiredDate { get; set; }
- public long PublishDate { get; set; }
- public string CreatorId { get; set; }
- public string PublishCode { get; set; }
- public bool IsVisible { get; set; }
+ public string OwnerAccountId { get; set; }
+ public string CustomerId { get; set; }
+ public long ExpiredDate { get; set; }
+ public long PublishDate { get; set; }
+ public string CreatorId { get; set; }
+ public string PublishCode { get; set; }
+ public bool IsVisible { get; set; }
- public long CategoryId { get; set; }
- public Category Category { get; set; }
- public bool Lock { get; set; }
- public long LockedDate { get; set; }
- public string LockInfo { get; set; }
+ public long CategoryId { get; set; }
+ public Category Category { get; set; }
+ public bool Lock { get; set; }
+ public long LockedDate { get; set; }
+ public string LockInfo { get; set; }
- public ICollection LanguageInfos { get; set; } = new List();
- }
+ public ICollection LanguageInfos { get; set; } = new List();
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/LanguageInfo.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/LanguageInfo.cs
index 606549f3..dd231365 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/LanguageInfo.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/LanguageInfo.cs
@@ -1,18 +1,17 @@
-namespace O2NextGen.CertificateManagement.Domain.Entities
+namespace O2NextGen.CertificateManagement.Domain.Entities;
+
+public class LanguageInfo
{
- public class LanguageInfo
- {
- public long Id { get; set; }
- public long ModifiedDate { get; set; }
- public long AddedDate { get; set; }
- public long? DeletedDate { get; set; }
- public bool? IsDeleted { get; set; }
+ public long Id { get; set; }
+ public long ModifiedDate { get; set; }
+ public long AddedDate { get; set; }
+ public long? DeletedDate { get; set; }
+ public bool? IsDeleted { get; set; }
- public long CertificateId { get; set; }
- public int LanguageId { get; set; }
- public Certificate Certificate { get; set; }
- public string Lastname { get; set; }
- public string Firstname { get; set; }
- public string Middlename { get; set; }
- }
+ public long CertificateId { get; set; }
+ public int LanguageId { get; set; }
+ public Certificate Certificate { get; set; }
+ public string Lastname { get; set; }
+ public string Firstname { get; set; }
+ public string Middlename { get; set; }
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Mappings/MappingExtensions.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Mappings/MappingExtensions.cs
index 6bba06fd..ccd792a3 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Mappings/MappingExtensions.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Mappings/MappingExtensions.cs
@@ -1,45 +1,37 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
+using System.Collections.ObjectModel;
-namespace O2NextGen.CertificateManagement.Domain.Mappings
+namespace O2NextGen.CertificateManagement.Domain.Mappings;
+
+internal static class MappingExtensions
{
- internal static class MappingExtensions
+ public static IReadOnlyCollection MapAsReadOnly(this IEnumerable toMap, Func map)
{
- public static IReadOnlyCollection MapAsReadOnly(this IEnumerable toMap, Func map)
- {
- _ = toMap ?? throw new ArgumentNullException(nameof(toMap));
- _ = map ?? throw new ArgumentNullException(nameof(map));
+ _ = toMap ?? throw new ArgumentNullException(nameof(toMap));
+ _ = map ?? throw new ArgumentNullException(nameof(map));
- return toMap switch
- {
- IReadOnlyCollection readOnly => MapWithKnownCount(readOnly, readOnly.Count, map),
- ICollection collection => MapWithKnownCount(collection, collection.Count, map),
- _ => toMap.Select(map).ToList().AsReadOnly()
- };
- }
-
- private static IReadOnlyCollection MapWithKnownCount(
- IEnumerable collection,
- int count,
- Func map)
+ return toMap switch
{
- if (count == 0)
- {
- return Array.Empty();
- }
+ IReadOnlyCollection readOnly => MapWithKnownCount(readOnly, readOnly.Count, map),
+ ICollection collection => MapWithKnownCount(collection, collection.Count, map),
+ _ => toMap.Select(map).ToList().AsReadOnly()
+ };
+ }
- var result = new TOut[count];
- var i = 0;
- foreach (var entry in collection)
- {
- result[i] = map(entry);
- ++i;
- }
+ private static IReadOnlyCollection MapWithKnownCount(
+ IEnumerable collection,
+ int count,
+ Func map)
+ {
+ if (count == 0) return Array.Empty();
- return new ReadOnlyCollection(result);
+ var result = new TOut[count];
+ var i = 0;
+ foreach (var entry in collection)
+ {
+ result[i] = map(entry);
+ ++i;
}
- }
-}
+ return new ReadOnlyCollection(result);
+ }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj
index ad7caf94..bd9ce46f 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj
@@ -1,36 +1,36 @@
-
- net6.0
- enable
- disable
-
+
+ net6.0
+ enable
+ disable
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommand.cs
index 6f93316c..601d16d9 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommand.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommand.cs
@@ -1,30 +1,29 @@
using MediatR;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.CreateCategory
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.CreateCategory;
+
+public class CreateCategoryCommand : IRequest
{
- public class CreateCategoryCommand : IRequest
- {
- private readonly long _id;
+ private readonly long _id;
- public CreateCategoryCommand(string categoryName, int quantityCertificates,
- string categoryDescription, string categorySeries)
- {
- CategoryName = categoryName;
- QuantityCertificates = quantityCertificates;
- CategoryDescription = categoryDescription;
- CategorySeries = categorySeries;
- }
-
- public string CategoryName { get; }
- public string CategoryDescription { get; }
- public string CategorySeries { get; }
- public string CustomerId { get; internal set; }
- public long AddedDate { get; internal set; }
- public long ModifiedDate { get; internal set; }
- public long? DeletedDate { get; internal set; }
- public bool? IsDeleted { get; internal set; }
- public int TimeLifeInDays { get; internal set; }
- public int QuantityCertificates { get; }
- public int QuantityPublishCode { get; internal set; }
+ public CreateCategoryCommand(string categoryName, int quantityCertificates,
+ string categoryDescription, string categorySeries)
+ {
+ CategoryName = categoryName;
+ QuantityCertificates = quantityCertificates;
+ CategoryDescription = categoryDescription;
+ CategorySeries = categorySeries;
}
+
+ public string CategoryName { get; }
+ public string CategoryDescription { get; }
+ public string CategorySeries { get; }
+ public string CustomerId { get; internal set; }
+ public long AddedDate { get; internal set; }
+ public long ModifiedDate { get; internal set; }
+ public long? DeletedDate { get; internal set; }
+ public bool? IsDeleted { get; internal set; }
+ public int TimeLifeInDays { get; internal set; }
+ public int QuantityCertificates { get; }
+ public int QuantityPublishCode { get; internal set; }
}
\ 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/CreateCategoryCommandHandler.cs
index 6f0eebae..9d17400c 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/CreateCategoryCommandHandler.cs
@@ -1,53 +1,51 @@
-using System.Threading;
-using System.Threading.Tasks;
-using MediatR;
+using MediatR;
using O2NextGen.CertificateManagement.Domain.Data;
using O2NextGen.CertificateManagement.Domain.Entities;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.CreateCategory
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.CreateCategory;
+
+public class CreateCategoryCommandHandler : IRequestHandler
{
- public class CreateCategoryCommandHandler : IRequestHandler
- {
- private readonly IRepository categoryRepository;
+ private readonly IRepository categoryRepository;
- public CreateCategoryCommandHandler(IRepository categoryRepository)
- {
- this.categoryRepository = categoryRepository;
- }
+ public CreateCategoryCommandHandler(IRepository categoryRepository)
+ {
+ this.categoryRepository = categoryRepository;
+ }
- public async Task Handle(CreateCategoryCommand request, CancellationToken cancellationToken)
+ public async Task Handle(CreateCategoryCommand request,
+ CancellationToken cancellationToken)
+ {
+ var category = new Category
{
- var category = new Entities.Category
- {
- CategoryName = request.CategoryName,
- CategoryDescription = request.CategoryDescription,
- CategorySeries = request.CategorySeries,
- CustomerId = request.CustomerId,
- AddedDate = request.AddedDate,
- ModifiedDate = request.ModifiedDate,
- DeletedDate = request.DeletedDate,
- IsDeleted = request.IsDeleted,
- TimeLifeInDays = request.TimeLifeInDays,
- QuantityCertificates = request.QuantityCertificates,
- QuantityPublishCode = request.QuantityPublishCode
- };
+ CategoryName = request.CategoryName,
+ CategoryDescription = request.CategoryDescription,
+ CategorySeries = request.CategorySeries,
+ CustomerId = request.CustomerId,
+ AddedDate = request.AddedDate,
+ ModifiedDate = request.ModifiedDate,
+ DeletedDate = request.DeletedDate,
+ IsDeleted = request.IsDeleted,
+ TimeLifeInDays = request.TimeLifeInDays,
+ QuantityCertificates = request.QuantityCertificates,
+ QuantityPublishCode = request.QuantityPublishCode
+ };
- var addedCertificate = await categoryRepository.AddAsync(category, cancellationToken);
+ var addedCertificate = await categoryRepository.AddAsync(category, cancellationToken);
- return new CreateCategoryCommandResult(
- addedCertificate.Id,
- addedCertificate.CategoryName,
- addedCertificate.CategoryDescription,
- addedCertificate.CategorySeries,
- addedCertificate.CustomerId,
- addedCertificate.AddedDate,
- addedCertificate.ModifiedDate,
- addedCertificate.DeletedDate,
- addedCertificate.IsDeleted,
- addedCertificate.TimeLifeInDays,
- addedCertificate.QuantityCertificates,
- addedCertificate.QuantityPublishCode
- );
- }
+ return new CreateCategoryCommandResult(
+ addedCertificate.Id,
+ addedCertificate.CategoryName,
+ addedCertificate.CategoryDescription,
+ addedCertificate.CategorySeries,
+ addedCertificate.CustomerId,
+ addedCertificate.AddedDate,
+ addedCertificate.ModifiedDate,
+ addedCertificate.DeletedDate,
+ addedCertificate.IsDeleted,
+ addedCertificate.TimeLifeInDays,
+ addedCertificate.QuantityCertificates,
+ addedCertificate.QuantityPublishCode
+ );
}
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommandResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommandResult.cs
index 21213149..7cde327a 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommandResult.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/CreateCategory/CreateCategoryCommandResult.cs
@@ -1,34 +1,35 @@
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.CreateCategory
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.CreateCategory;
+
+public class CreateCategoryCommandResult
{
- public class CreateCategoryCommandResult
+ public CreateCategoryCommandResult(long id, string categoryName, string categoryDescription, string categorySeries,
+ string customerId, long addedDate, long modifiedDate, long? deletedDate, bool? isDeleted, int timeLifeInDays,
+ int quantityCertificates, int quantityPublishCode)
{
- public CreateCategoryCommandResult(long id, string categoryName, string categoryDescription, string categorySeries, string customerId, long addedDate, long modifiedDate, long? deletedDate, bool? isDeleted, int timeLifeInDays, int quantityCertificates, int quantityPublishCode)
- {
- Id = id;
- CategoryName = categoryName;
- CategoryDescription = categoryDescription;
- CategorySeries = categorySeries;
- CustomerId = customerId;
- AddedDate = addedDate;
- ModifiedDate = modifiedDate;
- DeletedDate = deletedDate;
- IsDeleted = isDeleted;
- TimeLifeInDays = timeLifeInDays;
- QuantityCertificates = quantityCertificates;
- QuantityPublishCode = quantityPublishCode;
- }
-
- public long Id { get; }
- public string CategoryName { get; }
- public string CategoryDescription { get; }
- public string CategorySeries { get; }
- public string CustomerId { get; }
- public long AddedDate { get; }
- public long ModifiedDate { get; }
- public long? DeletedDate { get; }
- public bool? IsDeleted { get; }
- public int TimeLifeInDays { get; }
- public int QuantityCertificates { get; }
- public int QuantityPublishCode { get; }
+ Id = id;
+ CategoryName = categoryName;
+ CategoryDescription = categoryDescription;
+ CategorySeries = categorySeries;
+ CustomerId = customerId;
+ AddedDate = addedDate;
+ ModifiedDate = modifiedDate;
+ DeletedDate = deletedDate;
+ IsDeleted = isDeleted;
+ TimeLifeInDays = timeLifeInDays;
+ QuantityCertificates = quantityCertificates;
+ QuantityPublishCode = quantityPublishCode;
}
+
+ public long Id { get; }
+ public string CategoryName { get; }
+ public string CategoryDescription { get; }
+ public string CategorySeries { get; }
+ public string CustomerId { get; }
+ public long AddedDate { get; }
+ public long ModifiedDate { get; }
+ public long? DeletedDate { get; }
+ public bool? IsDeleted { get; }
+ public int TimeLifeInDays { get; }
+ public int QuantityCertificates { get; }
+ public int QuantityPublishCode { get; }
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/DeleteCategory/DeleteCategoryCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/DeleteCategory/DeleteCategoryCommand.cs
index f4c472b8..0421b46a 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/DeleteCategory/DeleteCategoryCommand.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/DeleteCategory/DeleteCategoryCommand.cs
@@ -1,15 +1,13 @@
-
-using MediatR;
+using MediatR;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.DeleteCategory
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.DeleteCategory;
+
+public class DeleteCategoryCommand : IRequest
{
- public class DeleteCategoryCommand : IRequest
+ public DeleteCategoryCommand(long id)
{
- public DeleteCategoryCommand(long id)
- {
- Id = id;
- }
- public long Id { get; set; }
+ Id = id;
}
-}
+ public long Id { get; set; }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/DeleteCategory/DeleteCategoryCommandHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/DeleteCategory/DeleteCategoryCommandHandler.cs
index af52f362..1e7f69ca 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/DeleteCategory/DeleteCategoryCommandHandler.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/DeleteCategory/DeleteCategoryCommandHandler.cs
@@ -1,17 +1,18 @@
using MediatR;
using O2NextGen.CertificateManagement.Domain.Data;
using O2NextGen.CertificateManagement.Domain.Data.Queries;
+using O2NextGen.CertificateManagement.Domain.Entities;
namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.DeleteCategory;
public class DeleteCategoryCommandHandler : IRequestHandler
{
- private readonly IQueryHandler _userGroupQueryHandler;
- private readonly IRepository groupsRepository;
+ private readonly IQueryHandler _userGroupQueryHandler;
+ private readonly IRepository groupsRepository;
public DeleteCategoryCommandHandler(
- IQueryHandler userGroupQueryHandler,
- IRepository groupsRepository)
+ IQueryHandler userGroupQueryHandler,
+ IRepository groupsRepository)
{
_userGroupQueryHandler =
userGroupQueryHandler ?? throw new ArgumentNullException(nameof(userGroupQueryHandler));
@@ -24,10 +25,7 @@ public async Task Handle(DeleteCategoryCommand request, CancellationToken
new CategoryQuery(request.Id),
cancellationToken);
- if (category is object)
- {
- await groupsRepository.DeleteAsync(category, cancellationToken);
- }
+ if (category is object) await groupsRepository.DeleteAsync(category, cancellationToken);
return Unit.Value;
}
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQuery.cs
index 5056ad66..27816329 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQuery.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQuery.cs
@@ -1,7 +1,7 @@
using MediatR;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategories
+
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategories;
+
+public class GetCategoriesQuery : IRequest
{
- public class GetCategoriesQuery : IRequest
- {
- }
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQueryHandler.cs
index 85d74d35..950fb092 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQueryHandler.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQueryHandler.cs
@@ -4,36 +4,32 @@
using O2NextGen.CertificateManagement.Domain.Entities;
using O2NextGen.CertificateManagement.Domain.Mappings;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategories
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategories;
+
+public class GetCategoriesQueryHandler
+ : IRequestHandler
{
+ private readonly IQueryHandler> queryHandler;
- public class GetCategoriesQueryHandler
- : IRequestHandler
+ public GetCategoriesQueryHandler(IQueryHandler> queryHandler)
{
- private readonly IQueryHandler> queryHandler;
-
- public GetCategoriesQueryHandler(IQueryHandler> queryHandler)
- {
- this.queryHandler = queryHandler;
- }
-
- public async Task Handle(GetCategoriesQuery request,
- CancellationToken cancellationToken)
- {
- var certificates = await queryHandler.HandleAsync(
- new CategoriesQuery(),
- cancellationToken);
-
- return new GetCategoriesQueryResult(
- certificates.MapAsReadOnly(category =>
- new GetCategoriesQueryResult.CategoryViewModel(
- category.Id,
- category.CategoryName,
- category.CategoryDescription,
- category.CategorySeries,
- category.QuantityCertificates)));
+ this.queryHandler = queryHandler;
+ }
+ public async Task Handle(GetCategoriesQuery request,
+ CancellationToken cancellationToken)
+ {
+ var certificates = await queryHandler.HandleAsync(
+ new CategoriesQuery(),
+ cancellationToken);
- }
+ return new GetCategoriesQueryResult(
+ certificates.MapAsReadOnly(category =>
+ new GetCategoriesQueryResult.CategoryViewModel(
+ category.Id,
+ category.CategoryName,
+ category.CategoryDescription,
+ category.CategorySeries,
+ category.QuantityCertificates)));
}
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQueryResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQueryResult.cs
index 16bc8a49..a692596a 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQueryResult.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategories/GetCategoriesQueryResult.cs
@@ -1,34 +1,30 @@
-using System.Collections.Generic;
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategories;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategories
+public class GetCategoriesQueryResult
{
-
- public class GetCategoriesQueryResult
+ public GetCategoriesQueryResult(IReadOnlyCollection categories)
{
- public GetCategoriesQueryResult(IReadOnlyCollection categories)
- {
- Categories = categories;
- }
+ Categories = categories;
+ }
- public IReadOnlyCollection Categories { get; }
+ public IReadOnlyCollection Categories { get; }
- public class CategoryViewModel
+ public class CategoryViewModel
+ {
+ public CategoryViewModel(long id, string categoryName, string categoryDescription,
+ string categorySeries, int quantityCertificates)
{
- public long Id { get; set; }
- public string CategoryName { get; }
- public string CategoryDescription { get; }
- public string CategorySeries { get; }
- public int QuantityCertificates { get; }
-
- public CategoryViewModel(long id, string categoryName, string categoryDescription,
- string categorySeries, int quantityCertificates)
- {
- Id = id;
- CategoryName = categoryName;
- CategoryDescription = categoryDescription;
- CategorySeries = categorySeries;
- QuantityCertificates = quantityCertificates;
- }
+ Id = id;
+ CategoryName = categoryName;
+ CategoryDescription = categoryDescription;
+ CategorySeries = categorySeries;
+ QuantityCertificates = quantityCertificates;
}
+
+ public long Id { get; set; }
+ public string CategoryName { get; }
+ public string CategoryDescription { get; }
+ public string CategorySeries { get; }
+ public int QuantityCertificates { get; }
}
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQuery.cs
index dd922b80..6fd797fb 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQuery.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQuery.cs
@@ -1,16 +1,14 @@
using MediatR;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategory
-{
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategory;
- public sealed class GetCategoryQuery : IRequest
+public sealed class GetCategoryQuery : IRequest
+{
+ public GetCategoryQuery(long id)
{
- public GetCategoryQuery(long id)
- {
- Id = id;
- }
-
- public long Id { get; }
- public string CategoryName { get; set; }
+ Id = id;
}
-}
+
+ public long Id { get; }
+ public string CategoryName { get; set; }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQueryHandler.cs
index 150808bf..4c237293 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQueryHandler.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQueryHandler.cs
@@ -1,48 +1,40 @@
-using System.Threading;
-using System.Threading.Tasks;
-using MediatR;
+using MediatR;
using O2NextGen.CertificateManagement.Domain.Data;
using O2NextGen.CertificateManagement.Domain.Data.Queries;
using O2NextGen.CertificateManagement.Domain.Entities;
-using O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategory;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategory
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategory;
+
+public class GetCategoryQueryHandler :
+ IRequestHandler
{
+ private readonly IQueryHandler _queryHandler;
- public class GetCategoryQueryHandler :
- IRequestHandler
+ public GetCategoryQueryHandler(IQueryHandler _queryHandler)
{
- private readonly IQueryHandler _queryHandler;
-
- public GetCategoryQueryHandler(IQueryHandler _queryHandler)
- {
- this._queryHandler = _queryHandler;
- }
+ this._queryHandler = _queryHandler;
+ }
- public async Task Handle(GetCategoryQuery request, CancellationToken cancellationToken)
- {
- var category = await _queryHandler.HandleAsync(
- new CategoryQuery(
- request.Id),
- cancellationToken);
+ public async Task Handle(GetCategoryQuery request, CancellationToken cancellationToken)
+ {
+ var category = await _queryHandler.HandleAsync(
+ new CategoryQuery(
+ request.Id),
+ cancellationToken);
- if (category is null)
- {
- return null;
- }
+ if (category is null) return null;
- return new GetCategoryQueryResult(
- id: category.Id,
- modifiedDate: category.ModifiedDate,
- addedDate: category.AddedDate,
- deletedDate: category.DeletedDate,
- isDeleted: category.IsDeleted,
- customerId: category.CustomerId,
- categoryName: category.CategoryName,
- categoryDescription: category.CategoryDescription,
- quantityCertificates: category.QuantityCertificates,
- quantityPublishCode: category.QuantityPublishCode,
- categorySeries: category.CategorySeries);
- }
+ return new GetCategoryQueryResult(
+ category.Id,
+ category.ModifiedDate,
+ category.AddedDate,
+ category.DeletedDate,
+ category.IsDeleted,
+ category.CustomerId,
+ category.CategoryName,
+ category.CategoryDescription,
+ category.QuantityCertificates,
+ category.QuantityPublishCode,
+ category.CategorySeries);
}
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQueryResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQueryResult.cs
index 3d3535fd..578b83ff 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQueryResult.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/GetCategory/GetCategoryQueryResult.cs
@@ -1,39 +1,38 @@
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategory
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategory;
+
+public class GetCategoryQueryResult
{
- public class GetCategoryQueryResult
+ public GetCategoryQueryResult(
+ long id, long modifiedDate, long addedDate, long? deletedDate, bool? isDeleted,
+ string customerId,
+ string categoryName,
+ string categoryDescription,
+ int quantityCertificates,
+ int quantityPublishCode, string categorySeries)
{
- public GetCategoryQueryResult(
- long id, long modifiedDate, long addedDate, long? deletedDate, bool? isDeleted,
- string customerId,
- string categoryName,
- string categoryDescription,
- int quantityCertificates,
- int quantityPublishCode, string categorySeries)
- {
- Id = id;
- ModifiedDate = modifiedDate;
- AddedDate = addedDate;
- DeletedDate = deletedDate;
- IsDeleted = isDeleted;
- CustomerId = customerId;
- CategoryName = categoryName;
- CategoryDescription = categoryDescription;
- QuantityCertificates = quantityCertificates;
- QuantityPublishCode = quantityPublishCode;
- CategorySeries = categorySeries;
- }
+ Id = id;
+ ModifiedDate = modifiedDate;
+ AddedDate = addedDate;
+ DeletedDate = deletedDate;
+ IsDeleted = isDeleted;
+ CustomerId = customerId;
+ CategoryName = categoryName;
+ CategoryDescription = categoryDescription;
+ QuantityCertificates = quantityCertificates;
+ QuantityPublishCode = quantityPublishCode;
+ CategorySeries = categorySeries;
+ }
- public long Id { get; }
- public long ModifiedDate { get; }
- public long AddedDate { get; }
- public long? DeletedDate { get; }
- public bool? IsDeleted { get; }
- public string CustomerId { get; }
- public string CategoryName { get; }
- public string CategoryDescription { get; }
- public int QuantityCertificates { get; }
- public int QuantityPublishCode { get; }
- public string CategorySeries { get; }
- }
+ public long Id { get; }
+ public long ModifiedDate { get; }
+ public long AddedDate { get; }
+ public long? DeletedDate { get; }
+ public bool? IsDeleted { get; }
+ public string CustomerId { get; }
+ public string CategoryName { get; }
+ public string CategoryDescription { get; }
+ public int QuantityCertificates { get; }
+ public int QuantityPublishCode { get; }
+ public string CategorySeries { get; }
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/UpdateCategory/UpdateCategoryDetailsCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/UpdateCategory/UpdateCategoryDetailsCommand.cs
index f23e62f0..48f97a7e 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/UpdateCategory/UpdateCategoryDetailsCommand.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/UpdateCategory/UpdateCategoryDetailsCommand.cs
@@ -6,8 +6,8 @@ public class UpdateCategoryDetailsCommand : IRequest
{
- private readonly IQueryHandler _userGroupQueryHandler;
- private readonly IRepository _groupsRepository;
+ private readonly IRepository _groupsRepository;
+ private readonly IQueryHandler _userGroupQueryHandler;
public UpdateCategoryDetailsCommandHandler(
- IQueryHandler userGroupQueryHandler,
- IRepository groupsRepository)
+ IQueryHandler userGroupQueryHandler,
+ IRepository groupsRepository)
{
_userGroupQueryHandler =
userGroupQueryHandler ?? throw new ArgumentNullException(nameof(userGroupQueryHandler));
@@ -28,19 +29,16 @@ public async Task Handle(UpdateCategoryDetai
),
cancellationToken);
- if (category is null)
- {
- return null;
- }
+ if (category is null) return null;
+
-
category.IsDeleted = request.IsDeleted;
category.CustomerId = request.CustomerId;
category.CategoryName = request.CategoryName;
-
+
category.CategoryName = request.CategoryName;
-
-
+
+
category.CategoryDescription = request.CategoryDescription;
category.QuantityCertificates = request.QuantityCertificates;
category.CategorySeries = request.CategorySeries;
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/UpdateCategory/UpdateCategoryDetailsCommandResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/UpdateCategory/UpdateCategoryDetailsCommandResult.cs
index 4d845c65..0b57e022 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/UpdateCategory/UpdateCategoryDetailsCommandResult.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCategory/UpdateCategory/UpdateCategoryDetailsCommandResult.cs
@@ -2,17 +2,6 @@ namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.UpdateCate
public class UpdateCategoryDetailsCommandResult
{
- public long Id { get; }
- public long ModifiedDate { get; }
- public long AddedDate { get; }
- public long? DeletedDate { get; }
- public bool? IsDeleted { get; }
- public string CustomerId { get; }
- public string CategoryName { get; }
- public string CategoryDescription { get; }
- public int QuantityCertificates { get; }
- public int QuantityPublishCode { get; }
-
public UpdateCategoryDetailsCommandResult(long id,
long modifiedDate,
long addedDate,
@@ -32,4 +21,15 @@ public UpdateCategoryDetailsCommandResult(long id,
QuantityCertificates = quantityCertificates;
QuantityPublishCode = quantityPublishCode;
}
+
+ public long Id { get; }
+ public long ModifiedDate { get; }
+ public long AddedDate { get; }
+ public long? DeletedDate { get; }
+ public bool? IsDeleted { get; }
+ public string CustomerId { get; }
+ public string CategoryName { get; }
+ public string CategoryDescription { get; }
+ public int QuantityCertificates { get; }
+ public int QuantityPublishCode { get; }
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommand.cs
index 0c60e067..4954de80 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommand.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommand.cs
@@ -1,50 +1,47 @@
-using System.Collections.Generic;
-using MediatR;
+using MediatR;
using O2NextGen.CertificateManagement.Domain.Entities;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.CreateCertificate
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.CreateCertificate;
+
+public class CreateCertificateCommand : IRequest
{
- public class CreateCertificateCommand : IRequest
+ public CreateCertificateCommand(
+ string externalId, bool? IsDeleted, string ownerAccountId, string customerId,
+ long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible,
+ long categoryId, Category category, bool @lock, long lockedDate, string lockInfo,
+ ICollection languageInfos)
{
- public string ExternalId { get; set; }
- public bool? IsDeleted { get; set; }
-
- public string OwnerAccountId { get; set; }
- public string CustomerId { get; set; }
- public long ExpiredDate { get; set; }
- public long PublishDate { get; set; }
- public string CreatorId { get; set; }
- public string PublishCode { get; set; }
- public bool IsVisible { get; set; }
+ ExternalId = externalId;
+ this.IsDeleted = IsDeleted;
+ CustomerId = customerId;
+ ExpiredDate = expiredDate;
+ PublishDate = publishDate;
+ CreatorId = creatorId;
+ PublishCode = publishCode;
+ IsVisible = isVisible;
+ CategoryId = categoryId;
+ Category = category;
+ Lock = @lock;
+ LockedDate = lockedDate;
+ LockInfo = lockInfo;
+ LanguageInfos = languageInfos;
+ }
- public long CategoryId { get; set; }
- public Category Category { get; set; }
- public bool Lock { get; set; }
- public long LockedDate { get; set; }
- public string LockInfo { get; set; }
- public ICollection LanguageInfos { get; }
+ public string ExternalId { get; set; }
+ public bool? IsDeleted { get; set; }
- public CreateCertificateCommand(
- string externalId, bool? IsDeleted, string ownerAccountId, string customerId,
- long expiredDate, long publishDate, string creatorId, string publishCode, bool isVisible,
- long categoryId, Category category, bool @lock, long lockedDate, string lockInfo,
- ICollection languageInfos)
- {
- ExternalId = externalId;
- this.IsDeleted = IsDeleted;
- CustomerId = customerId;
- ExpiredDate = expiredDate;
- PublishDate = publishDate;
- CreatorId = creatorId;
- PublishCode = publishCode;
- IsVisible = isVisible;
- CategoryId = categoryId;
- Category = category;
- Lock = @lock;
- LockedDate = lockedDate;
- LockInfo = lockInfo;
- LanguageInfos = languageInfos;
- }
- }
-}
+ public string OwnerAccountId { get; set; }
+ public string CustomerId { get; set; }
+ public long ExpiredDate { get; set; }
+ public long PublishDate { get; set; }
+ public string CreatorId { get; set; }
+ public string PublishCode { get; set; }
+ public bool IsVisible { get; set; }
+ public long CategoryId { get; set; }
+ public Category Category { get; set; }
+ public bool Lock { get; set; }
+ public long LockedDate { get; set; }
+ public string LockInfo { get; set; }
+ public ICollection LanguageInfos { get; }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommandHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommandHandler.cs
index 6dca818d..260702ff 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommandHandler.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommandHandler.cs
@@ -1,59 +1,57 @@
-using System.Threading;
-using System.Threading.Tasks;
-using MediatR;
+using MediatR;
using O2NextGen.CertificateManagement.Domain.Data;
+using O2NextGen.CertificateManagement.Domain.Entities;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.CreateCertificate
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.CreateCertificate;
+
+public class CreateCertificateCommandHandler
+ : IRequestHandler
{
- public class CreateCertificateCommandHandler
- : IRequestHandler
+ private readonly IRepository certificatesRepository;
+
+ public CreateCertificateCommandHandler(IRepository certificatesRepository)
{
- private readonly IRepository certificatesRepository;
+ this.certificatesRepository = certificatesRepository;
+ }
- public CreateCertificateCommandHandler(IRepository certificatesRepository)
- {
- this.certificatesRepository = certificatesRepository;
- }
- public async Task Handle(
- CreateCertificateCommand request, CancellationToken cancellationToken)
+ public async Task Handle(
+ CreateCertificateCommand request, CancellationToken cancellationToken)
+ {
+ var certificate = new Certificate
{
- var certificate = new Entities.Certificate
- {
- ExternalId = request.ExternalId,
- IsDeleted = request.IsDeleted,
- CustomerId = request.CustomerId,
- ExpiredDate = request.ExpiredDate,
- PublishDate = request.PublishDate,
- CreatorId = request.CreatorId,
- PublishCode = request.PublishCode,
- IsVisible = request.IsVisible,
- CategoryId = request.CategoryId,
- Category = request.Category,
- Lock = request.Lock,
- LockedDate = request.LockedDate,
- LockInfo = request.LockInfo,
- LanguageInfos = request.LanguageInfos
- };
+ ExternalId = request.ExternalId,
+ IsDeleted = request.IsDeleted,
+ CustomerId = request.CustomerId,
+ ExpiredDate = request.ExpiredDate,
+ PublishDate = request.PublishDate,
+ CreatorId = request.CreatorId,
+ PublishCode = request.PublishCode,
+ IsVisible = request.IsVisible,
+ CategoryId = request.CategoryId,
+ Category = request.Category,
+ Lock = request.Lock,
+ LockedDate = request.LockedDate,
+ LockInfo = request.LockInfo,
+ LanguageInfos = request.LanguageInfos
+ };
- var addedCertificate = await certificatesRepository.AddAsync(certificate, cancellationToken);
+ var addedCertificate = await certificatesRepository.AddAsync(certificate, cancellationToken);
- return new CreateCertificateCommandResult(
- addedCertificate.ExternalId,
- addedCertificate.IsDeleted,
- addedCertificate.OwnerAccountId,
- addedCertificate.CustomerId,
- addedCertificate.ExpiredDate,
- addedCertificate.PublishDate,
- addedCertificate.CreatorId,
- addedCertificate.PublishCode,
- addedCertificate.IsVisible,
- addedCertificate.CategoryId,
- addedCertificate.Category,
- addedCertificate.Lock,
- addedCertificate.LockedDate,
- addedCertificate.LockInfo,
- addedCertificate.LanguageInfos);
- }
+ return new CreateCertificateCommandResult(
+ addedCertificate.ExternalId,
+ addedCertificate.IsDeleted,
+ addedCertificate.OwnerAccountId,
+ addedCertificate.CustomerId,
+ addedCertificate.ExpiredDate,
+ addedCertificate.PublishDate,
+ addedCertificate.CreatorId,
+ addedCertificate.PublishCode,
+ addedCertificate.IsVisible,
+ addedCertificate.CategoryId,
+ addedCertificate.Category,
+ addedCertificate.Lock,
+ addedCertificate.LockedDate,
+ addedCertificate.LockInfo,
+ addedCertificate.LanguageInfos);
}
-}
-
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommandResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommandResult.cs
index 362d75b6..cfd7c2a0 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommandResult.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/CreateCertificate/CreateCertificateCommandResult.cs
@@ -1,52 +1,49 @@
-using System.Collections.Generic;
-using O2NextGen.CertificateManagement.Domain.Entities;
+using O2NextGen.CertificateManagement.Domain.Entities;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.CreateCertificate
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.CreateCertificate;
+
+public class CreateCertificateCommandResult
{
- public class CreateCertificateCommandResult
+ public CreateCertificateCommandResult(
+ string externalId, bool? isDeleted, string ownerAccountId, string customerId,
+ long expiredDate, long publishDate, string creatorId, string publishCode,
+ bool isVisible, long categoryId, Category category, bool @lock,
+ long lockedDate, string lockInfo, ICollection languageInfos)
{
- public CreateCertificateCommandResult(
- string externalId, bool? isDeleted, string ownerAccountId, string customerId,
- long expiredDate, long publishDate, string creatorId, string publishCode,
- bool isVisible, long categoryId, Category category, bool @lock,
- long lockedDate, string lockInfo, ICollection languageInfos)
- {
- ExternalId = externalId;
- IsDeleted = isDeleted;
- OwnerAccountId = ownerAccountId;
- CustomerId = customerId;
- ExpiredDate = expiredDate;
- PublishDate = publishDate;
- CreatorId = creatorId;
- PublishCode = publishCode;
- IsVisible = isVisible;
- CategoryId = categoryId;
- Category = category;
- Lock = @lock;
- LockedDate = lockedDate;
- LockInfo = lockInfo;
- LanguageInfos = languageInfos;
- }
-
- public long Id { get; set; }
- public string ExternalId { get; }
- public long ModifiedDate { get; set; }
- public long AddedDate { get; set; }
- public long? DeletedDate { get; set; }
- public bool? IsDeleted { get; }
- public string OwnerAccountId { get; }
- public string CustomerId { get; }
- public long ExpiredDate { get; }
- public long PublishDate { get; }
- public string CreatorId { get; }
- public string PublishCode { get; }
- public bool IsVisible { get; }
- public long CategoryId { get; }
- public Category Category { get; }
- public bool Lock { get; }
- public long LockedDate { get; }
- public string LockInfo { get; }
- public ICollection LanguageInfos { get; }
+ ExternalId = externalId;
+ IsDeleted = isDeleted;
+ OwnerAccountId = ownerAccountId;
+ CustomerId = customerId;
+ ExpiredDate = expiredDate;
+ PublishDate = publishDate;
+ CreatorId = creatorId;
+ PublishCode = publishCode;
+ IsVisible = isVisible;
+ CategoryId = categoryId;
+ Category = category;
+ Lock = @lock;
+ LockedDate = lockedDate;
+ LockInfo = lockInfo;
+ LanguageInfos = languageInfos;
}
-}
+ public long Id { get; set; }
+ public string ExternalId { get; }
+ public long ModifiedDate { get; set; }
+ public long AddedDate { get; set; }
+ public long? DeletedDate { get; set; }
+ public bool? IsDeleted { get; }
+ public string OwnerAccountId { get; }
+ public string CustomerId { get; }
+ public long ExpiredDate { get; }
+ public long PublishDate { get; }
+ public string CreatorId { get; }
+ public string PublishCode { get; }
+ public bool IsVisible { get; }
+ public long CategoryId { get; }
+ public Category Category { get; }
+ public bool Lock { get; }
+ public long LockedDate { get; }
+ public string LockInfo { get; }
+ public ICollection LanguageInfos { get; }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/DeleteCertificate/DeleteCertificateCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/DeleteCertificate/DeleteCertificateCommand.cs
index 82950f37..d8e27e2f 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/DeleteCertificate/DeleteCertificateCommand.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/DeleteCertificate/DeleteCertificateCommand.cs
@@ -1,16 +1,13 @@
using MediatR;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.DeleteCertificate
-{
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.DeleteCertificate;
- public sealed class DeleteCertificateCommand : IRequest
+public sealed class DeleteCertificateCommand : IRequest
+{
+ public DeleteCertificateCommand(long id)
{
- public DeleteCertificateCommand(long id)
- {
- Id = id;
- }
-
- public long Id { get; set; }
+ Id = id;
}
+ public long Id { get; set; }
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/DeleteCertificate/DeleteCertificateCommandHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/DeleteCertificate/DeleteCertificateCommandHandler.cs
index ccf7172e..923a39df 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/DeleteCertificate/DeleteCertificateCommandHandler.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/DeleteCertificate/DeleteCertificateCommandHandler.cs
@@ -1,40 +1,32 @@
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using MediatR;
+using MediatR;
using O2NextGen.CertificateManagement.Domain.Data;
using O2NextGen.CertificateManagement.Domain.Data.Queries;
+using O2NextGen.CertificateManagement.Domain.Entities;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.DeleteCertificate
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.DeleteCertificate;
+
+public class DeleteCertificateCommandHandler : IRequestHandler
{
+ private readonly IQueryHandler _userGroupQueryHandler;
+ private readonly IRepository groupsRepository;
- public class DeleteCertificateCommandHandler : IRequestHandler
+ public DeleteCertificateCommandHandler(
+ IQueryHandler userGroupQueryHandler,
+ IRepository groupsRepository)
{
- private readonly IQueryHandler _userGroupQueryHandler;
- private readonly IRepository groupsRepository;
-
- public DeleteCertificateCommandHandler(
- IQueryHandler userGroupQueryHandler,
- IRepository groupsRepository)
- {
- _userGroupQueryHandler =
- userGroupQueryHandler ?? throw new ArgumentNullException(nameof(userGroupQueryHandler));
- this.groupsRepository = groupsRepository;
- }
+ _userGroupQueryHandler =
+ userGroupQueryHandler ?? throw new ArgumentNullException(nameof(userGroupQueryHandler));
+ this.groupsRepository = groupsRepository;
+ }
- public async Task Handle(DeleteCertificateCommand request, CancellationToken cancellationToken)
- {
- var certificate = await _userGroupQueryHandler.HandleAsync(
- new CertificateQuery(request.Id),
- cancellationToken);
+ public async Task Handle(DeleteCertificateCommand request, CancellationToken cancellationToken)
+ {
+ var certificate = await _userGroupQueryHandler.HandleAsync(
+ new CertificateQuery(request.Id),
+ cancellationToken);
- if (certificate is object)
- {
- await groupsRepository.DeleteAsync(certificate, cancellationToken);
- }
+ if (certificate is object) await groupsRepository.DeleteAsync(certificate, cancellationToken);
- return Unit.Value;
- }
+ return Unit.Value;
}
-}
-
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQuery.cs
index c4331acc..2763763d 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQuery.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQuery.cs
@@ -1,18 +1,13 @@
using MediatR;
-
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificate
-{
-
- public sealed class GetCertificateQuery : IRequest
- {
- private long id;
- public GetCertificateQuery(long id)
- {
- Id = id;
- }
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificate;
- public long Id { get => id; set => id = value; }
+public sealed class GetCertificateQuery : IRequest
+{
+ public GetCertificateQuery(long id)
+ {
+ Id = id;
}
-}
+ public long Id { get; set; }
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQueryHandler.cs
index b30ed881..c4bfd524 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQueryHandler.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQueryHandler.cs
@@ -1,56 +1,48 @@
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using MediatR;
+using MediatR;
using O2NextGen.CertificateManagement.Domain.Data;
using O2NextGen.CertificateManagement.Domain.Data.Queries;
using O2NextGen.CertificateManagement.Domain.Entities;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificate
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificate;
+
+public class GetCertificateQueryHandler :
+ IRequestHandler
{
+ private readonly IQueryHandler _queryHandler;
- public class GetCertificateQueryHandler :
- IRequestHandler
+ public GetCertificateQueryHandler(IQueryHandler queryHandler)
{
- private readonly IQueryHandler _queryHandler;
-
- public GetCertificateQueryHandler(IQueryHandler queryHandler)
- {
- _queryHandler = queryHandler ?? throw new ArgumentNullException(nameof(queryHandler));
- }
+ _queryHandler = queryHandler ?? throw new ArgumentNullException(nameof(queryHandler));
+ }
- public async Task Handle(GetCertificateQuery request,
- CancellationToken cancellationToken)
- {
- var certificate = await _queryHandler.HandleAsync(
- new CertificateQuery(request.Id),
- cancellationToken);
+ public async Task Handle(GetCertificateQuery request,
+ CancellationToken cancellationToken)
+ {
+ var certificate = await _queryHandler.HandleAsync(
+ new CertificateQuery(request.Id),
+ cancellationToken);
- if (certificate is null)
- {
- return null;
- }
+ if (certificate is null) return null;
- return new GetCertificateQueryResult(
- certificate.Id,
- certificate.ExternalId,
- certificate.ModifiedDate,
- certificate.AddedDate,
- certificate.DeletedDate,
- certificate.IsDeleted,
- certificate.OwnerAccountId,
- certificate.CustomerId,
- certificate.ExpiredDate,
- certificate.PublishDate,
- certificate.CreatorId,
- certificate.PublishCode,
- certificate.IsVisible,
- certificate.CategoryId,
- certificate.Category,
- certificate.Lock,
- certificate.LockedDate,
- certificate.LockInfo,
- certificate.LanguageInfos);
- }
+ return new GetCertificateQueryResult(
+ certificate.Id,
+ certificate.ExternalId,
+ certificate.ModifiedDate,
+ certificate.AddedDate,
+ certificate.DeletedDate,
+ certificate.IsDeleted,
+ certificate.OwnerAccountId,
+ certificate.CustomerId,
+ certificate.ExpiredDate,
+ certificate.PublishDate,
+ certificate.CreatorId,
+ certificate.PublishCode,
+ certificate.IsVisible,
+ certificate.CategoryId,
+ certificate.Category,
+ certificate.Lock,
+ certificate.LockedDate,
+ certificate.LockInfo,
+ certificate.LanguageInfos);
}
-}
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQueryResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQueryResult.cs
index d029a369..de1974d6 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQueryResult.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificate/GetCertificateQueryResult.cs
@@ -1,55 +1,53 @@
-using System.Collections.Generic;
-using O2NextGen.CertificateManagement.Domain.Entities;
+using O2NextGen.CertificateManagement.Domain.Entities;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificate
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificate;
+
+public sealed class GetCertificateQueryResult
{
- public sealed class GetCertificateQueryResult
+ public GetCertificateQueryResult(long id, string externalId, long modifiedDate, long addedDate,
+ long? deletedDate, bool? isDeleted, string ownerAccountId, string customerId, long expiredDate,
+ long publishDate, string creatorId, string publishCode, bool isVisible, long categoryId,
+ Category category, bool @lock, long lockedDate, string lockInfo,
+ ICollection languageInfos)
{
- public GetCertificateQueryResult(long id, string externalId, long modifiedDate, long addedDate,
- long? deletedDate, bool? isDeleted, string ownerAccountId, string customerId, long expiredDate,
- long publishDate, string creatorId, string publishCode, bool isVisible, long categoryId,
- Category category, bool @lock, long lockedDate, string lockInfo,
- ICollection languageInfos)
- {
- Id = id;
- ExternalId = externalId;
- ModifiedDate = modifiedDate;
- AddedDate = addedDate;
- DeletedDate = deletedDate;
- IsDeleted = isDeleted;
- OwnerAccountId = ownerAccountId;
- CustomerId = customerId;
- ExpiredDate = expiredDate;
- PublishDate = publishDate;
- CreatorId = creatorId;
- PublishCode = publishCode;
- IsVisible = isVisible;
- CategoryId = categoryId;
- Category = category;
- Lock = @lock;
- LockedDate = lockedDate;
- LockInfo = lockInfo;
- LanguageInfos = languageInfos;
- }
-
- public long Id { get; }
- public string ExternalId { get; }
- public long ModifiedDate { get; }
- public long AddedDate { get; }
- public long? DeletedDate { get; }
- public bool? IsDeleted { get; }
- public string OwnerAccountId { get; }
- public string CustomerId { get; }
- public long ExpiredDate { get; }
- public long PublishDate { get; }
- public string CreatorId { get; }
- public string PublishCode { get; }
- public bool IsVisible { get; }
- public long CategoryId { get; }
- public Category Category { get; }
- public bool Lock { get; }
- public long LockedDate { get; }
- public string LockInfo { get; }
- public ICollection LanguageInfos { get; }
+ Id = id;
+ ExternalId = externalId;
+ ModifiedDate = modifiedDate;
+ AddedDate = addedDate;
+ DeletedDate = deletedDate;
+ IsDeleted = isDeleted;
+ OwnerAccountId = ownerAccountId;
+ CustomerId = customerId;
+ ExpiredDate = expiredDate;
+ PublishDate = publishDate;
+ CreatorId = creatorId;
+ PublishCode = publishCode;
+ IsVisible = isVisible;
+ CategoryId = categoryId;
+ Category = category;
+ Lock = @lock;
+ LockedDate = lockedDate;
+ LockInfo = lockInfo;
+ LanguageInfos = languageInfos;
}
+
+ public long Id { get; }
+ public string ExternalId { get; }
+ public long ModifiedDate { get; }
+ public long AddedDate { get; }
+ public long? DeletedDate { get; }
+ public bool? IsDeleted { get; }
+ public string OwnerAccountId { get; }
+ public string CustomerId { get; }
+ public long ExpiredDate { get; }
+ public long PublishDate { get; }
+ public string CreatorId { get; }
+ public string PublishCode { get; }
+ public bool IsVisible { get; }
+ public long CategoryId { get; }
+ public Category Category { get; }
+ public bool Lock { get; }
+ public long LockedDate { get; }
+ public string LockInfo { get; }
+ public ICollection LanguageInfos { get; }
}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQuery.cs
index 267a8999..4c4d6df2 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQuery.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQuery.cs
@@ -1,9 +1,7 @@
using MediatR;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificates
-{
- public class GetCertificatesQuery : IRequest
- {
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificates;
- }
-}
+public class GetCertificatesQuery : IRequest
+{
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQueryHandler.cs
index bc19e735..2e73b170 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQueryHandler.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQueryHandler.cs
@@ -1,55 +1,50 @@
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using MediatR;
+using MediatR;
using O2NextGen.CertificateManagement.Domain.Data;
using O2NextGen.CertificateManagement.Domain.Data.Queries;
using O2NextGen.CertificateManagement.Domain.Entities;
using O2NextGen.CertificateManagement.Domain.Mappings;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificates
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificates;
+
+public class GetCertificatesQueryHandler
+ : IRequestHandler
{
- public class GetCertificatesQueryHandler
- : IRequestHandler
- {
- private readonly IQueryHandler> queryHandler;
+ private readonly IQueryHandler> queryHandler;
- public GetCertificatesQueryHandler(
- IQueryHandler> queryHandler)
- {
- this.queryHandler = queryHandler ?? throw new ArgumentNullException(nameof(queryHandler));
- }
+ public GetCertificatesQueryHandler(
+ IQueryHandler> queryHandler)
+ {
+ this.queryHandler = queryHandler ?? throw new ArgumentNullException(nameof(queryHandler));
+ }
- public async Task Handle(GetCertificatesQuery request, CancellationToken cancellationToken)
- {
- var certificates = await queryHandler.HandleAsync(
- new CertificatesQuery(),
- cancellationToken);
+ public async Task Handle(GetCertificatesQuery request,
+ CancellationToken cancellationToken)
+ {
+ var certificates = await queryHandler.HandleAsync(
+ new CertificatesQuery(),
+ cancellationToken);
- return new GetCertificatesQueryResult(
- certificates.MapAsReadOnly(certificate =>
- new GetCertificatesQueryResult.CertificateViewModel(
- certificate.Id,
- certificate.ExternalId,
- certificate.ModifiedDate,
- certificate.AddedDate,
- certificate.DeletedDate,
- certificate.IsDeleted,
- certificate.OwnerAccountId,
- certificate.CustomerId,
- certificate.ExpiredDate,
- certificate.PublishDate,
- certificate.CreatorId,
- certificate.PublishCode,
- certificate.IsVisible,
- certificate.CategoryId,
- certificate.Category,
- certificate.Lock,
- certificate.LockedDate,
- certificate.LockInfo,
- certificate.LanguageInfos)));
- }
+ return new GetCertificatesQueryResult(
+ certificates.MapAsReadOnly(certificate =>
+ new GetCertificatesQueryResult.CertificateViewModel(
+ certificate.Id,
+ certificate.ExternalId,
+ certificate.ModifiedDate,
+ certificate.AddedDate,
+ certificate.DeletedDate,
+ certificate.IsDeleted,
+ certificate.OwnerAccountId,
+ certificate.CustomerId,
+ certificate.ExpiredDate,
+ certificate.PublishDate,
+ certificate.CreatorId,
+ certificate.PublishCode,
+ certificate.IsVisible,
+ certificate.CategoryId,
+ certificate.Category,
+ certificate.Lock,
+ certificate.LockedDate,
+ certificate.LockInfo,
+ certificate.LanguageInfos)));
}
-}
-
+}
\ No newline at end of file
diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQueryResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQueryResult.cs
index b284af84..2877cc6d 100644
--- a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQueryResult.cs
+++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/ForCertificate/GetCertificates/GetCertificatesQueryResult.cs
@@ -1,69 +1,65 @@
-using System.Collections.Generic;
-using O2NextGen.CertificateManagement.Domain.Entities;
+using O2NextGen.CertificateManagement.Domain.Entities;
-namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificates
-{
+namespace O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificates;
- public class GetCertificatesQueryResult
+public class GetCertificatesQueryResult
+{
+ public GetCertificatesQueryResult(IReadOnlyCollection certificates)
{
- public GetCertificatesQueryResult(IReadOnlyCollection certificates)
- {
- Certificates = certificates;
- }
+ Certificates = certificates;
+ }
- public IReadOnlyCollection Certificates { get; }
+ public IReadOnlyCollection Certificates { get; }
- public class CertificateViewModel
+ public class CertificateViewModel
+ {
+ public CertificateViewModel(
+ long id, string externalId,
+ long modifiedDate, long addedDate, long? deletedDate,
+ bool? isDeleted, string ownerAccountId, string customerId,
+ long expiredDate, long publishDate, string creatorId, string publishCode,
+ bool isVisible, long categoryId, Category category, bool @lock,
+ long lockedDate, string lockInfo, ICollection languageInfos)
{
+ Id = id;
- public CertificateViewModel(
- long id, string externalId,
- long modifiedDate, long addedDate, long? deletedDate,
- bool? isDeleted, string ownerAccountId, string customerId,
- long expiredDate, long publishDate, string creatorId, string publishCode,
- bool isVisible, long categoryId, Category category, bool @lock,
- long lockedDate, string lockInfo, ICollection