Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/Services/c-gen/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/O2NextGen.CertificateManagement.Application/bin/Debug/net6.0/O2NextGen.CertificateManagement.Application.dll",
"args": [],
"cwd": "${workspaceFolder}/O2NextGen.CertificateManagement.Application",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
4 changes: 4 additions & 0 deletions src/Services/c-gen/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"dotnet-test-explorer.enableTelemetry": false,
"dotnet-test-explorer.testProjectPath": "Tests/*/*Tests.*.csproj"
}
72 changes: 72 additions & 0 deletions src/Services/c-gen/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj"
],
"problemMatcher": "$msCompile"
},
{
"label": "test",
"command": "dotnet",
"type": "process",
"args": [
"test",
"${workspaceFolder}/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/IntegrationTests.O2NextGen.CertificateManagement.Application.csproj"
],
"problemMatcher": "$msCompile",
"group": {
"kind": "test",
"isDefault": true
}
},
{
"label": "test with coverage",
"command": "dotnet",
"type": "process",
"args": [
"test",
"/p:CollectCoverage=true",
"/p:CoverletOutputFormat=lcov",
"/p:CoverletOutput=./lcov.info",
"${workspaceFolder}/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/IntegrationTests.O2NextGen.CertificateManagement.Application.csproj"
],
"problemMatcher": "$msCompile",
"group": {
"kind": "test",
"isDefault": true
}
},
]
}
14 changes: 14 additions & 0 deletions src/Services/c-gen/O2NextGen.CGen.sln
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CQRS", "CQRS", "{0835E199-8
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.O2NextGen.CertificateManagement.Infrastructure", "Tests\Tests.O2NextGen.CertificateManagement.Infrastructure\Tests.O2NextGen.CertificateManagement.Infrastructure.csproj", "{EC5B79FF-4A87-4740-B5EC-2778861EB017}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.O2NextGen.CertificateManagement.Domain", "Tests\Tests.O2NextGen.CertificateManagement.Domain\Tests.O2NextGen.CertificateManagement.Domain.csproj", "{EFBD38BF-67DF-4507-94DC-E8BED67B6CF5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.O2NextGen.CertificateManagement.Application", "Tests\Tests.O2NextGen.CertificateManagement.Application\Tests.O2NextGen.CertificateManagement.Application.csproj", "{6EE05F8B-1BF0-493A-9408-C824F5C2D271}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -103,6 +107,14 @@ Global
{EC5B79FF-4A87-4740-B5EC-2778861EB017}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EC5B79FF-4A87-4740-B5EC-2778861EB017}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EC5B79FF-4A87-4740-B5EC-2778861EB017}.Release|Any CPU.Build.0 = Release|Any CPU
{EFBD38BF-67DF-4507-94DC-E8BED67B6CF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EFBD38BF-67DF-4507-94DC-E8BED67B6CF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EFBD38BF-67DF-4507-94DC-E8BED67B6CF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EFBD38BF-67DF-4507-94DC-E8BED67B6CF5}.Release|Any CPU.Build.0 = Release|Any CPU
{6EE05F8B-1BF0-493A-9408-C824F5C2D271}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6EE05F8B-1BF0-493A-9408-C824F5C2D271}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6EE05F8B-1BF0-493A-9408-C824F5C2D271}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6EE05F8B-1BF0-493A-9408-C824F5C2D271}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -123,6 +135,8 @@ Global
{58CC0839-863D-4708-A6D4-42F245593538} = {0835E199-8062-45E0-899E-38ECAD9437CD}
{0835E199-8062-45E0-899E-38ECAD9437CD} = {12E83C2A-23C7-4E71-B137-AC56CE28F9E4}
{EC5B79FF-4A87-4740-B5EC-2778861EB017} = {0835E199-8062-45E0-899E-38ECAD9437CD}
{EFBD38BF-67DF-4507-94DC-E8BED67B6CF5} = {0835E199-8062-45E0-899E-38ECAD9437CD}
{6EE05F8B-1BF0-493A-9408-C824F5C2D271} = {0835E199-8062-45E0-899E-38ECAD9437CD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A6DFC9F0-3FA7-492B-ACE9-3EFBF3477712}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
using System.Threading;
using System.Threading.Tasks;
using MediatR;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using O2NextGen.CertificateManagement.Application.Controllers;
using O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.CreateCategory;
using O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.DeleteCategory;
using O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategories;
using O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.GetCategory;
using O2NextGen.CertificateManagement.Domain.UseCases.ForCategory.UpdateCategory;

