5 Commits

Author SHA1 Message Date
465e5bb1fc Remove temporary consumption of azure app config 2025-06-23 09:10:11 -06:00
889365baa6 Upgrade packages 2025-06-21 21:45:19 -06:00
Sergio Matias Urquin
c7953250fc Create general structures in Mongo and SQL 2025-05-18 15:49:46 -06:00
Sergio Matias Urquin
144a6c14c0 remove unnecesary package 2025-05-17 22:59:55 -06:00
Sergio Matias Urquin
c7ff7b8c18 remove old references 2025-05-17 22:58:49 -06:00
55 changed files with 387 additions and 391 deletions

View File

@@ -11,8 +11,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
<PackageReference Include="Core.Blueprint.KeyVault" Version="0.3.0-alpha0037" />
<PackageReference Include="MongoDB.Bson" Version="3.1.0" /> <PackageReference Include="MongoDB.Bson" Version="3.1.0" />
</ItemGroup> </ItemGroup>

View File

@@ -1,6 +1,6 @@
using Lib.Architecture.BuildingBlocks; using Lib.Architecture.BuildingBlocks;
namespace Core.Blueprint.Application.UsesCases.KeyVault.Input namespace Core.Blueprint.Application.UsesCases.BlobStorage.Input
{ {
public class DeleteBlobRequest : Notificator, ICommand public class DeleteBlobRequest : Notificator, ICommand
{ {

View File

@@ -1,6 +1,6 @@
using Lib.Architecture.BuildingBlocks; using Lib.Architecture.BuildingBlocks;
namespace Core.Blueprint.Application.UsesCases.KeyVault.Input namespace Core.Blueprint.Application.UsesCases.BlobStorage.Input
{ {
public class DownloadBlobRequest : Notificator, ICommand public class DownloadBlobRequest : Notificator, ICommand
{ {

View File

@@ -1,6 +1,6 @@
using Lib.Architecture.BuildingBlocks; using Lib.Architecture.BuildingBlocks;
namespace Core.Blueprint.Application.UsesCases.KeyVault.Input namespace Core.Blueprint.Application.UsesCases.BlobStorage.Input
{ {
public class GetBlobListRequest : Notificator, ICommand public class GetBlobListRequest : Notificator, ICommand
{ {

View File

@@ -1,6 +1,6 @@
using Lib.Architecture.BuildingBlocks; using Lib.Architecture.BuildingBlocks;
namespace Core.Blueprint.Application.UsesCases.KeyVault.Input namespace Core.Blueprint.Application.UsesCases.BlobStorage.Input
{ {
public class UploadBlobRequest : Notificator, ICommand public class UploadBlobRequest : Notificator, ICommand
{ {

View File

@@ -1,5 +1,5 @@
using Core.Blueprint.Application.UsesCases.BlobStorage.Ports; using Core.Blueprint.Application.UsesCases.BlobStorage.Input;
using Core.Blueprint.Application.UsesCases.KeyVault.Input; using Core.Blueprint.Application.UsesCases.BlobStorage.Ports;
using Core.Blueprint.Service.External.Clients; using Core.Blueprint.Service.External.Clients;
using Core.Blueprint.Storage; using Core.Blueprint.Storage;
using FluentValidation; using FluentValidation;

View File

@@ -1,4 +1,5 @@
using Core.Blueprint.Application.UsesCases.KeyVault.Input; using Core.Blueprint.Application.UsesCases.BlobStorage.Input;
using Core.Blueprint.Application.UsesCases.KeyVault.Input;
using FluentValidation; using FluentValidation;
namespace Core.Cerberos.Application.UseCases.KeyVault.Validator namespace Core.Cerberos.Application.UseCases.KeyVault.Validator

View File

@@ -1,4 +1,5 @@
using Core.Blueprint.Application.UsesCases.KeyVault.Input; using Core.Blueprint.Application.UsesCases.BlobStorage.Input;
using Core.Blueprint.Application.UsesCases.KeyVault.Input;
using FluentValidation; using FluentValidation;
namespace Core.Cerberos.Application.UseCases.KeyVault.Validator namespace Core.Cerberos.Application.UseCases.KeyVault.Validator

View File

@@ -1,4 +1,5 @@
using Core.Blueprint.Application.UsesCases.KeyVault.Input; using Core.Blueprint.Application.UsesCases.BlobStorage.Input;
using Core.Blueprint.Application.UsesCases.KeyVault.Input;
using FluentValidation; using FluentValidation;
namespace Core.Cerberos.Application.UseCases.KeyVault.Validator namespace Core.Cerberos.Application.UseCases.KeyVault.Validator

View File

@@ -4,7 +4,7 @@ using Core.Blueprint.Service.External.Clients.Adapters;
using Lib.Architecture.BuildingBlocks; using Lib.Architecture.BuildingBlocks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Core.Blueprint.Application.UsesCases.MongoStorage.Adapter namespace Core.Blueprint.Application.UsesCases.KeyVault.Adapter
{ {
public class KeyVaultPort : BasePresenter, IKeyVaultPort public class KeyVaultPort : BasePresenter, IKeyVaultPort
{ {

View File

@@ -3,15 +3,15 @@ using Core.Blueprint.Service.External.Clients.Adapters;
using Lib.Architecture.BuildingBlocks; using Lib.Architecture.BuildingBlocks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Core.Blueprint.Application.UsesCases.MongoStorage.Adapter namespace Core.Blueprint.Application.UsesCases.Mongo.Adapter
{ {
public class MongoPort : BasePresenter, IMongoPort public class MongoPort : BasePresenter, IMongoPort
{ {
public void Success(BlueprintAdapter output) public void Success(MongoSampleAdapter output)
{ {
ViewModel = new OkObjectResult(output); ViewModel = new OkObjectResult(output);
} }
public void Success(List<BlueprintAdapter> output) public void Success(List<MongoSampleAdapter> output)
{ {
ViewModel = new OkObjectResult(output); ViewModel = new OkObjectResult(output);
} }

View File

@@ -2,7 +2,7 @@
namespace Core.Blueprint.Application.UsesCases.Mongo.Input namespace Core.Blueprint.Application.UsesCases.Mongo.Input
{ {
public class CreateBlueprintRequest : Notificator, ICommand public class CreateMongoSampleRequest : Notificator, ICommand
{ {
public string Name { get; set; } = null!; public string Name { get; set; } = null!;

View File

@@ -2,7 +2,7 @@
namespace Core.Blueprint.Application.UsesCases.Mongo.Input namespace Core.Blueprint.Application.UsesCases.Mongo.Input
{ {
public class DeleteBlueprintRequest : Notificator, ICommand public class DeleteMongoSampleRequest : Notificator, ICommand
{ {
public string _Id { get; set; } public string _Id { get; set; }

View File

@@ -2,7 +2,7 @@
namespace Core.Blueprint.Application.UsesCases.Mongo.Input namespace Core.Blueprint.Application.UsesCases.Mongo.Input
{ {
public class GetAllBlueprintsRequest : Notificator, ICommand public class GetAllMongoSamplesRequest : Notificator, ICommand
{ {
public bool Validate() public bool Validate()
{ {

View File

@@ -2,7 +2,7 @@
namespace Core.Blueprint.Application.UsesCases.Mongo.Input namespace Core.Blueprint.Application.UsesCases.Mongo.Input
{ {
public class GetBlueprintRequest : Notificator, ICommand public class GetMongoSampleRequest : Notificator, ICommand
{ {
public string _Id { get; set; } public string _Id { get; set; }

View File

@@ -3,7 +3,7 @@ using Lib.Architecture.BuildingBlocks;
namespace Core.Blueprint.Application.UsesCases.Mongo.Input namespace Core.Blueprint.Application.UsesCases.Mongo.Input
{ {
public class UpdateBlueprintRequest : Notificator, ICommand public class UpdateMongoSampleRequest : Notificator, ICommand
{ {
public string Name { get; set; } = null!; public string Name { get; set; } = null!;
public string? Description { get; set; } public string? Description { get; set; }

View File

@@ -7,57 +7,57 @@ using FluentValidation;
using Lib.Architecture.BuildingBlocks; using Lib.Architecture.BuildingBlocks;
using Lib.Architecture.BuildingBlocks.Helpers; using Lib.Architecture.BuildingBlocks.Helpers;
namespace Core.Cerberos.Application.UseCases.Blueprints namespace Core.Blueprint.Application.UsesCases.Mongo
{ {
public class MongoHandler : public class MongoHandler :
IComponentHandler<CreateBlueprintRequest>, IComponentHandler<CreateMongoSampleRequest>,
IComponentHandler<GetBlueprintRequest>, IComponentHandler<GetMongoSampleRequest>,
IComponentHandler<GetAllBlueprintsRequest>, IComponentHandler<GetAllMongoSamplesRequest>,
IComponentHandler<UpdateBlueprintRequest>, IComponentHandler<UpdateMongoSampleRequest>,
IComponentHandler<DeleteBlueprintRequest> IComponentHandler<DeleteMongoSampleRequest>
{ {
private readonly IMongoPort _port; private readonly IMongoPort _port;
private readonly IValidator<CreateBlueprintRequest> _createBlueprintValidator; private readonly IValidator<CreateMongoSampleRequest> _createSampleValidator;
private readonly IValidator<GetBlueprintRequest> _getBlueprintValidator; private readonly IValidator<GetMongoSampleRequest> _getSampleValidator;
private readonly IValidator<UpdateBlueprintRequest> _updateBlueprintValidator; private readonly IValidator<UpdateMongoSampleRequest> _updateSampleValidator;
private readonly IValidator<DeleteBlueprintRequest> _deleteBlueprintValidator; private readonly IValidator<DeleteMongoSampleRequest> _deleteSampleValidator;
private readonly IBlueprintServiceClient _mongoDALService; private readonly IBlueprintServiceClient _blueprintServiceClient;
public MongoHandler( public MongoHandler(
IMongoPort port, IMongoPort port,
IValidator<CreateBlueprintRequest> createBlueprintValidator, IValidator<CreateMongoSampleRequest> createSampleValidator,
IValidator<GetBlueprintRequest> getBlueprintValidator, IValidator<GetMongoSampleRequest> getSampleValidator,
IValidator<UpdateBlueprintRequest> updateBlueprintValidator, IValidator<UpdateMongoSampleRequest> updateSampleValidator,
IValidator<DeleteBlueprintRequest> deleteBlueprintValidator, IValidator<DeleteMongoSampleRequest> deleteSampleValidator,
IBlueprintServiceClient mongoDALService) IBlueprintServiceClient blueprintServiceClient)
{ {
_port = port ?? throw new ArgumentNullException(nameof(port)); _port = port ?? throw new ArgumentNullException(nameof(port));
_createBlueprintValidator = createBlueprintValidator ?? throw new ArgumentNullException(nameof(createBlueprintValidator)); _createSampleValidator = createSampleValidator ?? throw new ArgumentNullException(nameof(createSampleValidator));
_getBlueprintValidator = getBlueprintValidator ?? throw new ArgumentNullException(nameof(getBlueprintValidator)); _getSampleValidator = getSampleValidator ?? throw new ArgumentNullException(nameof(getSampleValidator));
_updateBlueprintValidator = updateBlueprintValidator ?? throw new ArgumentNullException(nameof(updateBlueprintValidator)); _updateSampleValidator = updateSampleValidator ?? throw new ArgumentNullException(nameof(updateSampleValidator));
_deleteBlueprintValidator = deleteBlueprintValidator ?? throw new ArgumentNullException(nameof(deleteBlueprintValidator)); _deleteSampleValidator = deleteSampleValidator ?? throw new ArgumentNullException(nameof(deleteSampleValidator));
_mongoDALService = mongoDALService ?? throw new ArgumentNullException(nameof(mongoDALService)); _blueprintServiceClient = blueprintServiceClient ?? throw new ArgumentNullException(nameof(blueprintServiceClient));
} }
public async ValueTask ExecuteAsync(CreateBlueprintRequest command, CancellationToken cancellationToken = default) public async ValueTask ExecuteAsync(CreateMongoSampleRequest command, CancellationToken cancellationToken = default)
{ {
try try
{ {
ArgumentNullException.ThrowIfNull(command); ArgumentNullException.ThrowIfNull(command);
if (!command.IsValid(_createBlueprintValidator)) if (!command.IsValid(_createSampleValidator))
{ {
_port.ValidationErrors(command.Notifications); _port.ValidationErrors(command.Notifications);
return; return;
} }
var request = new BlueprintRequest var request = new MongoSampleRequest
{ {
Name = command.Name, Name = command.Name,
Description = command.Description, Description = command.Description,
}; };
var result = await _mongoDALService.CreateBlueprintAsync(request, cancellationToken).ConfigureAwait(false); var result = await _blueprintServiceClient.CreateMongoSampleAsync(request, cancellationToken).ConfigureAwait(false);
if (result == null) if (result == null)
{ {
@@ -73,13 +73,13 @@ namespace Core.Cerberos.Application.UseCases.Blueprints
} }
} }
public async ValueTask ExecuteAsync(GetAllBlueprintsRequest command, CancellationToken cancellationToken = default) public async ValueTask ExecuteAsync(GetAllMongoSamplesRequest command, CancellationToken cancellationToken = default)
{ {
try try
{ {
ArgumentNullException.ThrowIfNull(command); ArgumentNullException.ThrowIfNull(command);
var _result = await _mongoDALService.GetAllBlueprintsAsync().ConfigureAwait(false); var _result = await _blueprintServiceClient.GetAllMongoSamplesAsync().ConfigureAwait(false);
if (!_result.Any()) if (!_result.Any())
{ {
_port.NoContentSuccess(); _port.NoContentSuccess();
@@ -93,19 +93,19 @@ namespace Core.Cerberos.Application.UseCases.Blueprints
} }
} }
public async ValueTask ExecuteAsync(GetBlueprintRequest command, CancellationToken cancellationToken = default) public async ValueTask ExecuteAsync(GetMongoSampleRequest command, CancellationToken cancellationToken = default)
{ {
try try
{ {
ArgumentNullException.ThrowIfNull(command); ArgumentNullException.ThrowIfNull(command);
if (!command.IsValid(_getBlueprintValidator)) if (!command.IsValid(_getSampleValidator))
{ {
_port.ValidationErrors(command.Notifications); _port.ValidationErrors(command.Notifications);
return; return;
} }
var result = await _mongoDALService.GetBlueprintByIdAsync(command._Id, cancellationToken).ConfigureAwait(false); var result = await _blueprintServiceClient.GetMongoSampleByIdAsync(command._Id, cancellationToken).ConfigureAwait(false);
if (result == null) if (result == null)
{ {
@@ -122,19 +122,19 @@ namespace Core.Cerberos.Application.UseCases.Blueprints
} }
public async ValueTask ExecuteAsync(UpdateBlueprintRequest command, CancellationToken cancellationToken = default) public async ValueTask ExecuteAsync(UpdateMongoSampleRequest command, CancellationToken cancellationToken = default)
{ {
try try
{ {
ArgumentNullException.ThrowIfNull(command); ArgumentNullException.ThrowIfNull(command);
if (!command.IsValid(_updateBlueprintValidator)) if (!command.IsValid(_updateSampleValidator))
{ {
_port.ValidationErrors(command.Notifications); _port.ValidationErrors(command.Notifications);
return; return;
} }
var request = new BlueprintAdapter var request = new MongoSampleAdapter
{ {
Id = command.Id, Id = command.Id,
_Id = command._Id, _Id = command._Id,
@@ -149,7 +149,7 @@ namespace Core.Cerberos.Application.UseCases.Blueprints
string _id = command._Id; string _id = command._Id;
var result = await _mongoDALService.UpdateBlueprintAsync(_id, request, cancellationToken).ConfigureAwait(false); var result = await _blueprintServiceClient.UpdateMongoSampleAsync(_id, request, cancellationToken).ConfigureAwait(false);
if (result == null) if (result == null)
{ {
@@ -166,19 +166,19 @@ namespace Core.Cerberos.Application.UseCases.Blueprints
} }
public async ValueTask ExecuteAsync(DeleteBlueprintRequest command, CancellationToken cancellationToken = default) public async ValueTask ExecuteAsync(DeleteMongoSampleRequest command, CancellationToken cancellationToken = default)
{ {
try try
{ {
ArgumentNullException.ThrowIfNull(command); ArgumentNullException.ThrowIfNull(command);
if (!command.IsValid(_deleteBlueprintValidator)) if (!command.IsValid(_deleteSampleValidator))
{ {
_port.ValidationErrors(command.Notifications); _port.ValidationErrors(command.Notifications);
return; return;
} }
var result = await _mongoDALService.DeleteBlueprintAsync(command._Id, cancellationToken).ConfigureAwait(false); var result = await _blueprintServiceClient.DeleteMongoSampleAsync(command._Id, cancellationToken).ConfigureAwait(false);
if (result == null) if (result == null)
{ {

View File

@@ -4,8 +4,8 @@ using Lib.Architecture.BuildingBlocks;
namespace Core.Blueprint.Application.UsesCases.Mongo.Ports namespace Core.Blueprint.Application.UsesCases.Mongo.Ports
{ {
public interface IMongoPort : IBasePort, public interface IMongoPort : IBasePort,
ICommandSuccessPort<BlueprintAdapter>, ICommandSuccessPort<MongoSampleAdapter>,
ICommandSuccessPort<List<BlueprintAdapter>>, ICommandSuccessPort<List<MongoSampleAdapter>>,
INoContentPort, IBusinessErrorPort, ITimeoutPort, IValidationErrorPort, INoContentPort, IBusinessErrorPort, ITimeoutPort, IValidationErrorPort,
INotFoundPort, IForbiddenPort, IUnauthorizedPort, IInternalServerErrorPort, INotFoundPort, IForbiddenPort, IUnauthorizedPort, IInternalServerErrorPort,
IBadRequestPort IBadRequestPort

View File

@@ -1,13 +0,0 @@
using Core.Blueprint.Application.UsesCases.Mongo.Input;
using FluentValidation;
namespace Core.Cerberos.Application.UseCases.Blueprints.Validator
{
public class CreateBlueprintValidator : AbstractValidator<CreateBlueprintRequest>
{
public CreateBlueprintValidator()
{
RuleFor(i => i.Name).NotEmpty().NotNull().OverridePropertyName(x => x.Name).WithName("Blueprint Name").WithMessage("Blueprint Name is Obligatory.");
}
}
}

View File

@@ -0,0 +1,13 @@
using Core.Blueprint.Application.UsesCases.Mongo.Input;
using FluentValidation;
namespace Core.Cerberos.Application.UseCases.Mongo.Validator
{
public class CreateMongoSampleValidator : AbstractValidator<CreateMongoSampleRequest>
{
public CreateMongoSampleValidator()
{
RuleFor(i => i.Name).NotEmpty().NotNull().OverridePropertyName(x => x.Name).WithName("Sample Name").WithMessage("Sample Name is Obligatory.");
}
}
}

View File

@@ -1,13 +0,0 @@
using Core.Blueprint.Application.UsesCases.Mongo.Input;
using FluentValidation;
namespace Core.Cerberos.Application.UseCases.Blueprints.Validator
{
public class DeleteBlueprintValidator : AbstractValidator<DeleteBlueprintRequest>
{
public DeleteBlueprintValidator()
{
RuleFor(i => i._Id).NotEmpty().NotNull().OverridePropertyName(x => x._Id).WithName("Blueprint Mongo Identifier").WithMessage("Blueprint Mongo Identifier is Obligatory.");
}
}
}

View File

@@ -0,0 +1,13 @@
using Core.Blueprint.Application.UsesCases.Mongo.Input;
using FluentValidation;
namespace Core.Cerberos.Application.UseCases.Mongo.Validator
{
public class DeleteMongoSampleValidator : AbstractValidator<DeleteMongoSampleRequest>
{
public DeleteMongoSampleValidator()
{
RuleFor(i => i._Id).NotEmpty().NotNull().OverridePropertyName(x => x._Id).WithName("Sample Identifier").WithMessage("Sample Identifier is Obligatory.");
}
}
}

View File

@@ -1,13 +0,0 @@
using Core.Blueprint.Application.UsesCases.Mongo.Input;
using FluentValidation;
namespace Core.Cerberos.Application.UseCases.Blueprints.Validator
{
public class GetBlueprintValidator : AbstractValidator<GetBlueprintRequest>
{
public GetBlueprintValidator()
{
RuleFor(i => i._Id).NotEmpty().NotNull().OverridePropertyName(x => x._Id).WithName("Blueprint Mongo Identifier").WithMessage("Blueprint Mongo Identifier is Obligatory.");
}
}
}

View File

@@ -0,0 +1,13 @@
using Core.Blueprint.Application.UsesCases.Mongo.Input;
using FluentValidation;
namespace Core.Cerberos.Application.UseCases.Mongo.Validator
{
public class GetMongoSampleValidator : AbstractValidator<GetMongoSampleRequest>
{
public GetMongoSampleValidator()
{
RuleFor(i => i._Id).NotEmpty().NotNull().OverridePropertyName(x => x._Id).WithName("Sample Identifier").WithMessage("Sample Identifier is Obligatory.");
}
}
}

View File

@@ -1,17 +0,0 @@
using Core.Blueprint.Application.UsesCases.Mongo.Input;
using FluentValidation;
namespace Core.Cerberos.Application.UseCases.Blueprints.Validator
{
public class UpdateBlueprintValidator : AbstractValidator<UpdateBlueprintRequest>
{
public UpdateBlueprintValidator()
{
RuleFor(i => i._Id).NotEmpty().NotNull().OverridePropertyName(x => x._Id).WithName("Blueprint Mongo Identifier").WithMessage("Blueprint Mongo Identifier is Obligatory.");
RuleFor(i => i._Id).NotEmpty().NotNull().OverridePropertyName(x => x.Id).WithName("Blueprint GUID").WithMessage("Blueprint GUID is Obligatory.");
RuleFor(i => i.Name).NotEmpty().NotNull().OverridePropertyName(x => x.Name).WithName("Blueprint Name").WithMessage("Blueprint Name is Obligatory.");
RuleFor(i => i.Status).NotNull().OverridePropertyName(x => x.Status).WithName("Blueprint Status").WithMessage("Blueprint Status is Obligatory.");
RuleFor(i => i.CreatedAt).NotNull().OverridePropertyName(x => x.CreatedAt).WithName("Blueprint CreatedAt").WithMessage("Blueprint CreatedAt is Obligatory.");
}
}
}

View File

@@ -0,0 +1,17 @@
using Core.Blueprint.Application.UsesCases.Mongo.Input;
using FluentValidation;
namespace Core.Cerberos.Application.UseCases.Mongo.Validator
{
public class UpdateMongoSampleValidator : AbstractValidator<UpdateMongoSampleRequest>
{
public UpdateMongoSampleValidator()
{
RuleFor(i => i._Id).NotEmpty().NotNull().OverridePropertyName(x => x._Id).WithName("Sample Identifier").WithMessage("Sample Identifier is Obligatory.");
RuleFor(i => i._Id).NotEmpty().NotNull().OverridePropertyName(x => x.Id).WithName("Sample GUID").WithMessage("Sample GUID is Obligatory.");
RuleFor(i => i.Name).NotEmpty().NotNull().OverridePropertyName(x => x.Name).WithName("Sample Name").WithMessage("Sample Name is Obligatory.");
RuleFor(i => i.Status).NotNull().OverridePropertyName(x => x.Status).WithName("Sample Status").WithMessage("Sample Status is Obligatory.");
RuleFor(i => i.CreatedAt).NotNull().OverridePropertyName(x => x.CreatedAt).WithName("Sample CreatedAt").WithMessage("Sample CreatedAt is Obligatory.");
}
}
}

View File

@@ -7,11 +7,11 @@ namespace Core.Blueprint.Application.UsesCases.SQL.Adapter
{ {
public class SQLPort : BasePresenter, ISQLPort public class SQLPort : BasePresenter, ISQLPort
{ {
public void Success(UserProjectAdapter output) public void Success(SqlSampleAdapter output)
{ {
ViewModel = new OkObjectResult(output); ViewModel = new OkObjectResult(output);
} }
public void Success(List<UserProjectAdapter> output) public void Success(List<SqlSampleAdapter> output)
{ {
ViewModel = new OkObjectResult(output); ViewModel = new OkObjectResult(output);
} }

View File

@@ -0,0 +1,15 @@
using Lib.Architecture.BuildingBlocks;
namespace Core.Blueprint.Application.UsesCases.SQL.Input
{
public class CreateSqlSampleRequest : Notificator, ICommand
{
public string Name { get; set; } = null!;
public string Description { get; set; } = null!;
public bool Validate()
{
return Name != null && Name != string.Empty;
}
}
}

View File

@@ -1,16 +0,0 @@
using Lib.Architecture.BuildingBlocks;
namespace Core.Blueprint.Application.UsesCases.SQL.Input
{
public class CreateUserProjectRequest : Notificator, ICommand
{
public string ProjectCode { get; set; } = null!;
public string ProjectDescription { get; set; } = null!;
public string UserId { get; set; } = null!;
public bool Validate()
{
return ProjectCode != null && ProjectCode != string.Empty;
}
}
}

View File

@@ -2,7 +2,7 @@
namespace Core.Blueprint.Application.UsesCases.SQL.Input namespace Core.Blueprint.Application.UsesCases.SQL.Input
{ {
public class DeleteUserProjectRequest : Notificator, ICommand public class DeleteSqlSampleRequest : Notificator, ICommand
{ {
public int Id { get; set; } public int Id { get; set; }

View File

@@ -2,7 +2,7 @@
namespace Core.Blueprint.Application.UsesCases.SQL.Input namespace Core.Blueprint.Application.UsesCases.SQL.Input
{ {
public class GetAllUserProjectsRequest : Notificator, ICommand public class GetAllSqlSamplesRequest : Notificator, ICommand
{ {
public bool Validate() public bool Validate()
{ {

View File

@@ -2,7 +2,7 @@
namespace Core.Blueprint.Application.UsesCases.SQL.Input namespace Core.Blueprint.Application.UsesCases.SQL.Input
{ {
public class GetUserProjectRequest : Notificator, ICommand public class GetSqlSampleRequest : Notificator, ICommand
{ {
public int Id { get; set; } public int Id { get; set; }

View File

@@ -3,11 +3,10 @@ using Lib.Architecture.BuildingBlocks;
namespace Core.Blueprint.Application.UsesCases.SQL.Input namespace Core.Blueprint.Application.UsesCases.SQL.Input
{ {
public class UpdateUserProjectRequest : Notificator, ICommand public class UpdateSqlSampleRequest : Notificator, ICommand
{ {
public string ProjectCode { get; set; } = null!; public string Name { get; set; } = null!;
public string ProjectDescription { get; set; } = null!; public string Description { get; set; } = null!;
public string UserId { get; set; } = null!;
public int Id { get; set; } public int Id { get; set; }
public string Guid { get; set; } = null!; public string Guid { get; set; } = null!;
public DateTime CreatedAt { get; set; } public DateTime CreatedAt { get; set; }

View File

@@ -4,8 +4,8 @@ using Lib.Architecture.BuildingBlocks;
namespace Core.Blueprint.Application.UsesCases.SQL.Ports namespace Core.Blueprint.Application.UsesCases.SQL.Ports
{ {
public interface ISQLPort : IBasePort, public interface ISQLPort : IBasePort,
ICommandSuccessPort<UserProjectAdapter>, ICommandSuccessPort<SqlSampleAdapter>,
ICommandSuccessPort<List<UserProjectAdapter>>, ICommandSuccessPort<List<SqlSampleAdapter>>,
INoContentPort, IBusinessErrorPort, ITimeoutPort, IValidationErrorPort, INoContentPort, IBusinessErrorPort, ITimeoutPort, IValidationErrorPort,
INotFoundPort, IForbiddenPort, IUnauthorizedPort, IInternalServerErrorPort, INotFoundPort, IForbiddenPort, IUnauthorizedPort, IInternalServerErrorPort,
IBadRequestPort IBadRequestPort

View File

@@ -7,58 +7,57 @@ using FluentValidation;
using Lib.Architecture.BuildingBlocks; using Lib.Architecture.BuildingBlocks;
using Lib.Architecture.BuildingBlocks.Helpers; using Lib.Architecture.BuildingBlocks.Helpers;
namespace Core.Cerberos.Application.UseCases.UserProjects namespace Core.Blueprint.Application.UsesCases.SQL
{ {
public class SQLHandler : public class SQLHandler :
IComponentHandler<CreateUserProjectRequest>, IComponentHandler<CreateSqlSampleRequest>,
IComponentHandler<GetUserProjectRequest>, IComponentHandler<GetSqlSampleRequest>,
IComponentHandler<GetAllUserProjectsRequest>, IComponentHandler<GetAllSqlSamplesRequest>,
IComponentHandler<UpdateUserProjectRequest>, IComponentHandler<UpdateSqlSampleRequest>,
IComponentHandler<DeleteUserProjectRequest> IComponentHandler<DeleteSqlSampleRequest>
{ {
private readonly ISQLPort _port; private readonly ISQLPort _port;
private readonly IValidator<CreateUserProjectRequest> _createUserProjectValidator; private readonly IValidator<CreateSqlSampleRequest> _createSampleValidator;
private readonly IValidator<GetUserProjectRequest> _getUserProjectValidator; private readonly IValidator<GetSqlSampleRequest> _getSampleValidator;
private readonly IValidator<UpdateUserProjectRequest> _updateUserProjectValidator; private readonly IValidator<UpdateSqlSampleRequest> _updateSampleValidator;
private readonly IValidator<DeleteUserProjectRequest> _deleteUserProjectValidator; private readonly IValidator<DeleteSqlSampleRequest> _deleteSampleValidator;
private readonly IBlueprintServiceClient _SQLDALService; private readonly IBlueprintServiceClient _SQLDALService;
public SQLHandler( public SQLHandler(
ISQLPort port, ISQLPort port,
IValidator<CreateUserProjectRequest> createUserProjectValidator, IValidator<CreateSqlSampleRequest> createSampleValidator,
IValidator<GetUserProjectRequest> getUserProjectValidator, IValidator<GetSqlSampleRequest> getSampleValidator,
IValidator<UpdateUserProjectRequest> updateUserProjectValidator, IValidator<UpdateSqlSampleRequest> updateSampleValidator,
IValidator<DeleteUserProjectRequest> deleteUserProjectValidator, IValidator<DeleteSqlSampleRequest> deleteSampleValidator,
IBlueprintServiceClient SQLDALService) IBlueprintServiceClient SQLDALService)
{ {
_port = port ?? throw new ArgumentNullException(nameof(port)); _port = port ?? throw new ArgumentNullException(nameof(port));
_createUserProjectValidator = createUserProjectValidator ?? throw new ArgumentNullException(nameof(createUserProjectValidator)); _createSampleValidator = createSampleValidator ?? throw new ArgumentNullException(nameof(createSampleValidator));
_getUserProjectValidator = getUserProjectValidator ?? throw new ArgumentNullException(nameof(getUserProjectValidator)); _getSampleValidator = getSampleValidator ?? throw new ArgumentNullException(nameof(getSampleValidator));
_updateUserProjectValidator = updateUserProjectValidator ?? throw new ArgumentNullException(nameof(updateUserProjectValidator)); _updateSampleValidator = updateSampleValidator ?? throw new ArgumentNullException(nameof(updateSampleValidator));
_deleteUserProjectValidator = deleteUserProjectValidator ?? throw new ArgumentNullException(nameof(deleteUserProjectValidator)); _deleteSampleValidator = deleteSampleValidator ?? throw new ArgumentNullException(nameof(deleteSampleValidator));
_SQLDALService = SQLDALService ?? throw new ArgumentNullException(nameof(SQLDALService)); _SQLDALService = SQLDALService ?? throw new ArgumentNullException(nameof(SQLDALService));
} }
public async ValueTask ExecuteAsync(CreateUserProjectRequest command, CancellationToken cancellationToken = default) public async ValueTask ExecuteAsync(CreateSqlSampleRequest command, CancellationToken cancellationToken = default)
{ {
try try
{ {
ArgumentNullException.ThrowIfNull(command); ArgumentNullException.ThrowIfNull(command);
if (!command.IsValid(_createUserProjectValidator)) if (!command.IsValid(_createSampleValidator))
{ {
_port.ValidationErrors(command.Notifications); _port.ValidationErrors(command.Notifications);
return; return;
} }
var request = new UserProjectRequest var request = new SqlSampleRequest
{ {
ProjectCode = command.ProjectCode, Name = command.Name,
ProjectDescription = command.ProjectDescription, Description = command.Description,
UserId = command.UserId,
}; };
var result = await _SQLDALService.CreateUserProjectAsync(request, cancellationToken).ConfigureAwait(false); var result = await _SQLDALService.CreateSqlSampleAsync(request, cancellationToken).ConfigureAwait(false);
if (result == null) if (result == null)
{ {
@@ -74,13 +73,13 @@ namespace Core.Cerberos.Application.UseCases.UserProjects
} }
} }
public async ValueTask ExecuteAsync(GetAllUserProjectsRequest command, CancellationToken cancellationToken = default) public async ValueTask ExecuteAsync(GetAllSqlSamplesRequest command, CancellationToken cancellationToken = default)
{ {
try try
{ {
ArgumentNullException.ThrowIfNull(command); ArgumentNullException.ThrowIfNull(command);
var _result = await _SQLDALService.GetAllUserProjectsAsync().ConfigureAwait(false); var _result = await _SQLDALService.GetAllSqlSamplesAsync().ConfigureAwait(false);
if (!_result.Any()) if (!_result.Any())
{ {
_port.NoContentSuccess(); _port.NoContentSuccess();
@@ -94,13 +93,19 @@ namespace Core.Cerberos.Application.UseCases.UserProjects
} }
} }
public async ValueTask ExecuteAsync(GetUserProjectRequest command, CancellationToken cancellationToken = default) public async ValueTask ExecuteAsync(GetSqlSampleRequest command, CancellationToken cancellationToken = default)
{ {
try try
{ {
ArgumentNullException.ThrowIfNull(command); ArgumentNullException.ThrowIfNull(command);
var result = await _SQLDALService.GetUserProjectByIdAsync(command.Id, cancellationToken).ConfigureAwait(false); if (!command.IsValid(_getSampleValidator))
{
_port.ValidationErrors(command.Notifications);
return;
}
var result = await _SQLDALService.GetSqlSampleByIdAsync(command.Id, cancellationToken).ConfigureAwait(false);
if (result == null) if (result == null)
{ {
@@ -117,25 +122,24 @@ namespace Core.Cerberos.Application.UseCases.UserProjects
} }
public async ValueTask ExecuteAsync(UpdateUserProjectRequest command, CancellationToken cancellationToken = default) public async ValueTask ExecuteAsync(UpdateSqlSampleRequest command, CancellationToken cancellationToken = default)
{ {
try try
{ {
ArgumentNullException.ThrowIfNull(command); ArgumentNullException.ThrowIfNull(command);
if (!command.IsValid(_updateUserProjectValidator)) if (!command.IsValid(_updateSampleValidator))
{ {
_port.ValidationErrors(command.Notifications); _port.ValidationErrors(command.Notifications);
return; return;
} }
var request = new UserProjectAdapter var request = new SqlSampleAdapter
{ {
Id = command.Id, Id = command.Id,
Guid = command.Guid, Guid = command.Guid,
UserId = command.UserId, ProjectCode = command.Name,
ProjectCode = command.ProjectCode, ProjectDescription = command.Description,
ProjectDescription = command.ProjectDescription,
CreatedAt = command.CreatedAt, CreatedAt = command.CreatedAt,
CreatedBy = command.CreatedBy, CreatedBy = command.CreatedBy,
UpdatedAt = command.UpdatedAt, UpdatedAt = command.UpdatedAt,
@@ -145,7 +149,7 @@ namespace Core.Cerberos.Application.UseCases.UserProjects
int id = command.Id; int id = command.Id;
var result = await _SQLDALService.UpdateUserProjectAsync(id, request, cancellationToken).ConfigureAwait(false); var result = await _SQLDALService.UpdateSqlSampleAsync(id, request, cancellationToken).ConfigureAwait(false);
if (result == null) if (result == null)
{ {
@@ -162,19 +166,19 @@ namespace Core.Cerberos.Application.UseCases.UserProjects
} }
public async ValueTask ExecuteAsync(DeleteUserProjectRequest command, CancellationToken cancellationToken = default) public async ValueTask ExecuteAsync(DeleteSqlSampleRequest command, CancellationToken cancellationToken = default)
{ {
try try
{ {
ArgumentNullException.ThrowIfNull(command); ArgumentNullException.ThrowIfNull(command);
if (!command.IsValid(_deleteUserProjectValidator)) if (!command.IsValid(_deleteSampleValidator))
{ {
_port.ValidationErrors(command.Notifications); _port.ValidationErrors(command.Notifications);
return; return;
} }
var result = await _SQLDALService.DeleteUserProjectAsync(command.Id, cancellationToken).ConfigureAwait(false); var result = await _SQLDALService.DeleteSqlSampleAsync(command.Id, cancellationToken).ConfigureAwait(false);
if (result == null) if (result == null)
{ {

View File

@@ -0,0 +1,14 @@
using Core.Blueprint.Application.UsesCases.SQL.Input;
using FluentValidation;
namespace Core.Cerberos.Application.UseCases.SQL.Validator
{
public class CreateSqlSampleValidator : AbstractValidator<CreateSqlSampleRequest>
{
public CreateSqlSampleValidator()
{
RuleFor(i => i.Name).NotEmpty().NotNull().OverridePropertyName(x => x.Name).WithName("Sample Name").WithMessage("Sample Name is Obligatory.");
RuleFor(i => i.Description).NotEmpty().NotNull().OverridePropertyName(x => x.Description).WithName("Sample Description").WithMessage("Sample Description is Obligatory.");
}
}
}

View File

@@ -1,15 +0,0 @@
using Core.Blueprint.Application.UsesCases.SQL.Input;
using FluentValidation;
namespace Core.Cerberos.Application.UseCases.SQL.Validator
{
public class CreateUserProjectValidator : AbstractValidator<CreateUserProjectRequest>
{
public CreateUserProjectValidator()
{
RuleFor(i => i.ProjectCode).NotEmpty().NotNull().OverridePropertyName(x => x.ProjectCode).WithName("Project Code").WithMessage("Project Code is Obligatory.");
RuleFor(i => i.ProjectDescription).NotEmpty().NotNull().OverridePropertyName(x => x.ProjectDescription).WithName("Project Description").WithMessage("Project Description is Obligatory.");
RuleFor(i => i.UserId).NotEmpty().NotNull().OverridePropertyName(x => x.UserId).WithName("User Identifier").WithMessage("User Identifier is Obligatory.");
}
}
}

View File

@@ -3,11 +3,11 @@ using FluentValidation;
namespace Core.Cerberos.Application.UseCases.SQL.Validator namespace Core.Cerberos.Application.UseCases.SQL.Validator
{ {
public class GetUserProjectValidator : AbstractValidator<GetUserProjectRequest> public class DeleteSqlSampleValidator : AbstractValidator<DeleteSqlSampleRequest>
{ {
public GetUserProjectValidator() public DeleteSqlSampleValidator()
{ {
RuleFor(i => i.Id).NotEmpty().NotNull().OverridePropertyName(x => x.Id).WithName("User Project Identifier").WithMessage("User Project Identifier is Obligatory."); RuleFor(i => i.Id).NotEmpty().NotNull().OverridePropertyName(x => x.Id).WithName("Sample Identifier").WithMessage("Sample Identifier is Obligatory.");
} }
} }
} }

View File

@@ -1,13 +0,0 @@
using Core.Blueprint.Application.UsesCases.SQL.Input;
using FluentValidation;
namespace Core.Cerberos.Application.UseCases.SQL.Validator
{
public class DeleteUserProjectValidator : AbstractValidator<DeleteUserProjectRequest>
{
public DeleteUserProjectValidator()
{
RuleFor(i => i.Id).NotEmpty().NotNull().OverridePropertyName(x => x.Id).WithName("User Project Identifier").WithMessage("User Project Identifier is Obligatory.");
}
}
}

View File

@@ -0,0 +1,13 @@
using Core.Blueprint.Application.UsesCases.SQL.Input;
using FluentValidation;
namespace Core.Cerberos.Application.UseCases.SQL.Validator
{
public class GetSqlSampleValidator : AbstractValidator<GetSqlSampleRequest>
{
public GetSqlSampleValidator()
{
RuleFor(i => i.Id).NotEmpty().NotNull().OverridePropertyName(x => x.Id).WithName("Sample Identifier").WithMessage("Sample Identifier is Obligatory.");
}
}
}

View File

@@ -0,0 +1,18 @@
using Core.Blueprint.Application.UsesCases.SQL.Input;
using FluentValidation;
namespace Core.Cerberos.Application.UseCases.SQL.Validator
{
public class UpdateSqlSampleValidator : AbstractValidator<UpdateSqlSampleRequest>
{
public UpdateSqlSampleValidator()
{
RuleFor(i => i.Id).NotEmpty().NotNull().OverridePropertyName(x => x.Id).WithName("Sample Identifier").WithMessage("UserPoject Identifier is Obligatory.");
RuleFor(i => i.Guid).NotEmpty().NotNull().OverridePropertyName(x => x.Guid).WithName("Sample GUID").WithMessage("Sample GUID is Obligatory.");
RuleFor(i => i.Name).NotEmpty().NotNull().OverridePropertyName(x => x.Name).WithName("Sample Name").WithMessage("Sample Name is Obligatory.");
RuleFor(i => i.Description).NotEmpty().NotNull().OverridePropertyName(x => x.Description).WithName("Project Description").WithMessage("Project Description is Obligatory.");
RuleFor(i => i.Status).NotNull().OverridePropertyName(x => x.Status).WithName("Sample Status").WithMessage("Sample Status is Obligatory.");
RuleFor(i => i.CreatedAt).NotNull().OverridePropertyName(x => x.CreatedAt).WithName("Sample CreatedAt").WithMessage("Sample CreatedAt is Obligatory.");
}
}
}

View File

@@ -1,19 +0,0 @@
using Core.Blueprint.Application.UsesCases.SQL.Input;
using FluentValidation;
namespace Core.Cerberos.Application.UseCases.SQL.Validator
{
public class UpdateUserProjectValidator : AbstractValidator<UpdateUserProjectRequest>
{
public UpdateUserProjectValidator()
{
RuleFor(i => i.Id).NotEmpty().NotNull().OverridePropertyName(x => x.Id).WithName("UserProject Identifier").WithMessage("UserPoject Identifier is Obligatory.");
RuleFor(i => i.Guid).NotEmpty().NotNull().OverridePropertyName(x => x.Guid).WithName("UserProject GUID").WithMessage("UserProject GUID is Obligatory.");
RuleFor(i => i.ProjectCode).NotEmpty().NotNull().OverridePropertyName(x => x.ProjectCode).WithName("Project Code").WithMessage("Project Code is Obligatory.");
RuleFor(i => i.ProjectDescription).NotEmpty().NotNull().OverridePropertyName(x => x.ProjectDescription).WithName("Project Description").WithMessage("Project Description is Obligatory.");
RuleFor(i => i.UserId).NotEmpty().NotNull().OverridePropertyName(x => x.UserId).WithName("User Identifier").WithMessage("User Identifier is Obligatory.");
RuleFor(i => i.Status).NotNull().OverridePropertyName(x => x.Status).WithName("UserProject Status").WithMessage("UserProject Status is Obligatory.");
RuleFor(i => i.CreatedAt).NotNull().OverridePropertyName(x => x.CreatedAt).WithName("UserProject CreatedAt").WithMessage("UserProject CreatedAt is Obligatory.");
}
}
}

View File

@@ -1,4 +1,5 @@
using Asp.Versioning; using Asp.Versioning;
using Core.Blueprint.Application.UsesCases.BlobStorage.Input;
using Core.Blueprint.Application.UsesCases.BlobStorage.Ports; using Core.Blueprint.Application.UsesCases.BlobStorage.Ports;
using Core.Blueprint.Application.UsesCases.KeyVault.Input; using Core.Blueprint.Application.UsesCases.KeyVault.Input;
using Lib.Architecture.BuildingBlocks; using Lib.Architecture.BuildingBlocks;

View File

@@ -7,43 +7,43 @@ using Microsoft.AspNetCore.Mvc;
namespace Core.Cerberos.Service.API.Controllers namespace Core.Cerberos.Service.API.Controllers
{ {
/// <summary> /// <summary>
/// Handles all services and business rules related to <see cref="MongoBlueprintController"/>. /// Handles all services and business rules related to <see cref="MongoSampleController"/>.
/// </summary> /// </summary>
[ApiVersion("1.0")] [ApiVersion("1.0")]
[Route("api/v{api-version:apiVersion}/[controller]")] [Route("api/v{api-version:apiVersion}/[controller]")]
[Produces("application/json")] [Produces("application/json")]
[ApiController] [ApiController]
public class MongoBlueprintController : ControllerBase public class MongoSampleController : ControllerBase
{ {
private readonly IComponentHandler<CreateBlueprintRequest> createBlueprintHandler; private readonly IComponentHandler<CreateMongoSampleRequest> createSampleHandler;
private readonly IComponentHandler<GetAllBlueprintsRequest> getAllBlueprintsHandler; private readonly IComponentHandler<GetAllMongoSamplesRequest> getAllSamplesHandler;
private readonly IComponentHandler<GetBlueprintRequest> getBlueprintHandler; private readonly IComponentHandler<GetMongoSampleRequest> getSampleHandler;
private readonly IComponentHandler<UpdateBlueprintRequest> updateBlueprintHandler; private readonly IComponentHandler<UpdateMongoSampleRequest> updateSampleHandler;
private readonly IComponentHandler<DeleteBlueprintRequest> deleteBlueprintHandler; private readonly IComponentHandler<DeleteMongoSampleRequest> deleteSampleHandler;
private readonly IMongoPort port; private readonly IMongoPort port;
/// <summary> /// <summary>
/// Handles all services and business rules related to <see cref="MongoBlueprintController"/>. /// Handles all services and business rules related to <see cref="MongoSampleController"/>.
/// </summary> /// </summary>
public MongoBlueprintController( public MongoSampleController(
IComponentHandler<GetBlueprintRequest> getBlueprintHandler, IComponentHandler<GetMongoSampleRequest> getSampleHandler,
IComponentHandler<GetAllBlueprintsRequest> getAllBlueprintsHandler, IComponentHandler<GetAllMongoSamplesRequest> getAllSamplesHandler,
IComponentHandler<CreateBlueprintRequest> createBlueprintHandler, IComponentHandler<CreateMongoSampleRequest> createSampleHandler,
IComponentHandler<UpdateBlueprintRequest> updateBlueprintHandler, IComponentHandler<UpdateMongoSampleRequest> updateSampleHandler,
IComponentHandler<DeleteBlueprintRequest> deleteBlueprintHandler, IComponentHandler<DeleteMongoSampleRequest> deleteSampleHandler,
IMongoPort port IMongoPort port
) )
{ {
this.createBlueprintHandler = createBlueprintHandler; this.createSampleHandler = createSampleHandler;
this.updateBlueprintHandler = updateBlueprintHandler; this.updateSampleHandler = updateSampleHandler;
this.deleteBlueprintHandler = deleteBlueprintHandler; this.deleteSampleHandler = deleteSampleHandler;
this.getAllBlueprintsHandler = getAllBlueprintsHandler; this.getAllSamplesHandler = getAllSamplesHandler;
this.getBlueprintHandler = getBlueprintHandler; this.getSampleHandler = getSampleHandler;
this.port = port; this.port = port;
} }
/// <summary> /// <summary>
/// Creates a new blueprint. /// Creates a new sample.
/// </summary> /// </summary>
[HttpPost("Create")] [HttpPost("Create")]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
@@ -53,14 +53,14 @@ namespace Core.Cerberos.Service.API.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<IActionResult> CreateBlueprintAsync([FromBody] CreateBlueprintRequest newBlueprint, CancellationToken cancellationToken = default) public async Task<IActionResult> CreateSampleAsync([FromBody] CreateMongoSampleRequest newSample, CancellationToken cancellationToken = default)
{ {
await createBlueprintHandler.ExecuteAsync(newBlueprint, cancellationToken).ConfigureAwait(false); await createSampleHandler.ExecuteAsync(newSample, cancellationToken).ConfigureAwait(false);
return port.ViewModel; return port.ViewModel;
} }
/// <summary> /// <summary>
/// Gets all blueprints. /// Gets all samples.
/// </summary> /// </summary>
[HttpGet("GetAll")] [HttpGet("GetAll")]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
@@ -70,14 +70,14 @@ namespace Core.Cerberos.Service.API.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<IActionResult> GetAllBlueprintsAsync(CancellationToken cancellationToken) public async Task<IActionResult> GetAllSamplesAsync(CancellationToken cancellationToken)
{ {
await getAllBlueprintsHandler.ExecuteAsync(new GetAllBlueprintsRequest { }, cancellationToken).ConfigureAwait(false); await getAllSamplesHandler.ExecuteAsync(new GetAllMongoSamplesRequest { }, cancellationToken).ConfigureAwait(false);
return port.ViewModel; return port.ViewModel;
} }
/// <summary> /// <summary>
/// Gets the blueprint by identifier. /// Gets the sample by identifier.
/// </summary> /// </summary>
[HttpPost] [HttpPost]
[Route("GetById")] [Route("GetById")]
@@ -88,17 +88,17 @@ namespace Core.Cerberos.Service.API.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> GetBlueprintById([FromBody] GetBlueprintRequest request, CancellationToken cancellationToken) public async Task<IActionResult> GetSampleById([FromBody] GetMongoSampleRequest request, CancellationToken cancellationToken)
{ {
if (string.IsNullOrEmpty(request._Id)) { return BadRequest("Invalid blueprint identifier"); } if (string.IsNullOrEmpty(request._Id)) { return BadRequest("Invalid sample identifier"); }
await getBlueprintHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); await getSampleHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false);
return port.ViewModel; return port.ViewModel;
} }
/// <summary> /// <summary>
/// Updates a full blueprint by identifier. /// Updates a full sample by identifier.
/// </summary> /// </summary>
[HttpPut("Update")] [HttpPut("Update")]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
@@ -108,17 +108,17 @@ namespace Core.Cerberos.Service.API.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<IActionResult> UpdateBlueprintAsync([FromBody] UpdateBlueprintRequest request, CancellationToken cancellationToken = default) public async Task<IActionResult> UpdateSampleAsync([FromBody] UpdateMongoSampleRequest request, CancellationToken cancellationToken = default)
{ {
if (string.IsNullOrEmpty(request._Id)) { return BadRequest("Invalid blueprint identifier"); } if (string.IsNullOrEmpty(request._Id)) { return BadRequest("Invalid sample identifier"); }
await updateBlueprintHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); await updateSampleHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false);
return port.ViewModel; return port.ViewModel;
} }
/// <summary> /// <summary>
/// Deletes a blueprint. /// Deletes a sample.
/// </summary> /// </summary>
[HttpDelete] [HttpDelete]
[Route("Delete")] [Route("Delete")]
@@ -129,12 +129,12 @@ namespace Core.Cerberos.Service.API.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> DeleteBlueprintAsync([FromBody] DeleteBlueprintRequest request, public async Task<IActionResult> DeleteSampleAsync([FromBody] DeleteMongoSampleRequest request,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
if (string.IsNullOrEmpty(request._Id)) { return BadRequest("Invalid blueprint identifier"); } if (string.IsNullOrEmpty(request._Id)) { return BadRequest("Invalid sample identifier"); }
await deleteBlueprintHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); await deleteSampleHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false);
return port.ViewModel; return port.ViewModel;
} }

View File

@@ -7,43 +7,43 @@ using Microsoft.AspNetCore.Mvc;
namespace Core.Cerberos.Service.API.Controllers namespace Core.Cerberos.Service.API.Controllers
{ {
/// <summary> /// <summary>
/// Handles all services and business rules related to <see cref="SQLUserProjectController"/>. /// Handles all services and business rules related to <see cref="SqlSampleController"/>.
/// </summary> /// </summary>
[ApiVersion("1.0")] [ApiVersion("1.0")]
[Route("api/v{api-version:apiVersion}/[controller]")] [Route("api/v{api-version:apiVersion}/[controller]")]
[Produces("application/json")] [Produces("application/json")]
[ApiController] [ApiController]
public class SQLUserProjectController : ControllerBase public class SqlSampleController : ControllerBase
{ {
private readonly IComponentHandler<CreateUserProjectRequest> createUserProjectHandler; private readonly IComponentHandler<CreateSqlSampleRequest> createSampleHandler;
private readonly IComponentHandler<GetAllUserProjectsRequest> getAllUserProjectsHandler; private readonly IComponentHandler<GetAllSqlSamplesRequest> getAllSamplesHandler;
private readonly IComponentHandler<GetUserProjectRequest> getUserProjectHandler; private readonly IComponentHandler<GetSqlSampleRequest> getSampleHandler;
private readonly IComponentHandler<UpdateUserProjectRequest> updateUserProjectHandler; private readonly IComponentHandler<UpdateSqlSampleRequest> updateSampleHandler;
private readonly IComponentHandler<DeleteUserProjectRequest> deleteUserProjectStatusHandler; private readonly IComponentHandler<DeleteSqlSampleRequest> deleteSampleStatusHandler;
private readonly ISQLPort port; private readonly ISQLPort port;
/// <summary> /// <summary>
/// Handles all services and business rules related to <see cref="SQLUserProjectController"/>. /// Handles all services and business rules related to <see cref="SqlSampleController"/>.
/// </summary> /// </summary>
public SQLUserProjectController( public SqlSampleController(
IComponentHandler<GetUserProjectRequest> getUserProjectHandler, IComponentHandler<GetSqlSampleRequest> getSampleHandler,
IComponentHandler<GetAllUserProjectsRequest> getAllUserProjectsHandler, IComponentHandler<GetAllSqlSamplesRequest> getAllSamplesHandler,
IComponentHandler<CreateUserProjectRequest> createUserProjectHandler, IComponentHandler<CreateSqlSampleRequest> createSampleHandler,
IComponentHandler<UpdateUserProjectRequest> updateUserProjectHandler, IComponentHandler<UpdateSqlSampleRequest> updateSampleHandler,
IComponentHandler<DeleteUserProjectRequest> deleteUserProjectStatusHandler, IComponentHandler<DeleteSqlSampleRequest> deleteSampleStatusHandler,
ISQLPort port ISQLPort port
) )
{ {
this.createUserProjectHandler = createUserProjectHandler; this.createSampleHandler = createSampleHandler;
this.updateUserProjectHandler = updateUserProjectHandler; this.updateSampleHandler = updateSampleHandler;
this.deleteUserProjectStatusHandler = deleteUserProjectStatusHandler; this.deleteSampleStatusHandler = deleteSampleStatusHandler;
this.getAllUserProjectsHandler = getAllUserProjectsHandler; this.getAllSamplesHandler = getAllSamplesHandler;
this.getUserProjectHandler = getUserProjectHandler; this.getSampleHandler = getSampleHandler;
this.port = port; this.port = port;
} }
/// <summary> /// <summary>
/// Creates a new UserProject. /// Creates a new Sample.
/// </summary> /// </summary>
[HttpPost("Create")] [HttpPost("Create")]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
@@ -53,14 +53,14 @@ namespace Core.Cerberos.Service.API.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<IActionResult> CreateUserProjectAsync([FromBody] CreateUserProjectRequest newUserProject, CancellationToken cancellationToken = default) public async Task<IActionResult> CreateSampleAsync([FromBody] CreateSqlSampleRequest newSample, CancellationToken cancellationToken = default)
{ {
await createUserProjectHandler.ExecuteAsync(newUserProject, cancellationToken).ConfigureAwait(false); await createSampleHandler.ExecuteAsync(newSample, cancellationToken).ConfigureAwait(false);
return port.ViewModel; return port.ViewModel;
} }
/// <summary> /// <summary>
/// Gets all UserProjects. /// Gets all Samples.
/// </summary> /// </summary>
[HttpGet("GetAll")] [HttpGet("GetAll")]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
@@ -70,14 +70,14 @@ namespace Core.Cerberos.Service.API.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<IActionResult> GetAllUserProjectsAsync(CancellationToken cancellationToken) public async Task<IActionResult> GetAllSamplesAsync(CancellationToken cancellationToken)
{ {
await getAllUserProjectsHandler.ExecuteAsync(new GetAllUserProjectsRequest { }, cancellationToken).ConfigureAwait(false); await getAllSamplesHandler.ExecuteAsync(new GetAllSqlSamplesRequest { }, cancellationToken).ConfigureAwait(false);
return port.ViewModel; return port.ViewModel;
} }
/// <summary> /// <summary>
/// Gets the UserProject by identifier. /// Gets the Sample by identifier.
/// </summary> /// </summary>
[HttpPost] [HttpPost]
[Route("GetById")] [Route("GetById")]
@@ -88,17 +88,17 @@ namespace Core.Cerberos.Service.API.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> GetUserProjectById([FromBody] GetUserProjectRequest request, CancellationToken cancellationToken) public async Task<IActionResult> GetSampleById([FromBody] GetSqlSampleRequest request, CancellationToken cancellationToken)
{ {
if (request.Id <= 0) { return BadRequest("Invalid UserProject identifier"); } if (request.Id <= 0) { return BadRequest("Invalid Sample identifier"); }
await getUserProjectHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); await getSampleHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false);
return port.ViewModel; return port.ViewModel;
} }
/// <summary> /// <summary>
/// Updates a full UserProject by identifier. /// Updates a full Sample by identifier.
/// </summary> /// </summary>
[HttpPut("Update")] [HttpPut("Update")]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
@@ -108,17 +108,17 @@ namespace Core.Cerberos.Service.API.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
[ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<IActionResult> UpdateUserProjectAsync([FromBody] UpdateUserProjectRequest request, CancellationToken cancellationToken = default) public async Task<IActionResult> UpdateSampleAsync([FromBody] UpdateSqlSampleRequest request, CancellationToken cancellationToken = default)
{ {
if (request.Id <= 0) { return BadRequest("Invalid UserProject identifier"); } if (request.Id <= 0) { return BadRequest("Invalid Sample identifier"); }
await updateUserProjectHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); await updateSampleHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false);
return port.ViewModel; return port.ViewModel;
} }
/// <summary> /// <summary>
/// Deletes a UserProject. /// Deletes a Sample.
/// </summary> /// </summary>
[HttpDelete] [HttpDelete]
[Route("Delete")] [Route("Delete")]
@@ -129,12 +129,12 @@ namespace Core.Cerberos.Service.API.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> DeleteUserProjectStatusAsync([FromBody] DeleteUserProjectRequest request, public async Task<IActionResult> DeleteSampleStatusAsync([FromBody] DeleteSqlSampleRequest request,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
if (request.Id <= 0) { return BadRequest("Invalid UserProject identifier"); } if (request.Id <= 0) { return BadRequest("Invalid Sample identifier"); }
await deleteUserProjectStatusHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); await deleteSampleStatusHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false);
return port.ViewModel; return port.ViewModel;
} }

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
@@ -11,7 +11,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" /> <PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
<PackageReference Include="Core.Blueprint.Logging" Version="0.3.0-alpha0034" /> <PackageReference Include="Core.Blueprint.Logging" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.7" /> <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="8.1.0-preview" /> <PackageReference Include="Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="8.1.0-preview" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" /> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />

View File

@@ -1,19 +1,21 @@
using Core.Blueprint.Application.UsesCases.BlobStorage.Adapter; using Core.Blueprint.Application.UsesCases.BlobStorage.Adapter;
using Core.Blueprint.Application.UsesCases.BlobStorage.Input;
using Core.Blueprint.Application.UsesCases.BlobStorage.Ports; using Core.Blueprint.Application.UsesCases.BlobStorage.Ports;
using Core.Blueprint.Application.UsesCases.KeyVault.Adapter;
using Core.Blueprint.Application.UsesCases.KeyVault.Input; using Core.Blueprint.Application.UsesCases.KeyVault.Input;
using Core.Blueprint.Application.UsesCases.KeyVault.Ports; using Core.Blueprint.Application.UsesCases.KeyVault.Ports;
using Core.Blueprint.Application.UsesCases.Mongo;
using Core.Blueprint.Application.UsesCases.Mongo.Adapter;
using Core.Blueprint.Application.UsesCases.Mongo.Input; using Core.Blueprint.Application.UsesCases.Mongo.Input;
using Core.Blueprint.Application.UsesCases.Mongo.Ports; using Core.Blueprint.Application.UsesCases.Mongo.Ports;
using Core.Blueprint.Application.UsesCases.MongoStorage.Adapter; using Core.Blueprint.Application.UsesCases.SQL;
using Core.Blueprint.Application.UsesCases.SQL.Adapter; using Core.Blueprint.Application.UsesCases.SQL.Adapter;
using Core.Blueprint.Application.UsesCases.SQL.Input; using Core.Blueprint.Application.UsesCases.SQL.Input;
using Core.Blueprint.Application.UsesCases.SQL.Ports; using Core.Blueprint.Application.UsesCases.SQL.Ports;
using Core.Cerberos.Application.UseCases.Blueprints;
using Core.Cerberos.Application.UseCases.Blueprints.Validator;
using Core.Cerberos.Application.UseCases.KeyVault; using Core.Cerberos.Application.UseCases.KeyVault;
using Core.Cerberos.Application.UseCases.KeyVault.Validator; using Core.Cerberos.Application.UseCases.KeyVault.Validator;
using Core.Cerberos.Application.UseCases.Mongo.Validator;
using Core.Cerberos.Application.UseCases.SQL.Validator; using Core.Cerberos.Application.UseCases.SQL.Validator;
using Core.Cerberos.Application.UseCases.UserProjects;
using FluentValidation; using FluentValidation;
using Lib.Architecture.BuildingBlocks; using Lib.Architecture.BuildingBlocks;
@@ -26,45 +28,45 @@ namespace Core.Blueprint.Service.API.Extensions
#region Mongo Services #region Mongo Services
services.AddScoped<IMongoPort, MongoPort>(); services.AddScoped<IMongoPort, MongoPort>();
services.AddValidatorsFromAssemblyContaining<CreateBlueprintValidator>(); services.AddValidatorsFromAssemblyContaining<CreateSqlSampleValidator>();
services.AddScoped<IValidator<CreateBlueprintRequest>, CreateBlueprintValidator>(); services.AddScoped<IValidator<CreateMongoSampleRequest>, CreateMongoSampleValidator>();
services.AddScoped<IComponentHandler<CreateBlueprintRequest>, MongoHandler>(); services.AddScoped<IComponentHandler<CreateMongoSampleRequest>, MongoHandler>();
services.AddScoped<IComponentHandler<GetAllBlueprintsRequest>, MongoHandler>(); services.AddScoped<IComponentHandler<GetAllMongoSamplesRequest>, MongoHandler>();
services.AddValidatorsFromAssemblyContaining<GetBlueprintValidator>(); services.AddValidatorsFromAssemblyContaining<GetSqlSampleValidator>();
services.AddScoped<IValidator<GetBlueprintRequest>, GetBlueprintValidator>(); services.AddScoped<IValidator<GetMongoSampleRequest>, GetMongoSampleValidator>();
services.AddScoped<IComponentHandler<GetBlueprintRequest>, MongoHandler>(); services.AddScoped<IComponentHandler<GetMongoSampleRequest>, MongoHandler>();
services.AddValidatorsFromAssemblyContaining<UpdateBlueprintValidator>(); services.AddValidatorsFromAssemblyContaining<UpdateSqlSampleValidator>();
services.AddScoped<IValidator<UpdateBlueprintRequest>, UpdateBlueprintValidator>(); services.AddScoped<IValidator<UpdateMongoSampleRequest>, UpdateMongoSampleValidator>();
services.AddScoped<IComponentHandler<UpdateBlueprintRequest>, MongoHandler>(); services.AddScoped<IComponentHandler<UpdateMongoSampleRequest>, MongoHandler>();
services.AddValidatorsFromAssemblyContaining<DeleteBlueprintValidator>(); services.AddValidatorsFromAssemblyContaining<DeleteSqlSampleValidator>();
services.AddScoped<IValidator<DeleteBlueprintRequest>, DeleteBlueprintValidator>(); services.AddScoped<IValidator<DeleteMongoSampleRequest>, DeleteMongoSampleValidator>();
services.AddScoped<IComponentHandler<DeleteBlueprintRequest>, MongoHandler>(); services.AddScoped<IComponentHandler<DeleteMongoSampleRequest>, MongoHandler>();
#endregion #endregion
#region SQL Services #region SQL Services
services.AddScoped<ISQLPort, SQLPort>(); services.AddScoped<ISQLPort, SQLPort>();
services.AddValidatorsFromAssemblyContaining<CreateUserProjectValidator>(); services.AddValidatorsFromAssemblyContaining<CreateSqlSampleValidator>();
services.AddScoped<IValidator<CreateUserProjectRequest>, CreateUserProjectValidator>(); services.AddScoped<IValidator<CreateSqlSampleRequest>, CreateSqlSampleValidator>();
services.AddScoped<IComponentHandler<CreateUserProjectRequest>, SQLHandler>(); services.AddScoped<IComponentHandler<CreateSqlSampleRequest>, SQLHandler>();
services.AddScoped<IComponentHandler<GetAllUserProjectsRequest>, SQLHandler>(); services.AddScoped<IComponentHandler<GetAllSqlSamplesRequest>, SQLHandler>();
services.AddValidatorsFromAssemblyContaining<GetUserProjectValidator>(); services.AddValidatorsFromAssemblyContaining<GetSqlSampleValidator>();
services.AddScoped<IValidator<GetUserProjectRequest>, GetUserProjectValidator>(); services.AddScoped<IValidator<GetSqlSampleRequest>, GetSqlSampleValidator>();
services.AddScoped<IComponentHandler<GetUserProjectRequest>, SQLHandler>(); services.AddScoped<IComponentHandler<GetSqlSampleRequest>, SQLHandler>();
services.AddValidatorsFromAssemblyContaining<UpdateUserProjectValidator>(); services.AddValidatorsFromAssemblyContaining<UpdateSqlSampleValidator>();
services.AddScoped<IValidator<UpdateUserProjectRequest>, UpdateUserProjectValidator>(); services.AddScoped<IValidator<UpdateSqlSampleRequest>, UpdateSqlSampleValidator>();
services.AddScoped<IComponentHandler<UpdateUserProjectRequest>, SQLHandler>(); services.AddScoped<IComponentHandler<UpdateSqlSampleRequest>, SQLHandler>();
services.AddValidatorsFromAssemblyContaining<DeleteUserProjectValidator>(); services.AddValidatorsFromAssemblyContaining<DeleteSqlSampleValidator>();
services.AddScoped<IValidator<DeleteUserProjectRequest>, DeleteUserProjectValidator>(); services.AddScoped<IValidator<DeleteSqlSampleRequest>, DeleteSqlSampleValidator>();
services.AddScoped<IComponentHandler<DeleteUserProjectRequest>, SQLHandler>(); services.AddScoped<IComponentHandler<DeleteSqlSampleRequest>, SQLHandler>();
#endregion #endregion
#region KeyVault Services #region KeyVault Services

View File

@@ -10,21 +10,21 @@ using System.Text.Json.Serialization;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddAzureAppConfiguration(options => //builder.Configuration.AddAzureAppConfiguration(options =>
{ //{
var endpoint = builder.Configuration.GetSection("Endpoints:AppConfigurationURI").Value; // var endpoint = builder.Configuration.GetSection("Endpoints:AppConfigurationURI").Value;
if (string.IsNullOrEmpty(endpoint)) // if (string.IsNullOrEmpty(endpoint))
throw new ArgumentException("The app configuration is missing"); // throw new ArgumentException("The app configuration is missing");
options.Connect(new Uri(endpoint), new DefaultAzureCredential()) // options.Connect(new Uri(endpoint), new DefaultAzureCredential())
.Select(KeyFilter.Any, "blueprint_service"); // .Select(KeyFilter.Any, "blueprint_service");
options.ConfigureKeyVault(keyVaultOptions => // options.ConfigureKeyVault(keyVaultOptions =>
{ // {
keyVaultOptions.SetCredential(new DefaultAzureCredential()); // keyVaultOptions.SetCredential(new DefaultAzureCredential());
}); // });
}); //});
builder.Services.AddLogs(builder); builder.Services.AddLogs(builder);

View File

@@ -1,6 +1,6 @@
namespace Core.Blueprint.Service.External.Clients.Adapters namespace Core.Blueprint.Service.External.Clients.Adapters
{ {
public class BlueprintAdapter public class MongoSampleAdapter
{ {
public string Name { get; set; } = null!; public string Name { get; set; } = null!;
public string? Description { get; set; } public string? Description { get; set; }

View File

@@ -1,6 +1,6 @@
namespace Core.Blueprint.Service.External.Clients.Adapters namespace Core.Blueprint.Service.External.Clients.Adapters
{ {
public class UserProjectAdapter public class SqlSampleAdapter
{ {
public string ProjectCode { get; set; } = null!; public string ProjectCode { get; set; } = null!;
public string ProjectDescription { get; set; } = null!; public string ProjectDescription { get; set; } = null!;

View File

@@ -10,35 +10,35 @@ namespace Core.Blueprint.Service.External.Clients
{ {
public interface IBlueprintServiceClient public interface IBlueprintServiceClient
{ {
[Post("/v1/MongoBlueprint/Create")] [Post("/v1/MongoSample/Create")]
Task<BlueprintAdapter> CreateBlueprintAsync([FromBody] BlueprintRequest newBlueprint, CancellationToken cancellationToken = default); Task<MongoSampleAdapter> CreateMongoSampleAsync([FromBody] MongoSampleRequest newSample, CancellationToken cancellationToken = default);
[Get("/v1/MongoBlueprint/GetAll")] [Get("/v1/MongoSample/GetAll")]
Task<IEnumerable<BlueprintAdapter>> GetAllBlueprintsAsync(CancellationToken cancellationToken = default); Task<IEnumerable<MongoSampleAdapter>> GetAllMongoSamplesAsync(CancellationToken cancellationToken = default);
[Get("/v1/MongoBlueprint/{_id}/GetBy_Id")] [Get("/v1/MongoSample/{_id}/GetBy_Id")]
Task<BlueprintAdapter> GetBlueprintByIdAsync([FromRoute] string _id, CancellationToken cancellationToken = default); Task<MongoSampleAdapter> GetMongoSampleByIdAsync([FromRoute] string _id, CancellationToken cancellationToken = default);
[Put("/v1/MongoBlueprint/{_id}/Update")] [Put("/v1/MongoSample/{_id}/Update")]
Task<BlueprintAdapter> UpdateBlueprintAsync([FromRoute] string _id, [FromBody] BlueprintAdapter entity, CancellationToken cancellationToken = default); Task<MongoSampleAdapter> UpdateMongoSampleAsync([FromRoute] string _id, [FromBody] MongoSampleAdapter entity, CancellationToken cancellationToken = default);
[Delete("/v1/MongoBlueprint/{_id}/Delete")] [Delete("/v1/MongoSample/{_id}/Delete")]
Task<BlueprintAdapter> DeleteBlueprintAsync([FromRoute] string _id, CancellationToken cancellationToken = default); Task<MongoSampleAdapter> DeleteMongoSampleAsync([FromRoute] string _id, CancellationToken cancellationToken = default);
[Post("/v1/UserProject/Create")] [Post("/v1/SqlSample/Create")]
Task<UserProjectAdapter> CreateUserProjectAsync([FromBody] UserProjectRequest newUserProject, CancellationToken cancellationToken = default); Task<SqlSampleAdapter> CreateSqlSampleAsync([FromBody] SqlSampleRequest newSqlSample, CancellationToken cancellationToken = default);
[Get("/v1/UserProject/GetAll")] [Get("/v1/SqlSample/GetAll")]
Task<IEnumerable<UserProjectAdapter>> GetAllUserProjectsAsync(CancellationToken cancellationToken = default); Task<IEnumerable<SqlSampleAdapter>> GetAllSqlSamplesAsync(CancellationToken cancellationToken = default);
[Get("/v1/UserProject/{id}/GetById")] [Get("/v1/SqlSample/{id}/GetById")]
Task<UserProjectAdapter> GetUserProjectByIdAsync([FromRoute] int id, CancellationToken cancellationToken = default); Task<SqlSampleAdapter> GetSqlSampleByIdAsync([FromRoute] int id, CancellationToken cancellationToken = default);
[Put("/v1/UserProject/{id}/Update")] [Put("/v1/SqlSample/{id}/Update")]
Task<UserProjectAdapter> UpdateUserProjectAsync([FromRoute] int id, [FromBody] UserProjectAdapter entity, CancellationToken cancellationToken = default); Task<SqlSampleAdapter> UpdateSqlSampleAsync([FromRoute] int id, [FromBody] SqlSampleAdapter entity, CancellationToken cancellationToken = default);
[Delete("/v1/UserProject/{id}/Delete")] [Delete("/v1/SqlSample/{id}/Delete")]
Task<UserProjectAdapter> DeleteUserProjectAsync([FromRoute] int id, CancellationToken cancellationToken = default); Task<SqlSampleAdapter> DeleteSqlSampleAsync([FromRoute] int id, CancellationToken cancellationToken = default);
[Post("/v1/KeyVault/CreateSecret")] [Post("/v1/KeyVault/CreateSecret")]
Task<KeyVaultResponse> CreateSecretAsync([FromBody] KeyVaultRequest newKeyVault, CancellationToken cancellationToken = default); Task<KeyVaultResponse> CreateSecretAsync([FromBody] KeyVaultRequest newKeyVault, CancellationToken cancellationToken = default);

View File

@@ -1,6 +1,6 @@
namespace Core.Blueprint.Service.External.Clients.Requests namespace Core.Blueprint.Service.External.Clients.Requests
{ {
public class BlueprintRequest public class MongoSampleRequest
{ {
public string Name { get; set; } = null!; public string Name { get; set; } = null!;
public string? Description { get; set; } public string? Description { get; set; }

View File

@@ -0,0 +1,8 @@
namespace Core.Blueprint.Service.External.Clients.Requests
{
public class SqlSampleRequest
{
public string Name { get; set; } = null!;
public string Description { get; set; } = null!;
}
}

View File

@@ -1,9 +0,0 @@
namespace Core.Blueprint.Service.External.Clients.Requests
{
public class UserProjectRequest
{
public string ProjectCode { get; set; } = null!;
public string ProjectDescription { get; set; } = null!;
public string UserId { get; set; } = null!;
}
}

View File

@@ -7,19 +7,12 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" /> <PackageReference Include="Core.Blueprint.KeyVault" Version="1.0.0" />
<PackageReference Include="Core.Blueprint.KeyVault" Version="0.3.0-alpha0037" /> <PackageReference Include="Core.Blueprint.Storage" Version="1.0.1" />
<PackageReference Include="Core.Blueprint.Storage" Version="0.3.0-alpha0049" /> <PackageReference Include="BuildingBlocks.Library" Version="1.0.0" />
<PackageReference Include="Lib.Architecture.BuildingBlocks" Version="0.9.0-alpha0008" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0" />
<PackageReference Include="Refit" Version="8.0.0" /> <PackageReference Include="Refit" Version="8.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Reference Include="LSA.Core.Adapters">
<HintPath>..\..\Dependencies\LSA.Core.Adapters.dll</HintPath>
</Reference>
</ItemGroup>
</Project> </Project>