namespace O2NextGen.CertificateManagement.Application.Features.Categories
{
[Route("api/[controller]")]
//[ApiVersion("1.0")]
[ApiController]
public class CategoriesController : ControllerBase
{
#region Fields

private readonly IMediator _mediator;
private readonly ILogger<CertificatesController> _logger;
private readonly ILogger<CategoriesController> _logger;

private static readonly string GetByIdActionName
= nameof(GetByIdAsync).Replace("Async", string.Empty);

#endregion


#region Ctors

public CategoriesController(IMediator mediator, ILogger<CertificatesController> logger)
public CategoriesController(IMediator mediator, ILogger<CategoriesController> logger)
{
_mediator = mediator;
_logger = logger;
_mediator = mediator ?? throw new ArgumentNullException(nameof(mediator));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}

#endregion
Expand All @@ -40,11 +41,17 @@ public CategoriesController(IMediator mediator, ILogger<CertificatesController>
[Route("{id}")]
public async Task<IActionResult> GetByIdAsync(long id, CancellationToken ct)
{
var result = await _mediator.Send(new GetCategoryQuery(id));
_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);
}

Expand All @@ -60,16 +67,50 @@ public async Task<IActionResult> GetAllAsync()
[HttpPost]
[Route("")]
public async Task<ActionResult<CreateCategoryCommandResult>> AddAsync(
CreateCategoryDetailsCommandModel model,
[FromBody] CreateCategoryModel model,
CancellationToken ct)
{
var result = await _mediator.Send(
new CreateCategoryCommand());
new CreateCategoryCommand(
model.CategoryName,
model.QuantityCertificates,
model.CategoryDescription,
model.CategorySeries),
ct);
return CreatedAtAction(GetByIdActionName,
new { id = result.Id }, result);
new {id = result.Id}, result);
}

[HttpPut]
[Route("{id}")]
public async Task<ActionResult<UpdateCategoryDetailsCommandResult>> 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;
}

[HttpDelete]
[Route("{id}")]
public async Task<IActionResult> RemoveAsync(long id, CancellationToken ct)
{
await _mediator.Send(new DeleteCategoryCommand(id), ct);
return NoContent();
}
#endregion
}
}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Runtime.Serialization;

namespace O2NextGen.CertificateManagement.Application.Features.Categories
{
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; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace O2NextGen.CertificateManagement.Application.Features.Categories;

public interface ICreateCategoryModel
{
string CategoryName { get; set; }
string CategoryDescription { get; set; }
string CategorySeries { get; set; }
string CustomerId { get; set; }
public int QuantityCertificates { get; set; }
public int QuantityPublishCode { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace O2NextGen.CertificateManagement.Application.Features.Categories;

public class ResponseDto
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace O2NextGen.CertificateManagement.Application.Features.Categories;

public class UpdateCategoryModel : CreateCategoryModel
{
public long Id { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
using System.Threading;
using System.Threading.Tasks;
using MediatR;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using O2NextGen.CertificateManagement.Domain.Data.Queries;
using O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.CreateCertificate;
using O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.DeleteCertificate;
using O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificate;
using O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.GetCertificates;
using O2NextGen.CertificateManagement.Domain.UseCases.ForCertificate.UpdateCertificate;

namespace O2NextGen.CertificateManagement.Application.Controllers
namespace O2NextGen.CertificateManagement.Application.Features.Certificates
{
[Route("api/[controller]")]
[ApiController]
public partial class CertificatesController : ControllerBase
{
#region Fields
Expand Down Expand Up @@ -41,7 +39,7 @@ public CertificatesController(IMediator mediator, ILogger<CertificatesController
[Route("{id}")]
public async Task<IActionResult> GetByIdAsync(long id, CancellationToken ct)
{
var result = await _mediator.Send(new CertificateQuery(id));
var result = await _mediator.Send(new GetCertificateQuery(id), ct);

if (result is null)
return NotFound();
Expand All @@ -60,7 +58,7 @@ public async Task<IActionResult> GetAllAsync()
[HttpPut]
[Route("id")]
public async Task<ActionResult<UpdateCertificateDetailsCommandResult>> UpdateAsync(
long id, UpdateCertificateDetailsCommandModel model, CancellationToken ct)
long id, [FromBody] UpdateCertificateDetailsCommandModel model, CancellationToken ct)
{
var result = await _mediator.Send(
new UpdateCertificateDetailsCommand(
Expand Down Expand Up @@ -96,7 +94,7 @@ public async Task<ActionResult<UpdateCertificateDetailsCommandResult>> UpdateAsy
[HttpPost]
[Route("")]
public async Task<ActionResult<CreateCertificateCommandResult>> AddAsync(
CreateCertificateDetailsCommandModel model,
[FromBody] CreateCertificateDetailsCommandModel model,
CancellationToken ct)
{
var result = await _mediator.Send(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using O2NextGen.CertificateManagement.Domain.Entities;
using O2NextGen.CertificateManagement.Domain.Entities;

namespace O2NextGen.CertificateManagement.Application.Features.Certificates;

public class CreateCertificateDetailsCommandModel
{
Expand All @@ -20,5 +21,4 @@ public class CreateCertificateDetailsCommandModel
public long LockedDate { get; set; }
public string LockInfo { get; set; }
public ICollection<LanguageInfo> LanguageInfos { get; }
}

}
Loading