diff --git a/Core.Blueprint.Application/UsesCases/BlobStorage/Input/DeleteBlobRequest.cs b/Core.Blueprint.Application/UsesCases/BlobStorage/Input/DeleteBlobRequest.cs index 9fb7cc3..88df1d1 100644 --- a/Core.Blueprint.Application/UsesCases/BlobStorage/Input/DeleteBlobRequest.cs +++ b/Core.Blueprint.Application/UsesCases/BlobStorage/Input/DeleteBlobRequest.cs @@ -1,6 +1,6 @@ using Lib.Architecture.BuildingBlocks; -namespace Core.Blueprint.Application.UsesCases.KeyVault.Input +namespace Core.Blueprint.Application.UsesCases.BlobStorage.Input { public class DeleteBlobRequest : Notificator, ICommand { diff --git a/Core.Blueprint.Application/UsesCases/BlobStorage/Input/DownloadBlobRequest.cs b/Core.Blueprint.Application/UsesCases/BlobStorage/Input/DownloadBlobRequest.cs index c9f1400..193d1fc 100644 --- a/Core.Blueprint.Application/UsesCases/BlobStorage/Input/DownloadBlobRequest.cs +++ b/Core.Blueprint.Application/UsesCases/BlobStorage/Input/DownloadBlobRequest.cs @@ -1,6 +1,6 @@ using Lib.Architecture.BuildingBlocks; -namespace Core.Blueprint.Application.UsesCases.KeyVault.Input +namespace Core.Blueprint.Application.UsesCases.BlobStorage.Input { public class DownloadBlobRequest : Notificator, ICommand { diff --git a/Core.Blueprint.Application/UsesCases/BlobStorage/Input/GetBlobListRequest.cs b/Core.Blueprint.Application/UsesCases/BlobStorage/Input/GetBlobListRequest.cs index c9acd9e..71f9ee8 100644 --- a/Core.Blueprint.Application/UsesCases/BlobStorage/Input/GetBlobListRequest.cs +++ b/Core.Blueprint.Application/UsesCases/BlobStorage/Input/GetBlobListRequest.cs @@ -1,6 +1,6 @@ using Lib.Architecture.BuildingBlocks; -namespace Core.Blueprint.Application.UsesCases.KeyVault.Input +namespace Core.Blueprint.Application.UsesCases.BlobStorage.Input { public class GetBlobListRequest : Notificator, ICommand { diff --git a/Core.Blueprint.Application/UsesCases/BlobStorage/Input/UploadBlobRequest.cs b/Core.Blueprint.Application/UsesCases/BlobStorage/Input/UploadBlobRequest.cs index 6e47c85..4120274 100644 --- a/Core.Blueprint.Application/UsesCases/BlobStorage/Input/UploadBlobRequest.cs +++ b/Core.Blueprint.Application/UsesCases/BlobStorage/Input/UploadBlobRequest.cs @@ -1,6 +1,6 @@ using Lib.Architecture.BuildingBlocks; -namespace Core.Blueprint.Application.UsesCases.KeyVault.Input +namespace Core.Blueprint.Application.UsesCases.BlobStorage.Input { public class UploadBlobRequest : Notificator, ICommand { diff --git a/Core.Blueprint.Application/UsesCases/BlobStorage/StorageHandler.cs b/Core.Blueprint.Application/UsesCases/BlobStorage/StorageHandler.cs index 7a33c02..0008e97 100644 --- a/Core.Blueprint.Application/UsesCases/BlobStorage/StorageHandler.cs +++ b/Core.Blueprint.Application/UsesCases/BlobStorage/StorageHandler.cs @@ -1,5 +1,5 @@ -using Core.Blueprint.Application.UsesCases.BlobStorage.Ports; -using Core.Blueprint.Application.UsesCases.KeyVault.Input; +using Core.Blueprint.Application.UsesCases.BlobStorage.Input; +using Core.Blueprint.Application.UsesCases.BlobStorage.Ports; using Core.Blueprint.Service.External.Clients; using Core.Blueprint.Storage; using FluentValidation; diff --git a/Core.Blueprint.Application/UsesCases/BlobStorage/Validator/DeleteBlobValidator.cs b/Core.Blueprint.Application/UsesCases/BlobStorage/Validator/DeleteBlobValidator.cs index ebf6b2d..3bb2fb2 100644 --- a/Core.Blueprint.Application/UsesCases/BlobStorage/Validator/DeleteBlobValidator.cs +++ b/Core.Blueprint.Application/UsesCases/BlobStorage/Validator/DeleteBlobValidator.cs @@ -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; namespace Core.Cerberos.Application.UseCases.KeyVault.Validator diff --git a/Core.Blueprint.Application/UsesCases/BlobStorage/Validator/DownloadBlobValidator.cs b/Core.Blueprint.Application/UsesCases/BlobStorage/Validator/DownloadBlobValidator.cs index 720f98e..36fad33 100644 --- a/Core.Blueprint.Application/UsesCases/BlobStorage/Validator/DownloadBlobValidator.cs +++ b/Core.Blueprint.Application/UsesCases/BlobStorage/Validator/DownloadBlobValidator.cs @@ -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; namespace Core.Cerberos.Application.UseCases.KeyVault.Validator diff --git a/Core.Blueprint.Application/UsesCases/BlobStorage/Validator/UploadBlobValidator.cs b/Core.Blueprint.Application/UsesCases/BlobStorage/Validator/UploadBlobValidator.cs index ba32231..4b7ce91 100644 --- a/Core.Blueprint.Application/UsesCases/BlobStorage/Validator/UploadBlobValidator.cs +++ b/Core.Blueprint.Application/UsesCases/BlobStorage/Validator/UploadBlobValidator.cs @@ -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; namespace Core.Cerberos.Application.UseCases.KeyVault.Validator diff --git a/Core.Blueprint.Application/UsesCases/KeyVault/Adapter/KeyVaultPort.cs b/Core.Blueprint.Application/UsesCases/KeyVault/Adapter/KeyVaultPort.cs index 921e8db..2a77d3c 100644 --- a/Core.Blueprint.Application/UsesCases/KeyVault/Adapter/KeyVaultPort.cs +++ b/Core.Blueprint.Application/UsesCases/KeyVault/Adapter/KeyVaultPort.cs @@ -4,7 +4,7 @@ using Core.Blueprint.Service.External.Clients.Adapters; using Lib.Architecture.BuildingBlocks; using Microsoft.AspNetCore.Mvc; -namespace Core.Blueprint.Application.UsesCases.MongoStorage.Adapter +namespace Core.Blueprint.Application.UsesCases.KeyVault.Adapter { public class KeyVaultPort : BasePresenter, IKeyVaultPort { diff --git a/Core.Blueprint.Application/UsesCases/Mongo/Adapter/MongoPort.cs b/Core.Blueprint.Application/UsesCases/Mongo/Adapter/MongoPort.cs index f0c481c..5a0c3cf 100644 --- a/Core.Blueprint.Application/UsesCases/Mongo/Adapter/MongoPort.cs +++ b/Core.Blueprint.Application/UsesCases/Mongo/Adapter/MongoPort.cs @@ -3,15 +3,15 @@ using Core.Blueprint.Service.External.Clients.Adapters; using Lib.Architecture.BuildingBlocks; using Microsoft.AspNetCore.Mvc; -namespace Core.Blueprint.Application.UsesCases.MongoStorage.Adapter +namespace Core.Blueprint.Application.UsesCases.Mongo.Adapter { public class MongoPort : BasePresenter, IMongoPort { - public void Success(BlueprintAdapter output) + public void Success(MongoSampleAdapter output) { ViewModel = new OkObjectResult(output); } - public void Success(List output) + public void Success(List output) { ViewModel = new OkObjectResult(output); } diff --git a/Core.Blueprint.Application/UsesCases/Mongo/Input/CreateBlueprintRequest.cs b/Core.Blueprint.Application/UsesCases/Mongo/Input/CreateMongoSampleRequest.cs similarity index 83% rename from Core.Blueprint.Application/UsesCases/Mongo/Input/CreateBlueprintRequest.cs rename to Core.Blueprint.Application/UsesCases/Mongo/Input/CreateMongoSampleRequest.cs index da1e801..713811b 100644 --- a/Core.Blueprint.Application/UsesCases/Mongo/Input/CreateBlueprintRequest.cs +++ b/Core.Blueprint.Application/UsesCases/Mongo/Input/CreateMongoSampleRequest.cs @@ -2,7 +2,7 @@ namespace Core.Blueprint.Application.UsesCases.Mongo.Input { - public class CreateBlueprintRequest : Notificator, ICommand + public class CreateMongoSampleRequest : Notificator, ICommand { public string Name { get; set; } = null!; diff --git a/Core.Blueprint.Application/UsesCases/Mongo/Input/DeleteBlueprintRequest.cs b/Core.Blueprint.Application/UsesCases/Mongo/Input/DeleteMongoSampleRequest.cs similarity index 80% rename from Core.Blueprint.Application/UsesCases/Mongo/Input/DeleteBlueprintRequest.cs rename to Core.Blueprint.Application/UsesCases/Mongo/Input/DeleteMongoSampleRequest.cs index e9966e9..2c7aaed 100644 --- a/Core.Blueprint.Application/UsesCases/Mongo/Input/DeleteBlueprintRequest.cs +++ b/Core.Blueprint.Application/UsesCases/Mongo/Input/DeleteMongoSampleRequest.cs @@ -2,7 +2,7 @@ namespace Core.Blueprint.Application.UsesCases.Mongo.Input { - public class DeleteBlueprintRequest : Notificator, ICommand + public class DeleteMongoSampleRequest : Notificator, ICommand { public string _Id { get; set; } diff --git a/Core.Blueprint.Application/UsesCases/Mongo/Input/GetAllBlueprintsRequest.cs b/Core.Blueprint.Application/UsesCases/Mongo/Input/GetAllMongoSamplesRequest.cs similarity index 74% rename from Core.Blueprint.Application/UsesCases/Mongo/Input/GetAllBlueprintsRequest.cs rename to Core.Blueprint.Application/UsesCases/Mongo/Input/GetAllMongoSamplesRequest.cs index fcdcee0..858c3a7 100644 --- a/Core.Blueprint.Application/UsesCases/Mongo/Input/GetAllBlueprintsRequest.cs +++ b/Core.Blueprint.Application/UsesCases/Mongo/Input/GetAllMongoSamplesRequest.cs @@ -2,7 +2,7 @@ namespace Core.Blueprint.Application.UsesCases.Mongo.Input { - public class GetAllBlueprintsRequest : Notificator, ICommand + public class GetAllMongoSamplesRequest : Notificator, ICommand { public bool Validate() { diff --git a/Core.Blueprint.Application/UsesCases/Mongo/Input/GetBlueprintRequest.cs b/Core.Blueprint.Application/UsesCases/Mongo/Input/GetMongoSampleRequest.cs similarity index 80% rename from Core.Blueprint.Application/UsesCases/Mongo/Input/GetBlueprintRequest.cs rename to Core.Blueprint.Application/UsesCases/Mongo/Input/GetMongoSampleRequest.cs index 10b3f04..772ea51 100644 --- a/Core.Blueprint.Application/UsesCases/Mongo/Input/GetBlueprintRequest.cs +++ b/Core.Blueprint.Application/UsesCases/Mongo/Input/GetMongoSampleRequest.cs @@ -2,7 +2,7 @@ namespace Core.Blueprint.Application.UsesCases.Mongo.Input { - public class GetBlueprintRequest : Notificator, ICommand + public class GetMongoSampleRequest : Notificator, ICommand { public string _Id { get; set; } diff --git a/Core.Blueprint.Application/UsesCases/Mongo/Input/UpdateBlueprintRequest.cs b/Core.Blueprint.Application/UsesCases/Mongo/Input/UpdateMongoSampleRequest.cs similarity index 91% rename from Core.Blueprint.Application/UsesCases/Mongo/Input/UpdateBlueprintRequest.cs rename to Core.Blueprint.Application/UsesCases/Mongo/Input/UpdateMongoSampleRequest.cs index 4c9b02c..20efd4d 100644 --- a/Core.Blueprint.Application/UsesCases/Mongo/Input/UpdateBlueprintRequest.cs +++ b/Core.Blueprint.Application/UsesCases/Mongo/Input/UpdateMongoSampleRequest.cs @@ -3,7 +3,7 @@ using Lib.Architecture.BuildingBlocks; 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? Description { get; set; } diff --git a/Core.Blueprint.Application/UsesCases/Mongo/MongoHandler.cs b/Core.Blueprint.Application/UsesCases/Mongo/MongoHandler.cs index ca751aa..742b453 100644 --- a/Core.Blueprint.Application/UsesCases/Mongo/MongoHandler.cs +++ b/Core.Blueprint.Application/UsesCases/Mongo/MongoHandler.cs @@ -7,57 +7,57 @@ using FluentValidation; using Lib.Architecture.BuildingBlocks; using Lib.Architecture.BuildingBlocks.Helpers; -namespace Core.Cerberos.Application.UseCases.Blueprints +namespace Core.Blueprint.Application.UsesCases.Mongo { public class MongoHandler : - IComponentHandler, - IComponentHandler, - IComponentHandler, - IComponentHandler, - IComponentHandler + IComponentHandler, + IComponentHandler, + IComponentHandler, + IComponentHandler, + IComponentHandler { private readonly IMongoPort _port; - private readonly IValidator _createBlueprintValidator; - private readonly IValidator _getBlueprintValidator; - private readonly IValidator _updateBlueprintValidator; - private readonly IValidator _deleteBlueprintValidator; - private readonly IBlueprintServiceClient _mongoDALService; + private readonly IValidator _createSampleValidator; + private readonly IValidator _getSampleValidator; + private readonly IValidator _updateSampleValidator; + private readonly IValidator _deleteSampleValidator; + private readonly IBlueprintServiceClient _blueprintServiceClient; public MongoHandler( IMongoPort port, - IValidator createBlueprintValidator, - IValidator getBlueprintValidator, - IValidator updateBlueprintValidator, - IValidator deleteBlueprintValidator, - IBlueprintServiceClient mongoDALService) + IValidator createSampleValidator, + IValidator getSampleValidator, + IValidator updateSampleValidator, + IValidator deleteSampleValidator, + IBlueprintServiceClient blueprintServiceClient) { _port = port ?? throw new ArgumentNullException(nameof(port)); - _createBlueprintValidator = createBlueprintValidator ?? throw new ArgumentNullException(nameof(createBlueprintValidator)); - _getBlueprintValidator = getBlueprintValidator ?? throw new ArgumentNullException(nameof(getBlueprintValidator)); - _updateBlueprintValidator = updateBlueprintValidator ?? throw new ArgumentNullException(nameof(updateBlueprintValidator)); - _deleteBlueprintValidator = deleteBlueprintValidator ?? throw new ArgumentNullException(nameof(deleteBlueprintValidator)); - _mongoDALService = mongoDALService ?? throw new ArgumentNullException(nameof(mongoDALService)); + _createSampleValidator = createSampleValidator ?? throw new ArgumentNullException(nameof(createSampleValidator)); + _getSampleValidator = getSampleValidator ?? throw new ArgumentNullException(nameof(getSampleValidator)); + _updateSampleValidator = updateSampleValidator ?? throw new ArgumentNullException(nameof(updateSampleValidator)); + _deleteSampleValidator = deleteSampleValidator ?? throw new ArgumentNullException(nameof(deleteSampleValidator)); + _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 { ArgumentNullException.ThrowIfNull(command); - if (!command.IsValid(_createBlueprintValidator)) + if (!command.IsValid(_createSampleValidator)) { _port.ValidationErrors(command.Notifications); return; } - var request = new BlueprintRequest + var request = new MongoSampleRequest { Name = command.Name, Description = command.Description, }; - var result = await _mongoDALService.CreateBlueprintAsync(request, cancellationToken).ConfigureAwait(false); + var result = await _blueprintServiceClient.CreateMongoSampleAsync(request, cancellationToken).ConfigureAwait(false); 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 { ArgumentNullException.ThrowIfNull(command); - var _result = await _mongoDALService.GetAllBlueprintsAsync().ConfigureAwait(false); + var _result = await _blueprintServiceClient.GetAllMongoSamplesAsync().ConfigureAwait(false); if (!_result.Any()) { _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 { ArgumentNullException.ThrowIfNull(command); - if (!command.IsValid(_getBlueprintValidator)) + if (!command.IsValid(_getSampleValidator)) { _port.ValidationErrors(command.Notifications); return; } - var result = await _mongoDALService.GetBlueprintByIdAsync(command._Id, cancellationToken).ConfigureAwait(false); + var result = await _blueprintServiceClient.GetMongoSampleByIdAsync(command._Id, cancellationToken).ConfigureAwait(false); 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 { ArgumentNullException.ThrowIfNull(command); - if (!command.IsValid(_updateBlueprintValidator)) + if (!command.IsValid(_updateSampleValidator)) { _port.ValidationErrors(command.Notifications); return; } - var request = new BlueprintAdapter + var request = new MongoSampleAdapter { Id = command.Id, _Id = command._Id, @@ -149,7 +149,7 @@ namespace Core.Cerberos.Application.UseCases.Blueprints 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) { @@ -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 { ArgumentNullException.ThrowIfNull(command); - if (!command.IsValid(_deleteBlueprintValidator)) + if (!command.IsValid(_deleteSampleValidator)) { _port.ValidationErrors(command.Notifications); return; } - var result = await _mongoDALService.DeleteBlueprintAsync(command._Id, cancellationToken).ConfigureAwait(false); + var result = await _blueprintServiceClient.DeleteMongoSampleAsync(command._Id, cancellationToken).ConfigureAwait(false); if (result == null) { diff --git a/Core.Blueprint.Application/UsesCases/Mongo/Ports/IMongoPort.cs b/Core.Blueprint.Application/UsesCases/Mongo/Ports/IMongoPort.cs index f2c314e..59cc7e6 100644 --- a/Core.Blueprint.Application/UsesCases/Mongo/Ports/IMongoPort.cs +++ b/Core.Blueprint.Application/UsesCases/Mongo/Ports/IMongoPort.cs @@ -4,8 +4,8 @@ using Lib.Architecture.BuildingBlocks; namespace Core.Blueprint.Application.UsesCases.Mongo.Ports { public interface IMongoPort : IBasePort, - ICommandSuccessPort, - ICommandSuccessPort>, + ICommandSuccessPort, + ICommandSuccessPort>, INoContentPort, IBusinessErrorPort, ITimeoutPort, IValidationErrorPort, INotFoundPort, IForbiddenPort, IUnauthorizedPort, IInternalServerErrorPort, IBadRequestPort diff --git a/Core.Blueprint.Application/UsesCases/Mongo/Validator/CreateBlueprintValidator.cs b/Core.Blueprint.Application/UsesCases/Mongo/Validator/CreateBlueprintValidator.cs deleted file mode 100644 index 10f5d1d..0000000 --- a/Core.Blueprint.Application/UsesCases/Mongo/Validator/CreateBlueprintValidator.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Core.Blueprint.Application.UsesCases.Mongo.Input; -using FluentValidation; - -namespace Core.Cerberos.Application.UseCases.Blueprints.Validator -{ - public class CreateBlueprintValidator : AbstractValidator - { - public CreateBlueprintValidator() - { - RuleFor(i => i.Name).NotEmpty().NotNull().OverridePropertyName(x => x.Name).WithName("Blueprint Name").WithMessage("Blueprint Name is Obligatory."); - } - } -} \ No newline at end of file diff --git a/Core.Blueprint.Application/UsesCases/Mongo/Validator/CreateMongoSampleValidator.cs b/Core.Blueprint.Application/UsesCases/Mongo/Validator/CreateMongoSampleValidator.cs new file mode 100644 index 0000000..e0a7135 --- /dev/null +++ b/Core.Blueprint.Application/UsesCases/Mongo/Validator/CreateMongoSampleValidator.cs @@ -0,0 +1,13 @@ +using Core.Blueprint.Application.UsesCases.Mongo.Input; +using FluentValidation; + +namespace Core.Cerberos.Application.UseCases.Mongo.Validator +{ + public class CreateMongoSampleValidator : AbstractValidator + { + public CreateMongoSampleValidator() + { + RuleFor(i => i.Name).NotEmpty().NotNull().OverridePropertyName(x => x.Name).WithName("Sample Name").WithMessage("Sample Name is Obligatory."); + } + } +} \ No newline at end of file diff --git a/Core.Blueprint.Application/UsesCases/Mongo/Validator/DeleteBlueprintValidator.cs b/Core.Blueprint.Application/UsesCases/Mongo/Validator/DeleteBlueprintValidator.cs deleted file mode 100644 index 6a8d225..0000000 --- a/Core.Blueprint.Application/UsesCases/Mongo/Validator/DeleteBlueprintValidator.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Core.Blueprint.Application.UsesCases.Mongo.Input; -using FluentValidation; - -namespace Core.Cerberos.Application.UseCases.Blueprints.Validator -{ - public class DeleteBlueprintValidator : AbstractValidator - { - public DeleteBlueprintValidator() - { - RuleFor(i => i._Id).NotEmpty().NotNull().OverridePropertyName(x => x._Id).WithName("Blueprint Mongo Identifier").WithMessage("Blueprint Mongo Identifier is Obligatory."); - } - } -} \ No newline at end of file diff --git a/Core.Blueprint.Application/UsesCases/Mongo/Validator/DeleteMongoSampleValidator.cs b/Core.Blueprint.Application/UsesCases/Mongo/Validator/DeleteMongoSampleValidator.cs new file mode 100644 index 0000000..08f71f9 --- /dev/null +++ b/Core.Blueprint.Application/UsesCases/Mongo/Validator/DeleteMongoSampleValidator.cs @@ -0,0 +1,13 @@ +using Core.Blueprint.Application.UsesCases.Mongo.Input; +using FluentValidation; + +namespace Core.Cerberos.Application.UseCases.Mongo.Validator +{ + public class DeleteMongoSampleValidator : AbstractValidator + { + public DeleteMongoSampleValidator() + { + RuleFor(i => i._Id).NotEmpty().NotNull().OverridePropertyName(x => x._Id).WithName("Sample Identifier").WithMessage("Sample Identifier is Obligatory."); + } + } +} \ No newline at end of file diff --git a/Core.Blueprint.Application/UsesCases/Mongo/Validator/GetBlueprintValidator.cs b/Core.Blueprint.Application/UsesCases/Mongo/Validator/GetBlueprintValidator.cs deleted file mode 100644 index d6f2113..0000000 --- a/Core.Blueprint.Application/UsesCases/Mongo/Validator/GetBlueprintValidator.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Core.Blueprint.Application.UsesCases.Mongo.Input; -using FluentValidation; - -namespace Core.Cerberos.Application.UseCases.Blueprints.Validator -{ - public class GetBlueprintValidator : AbstractValidator - { - public GetBlueprintValidator() - { - RuleFor(i => i._Id).NotEmpty().NotNull().OverridePropertyName(x => x._Id).WithName("Blueprint Mongo Identifier").WithMessage("Blueprint Mongo Identifier is Obligatory."); - } - } -} \ No newline at end of file diff --git a/Core.Blueprint.Application/UsesCases/Mongo/Validator/GetMongoSampleValidator.cs b/Core.Blueprint.Application/UsesCases/Mongo/Validator/GetMongoSampleValidator.cs new file mode 100644 index 0000000..fd8550b --- /dev/null +++ b/Core.Blueprint.Application/UsesCases/Mongo/Validator/GetMongoSampleValidator.cs @@ -0,0 +1,13 @@ +using Core.Blueprint.Application.UsesCases.Mongo.Input; +using FluentValidation; + +namespace Core.Cerberos.Application.UseCases.Mongo.Validator +{ + public class GetMongoSampleValidator : AbstractValidator + { + public GetMongoSampleValidator() + { + RuleFor(i => i._Id).NotEmpty().NotNull().OverridePropertyName(x => x._Id).WithName("Sample Identifier").WithMessage("Sample Identifier is Obligatory."); + } + } +} \ No newline at end of file diff --git a/Core.Blueprint.Application/UsesCases/Mongo/Validator/UpdateBlueprintValidator.cs b/Core.Blueprint.Application/UsesCases/Mongo/Validator/UpdateBlueprintValidator.cs deleted file mode 100644 index 73fd5b7..0000000 --- a/Core.Blueprint.Application/UsesCases/Mongo/Validator/UpdateBlueprintValidator.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Core.Blueprint.Application.UsesCases.Mongo.Input; -using FluentValidation; - -namespace Core.Cerberos.Application.UseCases.Blueprints.Validator -{ - public class UpdateBlueprintValidator : AbstractValidator - { - 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."); - } - } -} diff --git a/Core.Blueprint.Application/UsesCases/Mongo/Validator/UpdateMongoSampleValidator.cs b/Core.Blueprint.Application/UsesCases/Mongo/Validator/UpdateMongoSampleValidator.cs new file mode 100644 index 0000000..c8b46a5 --- /dev/null +++ b/Core.Blueprint.Application/UsesCases/Mongo/Validator/UpdateMongoSampleValidator.cs @@ -0,0 +1,17 @@ +using Core.Blueprint.Application.UsesCases.Mongo.Input; +using FluentValidation; + +namespace Core.Cerberos.Application.UseCases.Mongo.Validator +{ + public class UpdateMongoSampleValidator : AbstractValidator + { + 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."); + } + } +} diff --git a/Core.Blueprint.Application/UsesCases/SQL/Adapter/SQLPort.cs b/Core.Blueprint.Application/UsesCases/SQL/Adapter/SQLPort.cs index 1750f75..ce9cdd1 100644 --- a/Core.Blueprint.Application/UsesCases/SQL/Adapter/SQLPort.cs +++ b/Core.Blueprint.Application/UsesCases/SQL/Adapter/SQLPort.cs @@ -7,11 +7,11 @@ namespace Core.Blueprint.Application.UsesCases.SQL.Adapter { public class SQLPort : BasePresenter, ISQLPort { - public void Success(UserProjectAdapter output) + public void Success(SqlSampleAdapter output) { ViewModel = new OkObjectResult(output); } - public void Success(List output) + public void Success(List output) { ViewModel = new OkObjectResult(output); } diff --git a/Core.Blueprint.Application/UsesCases/SQL/Input/CreateSqlSampleRequest.cs b/Core.Blueprint.Application/UsesCases/SQL/Input/CreateSqlSampleRequest.cs new file mode 100644 index 0000000..5e4499d --- /dev/null +++ b/Core.Blueprint.Application/UsesCases/SQL/Input/CreateSqlSampleRequest.cs @@ -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; + } + } +} diff --git a/Core.Blueprint.Application/UsesCases/SQL/Input/CreateUserProjectRequest.cs b/Core.Blueprint.Application/UsesCases/SQL/Input/CreateUserProjectRequest.cs deleted file mode 100644 index 04ad592..0000000 --- a/Core.Blueprint.Application/UsesCases/SQL/Input/CreateUserProjectRequest.cs +++ /dev/null @@ -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; - } - } -} diff --git a/Core.Blueprint.Application/UsesCases/SQL/Input/DeleteUserProjectRequest.cs b/Core.Blueprint.Application/UsesCases/SQL/Input/DeleteSqlSampleRequest.cs similarity index 77% rename from Core.Blueprint.Application/UsesCases/SQL/Input/DeleteUserProjectRequest.cs rename to Core.Blueprint.Application/UsesCases/SQL/Input/DeleteSqlSampleRequest.cs index 3f11d9c..147c1c7 100644 --- a/Core.Blueprint.Application/UsesCases/SQL/Input/DeleteUserProjectRequest.cs +++ b/Core.Blueprint.Application/UsesCases/SQL/Input/DeleteSqlSampleRequest.cs @@ -2,7 +2,7 @@ namespace Core.Blueprint.Application.UsesCases.SQL.Input { - public class DeleteUserProjectRequest : Notificator, ICommand + public class DeleteSqlSampleRequest : Notificator, ICommand { public int Id { get; set; } diff --git a/Core.Blueprint.Application/UsesCases/SQL/Input/GetAllUserProjectsRequest.cs b/Core.Blueprint.Application/UsesCases/SQL/Input/GetAllSqlSamplesRequest.cs similarity index 74% rename from Core.Blueprint.Application/UsesCases/SQL/Input/GetAllUserProjectsRequest.cs rename to Core.Blueprint.Application/UsesCases/SQL/Input/GetAllSqlSamplesRequest.cs index 40f17c6..81940a2 100644 --- a/Core.Blueprint.Application/UsesCases/SQL/Input/GetAllUserProjectsRequest.cs +++ b/Core.Blueprint.Application/UsesCases/SQL/Input/GetAllSqlSamplesRequest.cs @@ -2,7 +2,7 @@ namespace Core.Blueprint.Application.UsesCases.SQL.Input { - public class GetAllUserProjectsRequest : Notificator, ICommand + public class GetAllSqlSamplesRequest : Notificator, ICommand { public bool Validate() { diff --git a/Core.Blueprint.Application/UsesCases/SQL/Input/GetUserProjectRequest.cs b/Core.Blueprint.Application/UsesCases/SQL/Input/GetSqlSampleRequest.cs similarity index 78% rename from Core.Blueprint.Application/UsesCases/SQL/Input/GetUserProjectRequest.cs rename to Core.Blueprint.Application/UsesCases/SQL/Input/GetSqlSampleRequest.cs index d87d3d7..ada7a15 100644 --- a/Core.Blueprint.Application/UsesCases/SQL/Input/GetUserProjectRequest.cs +++ b/Core.Blueprint.Application/UsesCases/SQL/Input/GetSqlSampleRequest.cs @@ -2,7 +2,7 @@ namespace Core.Blueprint.Application.UsesCases.SQL.Input { - public class GetUserProjectRequest : Notificator, ICommand + public class GetSqlSampleRequest : Notificator, ICommand { public int Id { get; set; } diff --git a/Core.Blueprint.Application/UsesCases/SQL/Input/UpdateUserProjectRequest.cs b/Core.Blueprint.Application/UsesCases/SQL/Input/UpdateSqlSampleRequest.cs similarity index 71% rename from Core.Blueprint.Application/UsesCases/SQL/Input/UpdateUserProjectRequest.cs rename to Core.Blueprint.Application/UsesCases/SQL/Input/UpdateSqlSampleRequest.cs index e544673..373158a 100644 --- a/Core.Blueprint.Application/UsesCases/SQL/Input/UpdateUserProjectRequest.cs +++ b/Core.Blueprint.Application/UsesCases/SQL/Input/UpdateSqlSampleRequest.cs @@ -3,11 +3,10 @@ using Lib.Architecture.BuildingBlocks; 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 ProjectDescription { get; set; } = null!; - public string UserId { get; set; } = null!; + public string Name { get; set; } = null!; + public string Description { get; set; } = null!; public int Id { get; set; } public string Guid { get; set; } = null!; public DateTime CreatedAt { get; set; } diff --git a/Core.Blueprint.Application/UsesCases/SQL/Ports/ISQLPort.cs b/Core.Blueprint.Application/UsesCases/SQL/Ports/ISQLPort.cs index 51a906e..9b821fe 100644 --- a/Core.Blueprint.Application/UsesCases/SQL/Ports/ISQLPort.cs +++ b/Core.Blueprint.Application/UsesCases/SQL/Ports/ISQLPort.cs @@ -4,8 +4,8 @@ using Lib.Architecture.BuildingBlocks; namespace Core.Blueprint.Application.UsesCases.SQL.Ports { public interface ISQLPort : IBasePort, - ICommandSuccessPort, - ICommandSuccessPort>, + ICommandSuccessPort, + ICommandSuccessPort>, INoContentPort, IBusinessErrorPort, ITimeoutPort, IValidationErrorPort, INotFoundPort, IForbiddenPort, IUnauthorizedPort, IInternalServerErrorPort, IBadRequestPort diff --git a/Core.Blueprint.Application/UsesCases/SQL/SQLHandler.cs b/Core.Blueprint.Application/UsesCases/SQL/SQLHandler.cs index 45efd6f..87a05ee 100644 --- a/Core.Blueprint.Application/UsesCases/SQL/SQLHandler.cs +++ b/Core.Blueprint.Application/UsesCases/SQL/SQLHandler.cs @@ -7,58 +7,57 @@ using FluentValidation; using Lib.Architecture.BuildingBlocks; using Lib.Architecture.BuildingBlocks.Helpers; -namespace Core.Cerberos.Application.UseCases.UserProjects +namespace Core.Blueprint.Application.UsesCases.SQL { public class SQLHandler : - IComponentHandler, - IComponentHandler, - IComponentHandler, - IComponentHandler, - IComponentHandler + IComponentHandler, + IComponentHandler, + IComponentHandler, + IComponentHandler, + IComponentHandler { private readonly ISQLPort _port; - private readonly IValidator _createUserProjectValidator; - private readonly IValidator _getUserProjectValidator; - private readonly IValidator _updateUserProjectValidator; - private readonly IValidator _deleteUserProjectValidator; + private readonly IValidator _createSampleValidator; + private readonly IValidator _getSampleValidator; + private readonly IValidator _updateSampleValidator; + private readonly IValidator _deleteSampleValidator; private readonly IBlueprintServiceClient _SQLDALService; public SQLHandler( ISQLPort port, - IValidator createUserProjectValidator, - IValidator getUserProjectValidator, - IValidator updateUserProjectValidator, - IValidator deleteUserProjectValidator, + IValidator createSampleValidator, + IValidator getSampleValidator, + IValidator updateSampleValidator, + IValidator deleteSampleValidator, IBlueprintServiceClient SQLDALService) { _port = port ?? throw new ArgumentNullException(nameof(port)); - _createUserProjectValidator = createUserProjectValidator ?? throw new ArgumentNullException(nameof(createUserProjectValidator)); - _getUserProjectValidator = getUserProjectValidator ?? throw new ArgumentNullException(nameof(getUserProjectValidator)); - _updateUserProjectValidator = updateUserProjectValidator ?? throw new ArgumentNullException(nameof(updateUserProjectValidator)); - _deleteUserProjectValidator = deleteUserProjectValidator ?? throw new ArgumentNullException(nameof(deleteUserProjectValidator)); + _createSampleValidator = createSampleValidator ?? throw new ArgumentNullException(nameof(createSampleValidator)); + _getSampleValidator = getSampleValidator ?? throw new ArgumentNullException(nameof(getSampleValidator)); + _updateSampleValidator = updateSampleValidator ?? throw new ArgumentNullException(nameof(updateSampleValidator)); + _deleteSampleValidator = deleteSampleValidator ?? throw new ArgumentNullException(nameof(deleteSampleValidator)); _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 { ArgumentNullException.ThrowIfNull(command); - if (!command.IsValid(_createUserProjectValidator)) + if (!command.IsValid(_createSampleValidator)) { _port.ValidationErrors(command.Notifications); return; } - var request = new UserProjectRequest + var request = new SqlSampleRequest { - ProjectCode = command.ProjectCode, - ProjectDescription = command.ProjectDescription, - UserId = command.UserId, + Name = command.Name, + Description = command.Description, }; - var result = await _SQLDALService.CreateUserProjectAsync(request, cancellationToken).ConfigureAwait(false); + var result = await _SQLDALService.CreateSqlSampleAsync(request, cancellationToken).ConfigureAwait(false); 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 { ArgumentNullException.ThrowIfNull(command); - var _result = await _SQLDALService.GetAllUserProjectsAsync().ConfigureAwait(false); + var _result = await _SQLDALService.GetAllSqlSamplesAsync().ConfigureAwait(false); if (!_result.Any()) { _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 { 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) { @@ -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 { ArgumentNullException.ThrowIfNull(command); - if (!command.IsValid(_updateUserProjectValidator)) + if (!command.IsValid(_updateSampleValidator)) { _port.ValidationErrors(command.Notifications); return; } - var request = new UserProjectAdapter + var request = new SqlSampleAdapter { Id = command.Id, Guid = command.Guid, - UserId = command.UserId, - ProjectCode = command.ProjectCode, - ProjectDescription = command.ProjectDescription, + ProjectCode = command.Name, + ProjectDescription = command.Description, CreatedAt = command.CreatedAt, CreatedBy = command.CreatedBy, UpdatedAt = command.UpdatedAt, @@ -145,7 +149,7 @@ namespace Core.Cerberos.Application.UseCases.UserProjects 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) { @@ -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 { ArgumentNullException.ThrowIfNull(command); - if (!command.IsValid(_deleteUserProjectValidator)) + if (!command.IsValid(_deleteSampleValidator)) { _port.ValidationErrors(command.Notifications); return; } - var result = await _SQLDALService.DeleteUserProjectAsync(command.Id, cancellationToken).ConfigureAwait(false); + var result = await _SQLDALService.DeleteSqlSampleAsync(command.Id, cancellationToken).ConfigureAwait(false); if (result == null) { diff --git a/Core.Blueprint.Application/UsesCases/SQL/Validator/CreateSqlSampleValidator.cs b/Core.Blueprint.Application/UsesCases/SQL/Validator/CreateSqlSampleValidator.cs new file mode 100644 index 0000000..cd9bd3c --- /dev/null +++ b/Core.Blueprint.Application/UsesCases/SQL/Validator/CreateSqlSampleValidator.cs @@ -0,0 +1,14 @@ +using Core.Blueprint.Application.UsesCases.SQL.Input; +using FluentValidation; + +namespace Core.Cerberos.Application.UseCases.SQL.Validator +{ + public class CreateSqlSampleValidator : AbstractValidator + { + 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."); + } + } +} \ No newline at end of file diff --git a/Core.Blueprint.Application/UsesCases/SQL/Validator/CreateUserProjectValidator.cs b/Core.Blueprint.Application/UsesCases/SQL/Validator/CreateUserProjectValidator.cs deleted file mode 100644 index 66384d4..0000000 --- a/Core.Blueprint.Application/UsesCases/SQL/Validator/CreateUserProjectValidator.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Core.Blueprint.Application.UsesCases.SQL.Input; -using FluentValidation; - -namespace Core.Cerberos.Application.UseCases.SQL.Validator -{ - public class CreateUserProjectValidator : AbstractValidator - { - 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."); - } - } -} \ No newline at end of file diff --git a/Core.Blueprint.Application/UsesCases/SQL/Validator/GetUserProjectValidator.cs b/Core.Blueprint.Application/UsesCases/SQL/Validator/DeleteSqlSampleValidator.cs similarity index 50% rename from Core.Blueprint.Application/UsesCases/SQL/Validator/GetUserProjectValidator.cs rename to Core.Blueprint.Application/UsesCases/SQL/Validator/DeleteSqlSampleValidator.cs index de465a6..89e1221 100644 --- a/Core.Blueprint.Application/UsesCases/SQL/Validator/GetUserProjectValidator.cs +++ b/Core.Blueprint.Application/UsesCases/SQL/Validator/DeleteSqlSampleValidator.cs @@ -3,11 +3,11 @@ using FluentValidation; namespace Core.Cerberos.Application.UseCases.SQL.Validator { - public class GetUserProjectValidator : AbstractValidator + public class DeleteSqlSampleValidator : AbstractValidator { - 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."); } } } \ No newline at end of file diff --git a/Core.Blueprint.Application/UsesCases/SQL/Validator/DeleteUserProjectValidator.cs b/Core.Blueprint.Application/UsesCases/SQL/Validator/DeleteUserProjectValidator.cs deleted file mode 100644 index 9ef57ff..0000000 --- a/Core.Blueprint.Application/UsesCases/SQL/Validator/DeleteUserProjectValidator.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Core.Blueprint.Application.UsesCases.SQL.Input; -using FluentValidation; - -namespace Core.Cerberos.Application.UseCases.SQL.Validator -{ - public class DeleteUserProjectValidator : AbstractValidator - { - public DeleteUserProjectValidator() - { - RuleFor(i => i.Id).NotEmpty().NotNull().OverridePropertyName(x => x.Id).WithName("User Project Identifier").WithMessage("User Project Identifier is Obligatory."); - } - } -} \ No newline at end of file diff --git a/Core.Blueprint.Application/UsesCases/SQL/Validator/GetSqlSampleValidator.cs b/Core.Blueprint.Application/UsesCases/SQL/Validator/GetSqlSampleValidator.cs new file mode 100644 index 0000000..55f9215 --- /dev/null +++ b/Core.Blueprint.Application/UsesCases/SQL/Validator/GetSqlSampleValidator.cs @@ -0,0 +1,13 @@ +using Core.Blueprint.Application.UsesCases.SQL.Input; +using FluentValidation; + +namespace Core.Cerberos.Application.UseCases.SQL.Validator +{ + public class GetSqlSampleValidator : AbstractValidator + { + public GetSqlSampleValidator() + { + RuleFor(i => i.Id).NotEmpty().NotNull().OverridePropertyName(x => x.Id).WithName("Sample Identifier").WithMessage("Sample Identifier is Obligatory."); + } + } +} \ No newline at end of file diff --git a/Core.Blueprint.Application/UsesCases/SQL/Validator/UpdateSqlSampleValidator.cs b/Core.Blueprint.Application/UsesCases/SQL/Validator/UpdateSqlSampleValidator.cs new file mode 100644 index 0000000..1fd7914 --- /dev/null +++ b/Core.Blueprint.Application/UsesCases/SQL/Validator/UpdateSqlSampleValidator.cs @@ -0,0 +1,18 @@ +using Core.Blueprint.Application.UsesCases.SQL.Input; +using FluentValidation; + +namespace Core.Cerberos.Application.UseCases.SQL.Validator +{ + public class UpdateSqlSampleValidator : AbstractValidator + { + 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."); + } + } +} diff --git a/Core.Blueprint.Application/UsesCases/SQL/Validator/UpdateUserProjectValidator.cs b/Core.Blueprint.Application/UsesCases/SQL/Validator/UpdateUserProjectValidator.cs deleted file mode 100644 index 9a88e06..0000000 --- a/Core.Blueprint.Application/UsesCases/SQL/Validator/UpdateUserProjectValidator.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Core.Blueprint.Application.UsesCases.SQL.Input; -using FluentValidation; - -namespace Core.Cerberos.Application.UseCases.SQL.Validator -{ - public class UpdateUserProjectValidator : AbstractValidator - { - 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."); - } - } -} diff --git a/Core.Blueprint.Service.API/Controllers/BlobStorageController.cs b/Core.Blueprint.Service.API/Controllers/BlobStorageController.cs index caf3d97..8479a96 100644 --- a/Core.Blueprint.Service.API/Controllers/BlobStorageController.cs +++ b/Core.Blueprint.Service.API/Controllers/BlobStorageController.cs @@ -1,4 +1,5 @@ using Asp.Versioning; +using Core.Blueprint.Application.UsesCases.BlobStorage.Input; using Core.Blueprint.Application.UsesCases.BlobStorage.Ports; using Core.Blueprint.Application.UsesCases.KeyVault.Input; using Lib.Architecture.BuildingBlocks; diff --git a/Core.Blueprint.Service.API/Controllers/MongoBluePrintController.cs b/Core.Blueprint.Service.API/Controllers/MongoSampleController.cs similarity index 60% rename from Core.Blueprint.Service.API/Controllers/MongoBluePrintController.cs rename to Core.Blueprint.Service.API/Controllers/MongoSampleController.cs index c894366..98fc923 100644 --- a/Core.Blueprint.Service.API/Controllers/MongoBluePrintController.cs +++ b/Core.Blueprint.Service.API/Controllers/MongoSampleController.cs @@ -7,43 +7,43 @@ using Microsoft.AspNetCore.Mvc; namespace Core.Cerberos.Service.API.Controllers { /// - /// Handles all services and business rules related to . + /// Handles all services and business rules related to . /// [ApiVersion("1.0")] [Route("api/v{api-version:apiVersion}/[controller]")] [Produces("application/json")] [ApiController] - public class MongoBlueprintController : ControllerBase + public class MongoSampleController : ControllerBase { - private readonly IComponentHandler createBlueprintHandler; - private readonly IComponentHandler getAllBlueprintsHandler; - private readonly IComponentHandler getBlueprintHandler; - private readonly IComponentHandler updateBlueprintHandler; - private readonly IComponentHandler deleteBlueprintHandler; + private readonly IComponentHandler createSampleHandler; + private readonly IComponentHandler getAllSamplesHandler; + private readonly IComponentHandler getSampleHandler; + private readonly IComponentHandler updateSampleHandler; + private readonly IComponentHandler deleteSampleHandler; private readonly IMongoPort port; /// - /// Handles all services and business rules related to . + /// Handles all services and business rules related to . /// - public MongoBlueprintController( - IComponentHandler getBlueprintHandler, - IComponentHandler getAllBlueprintsHandler, - IComponentHandler createBlueprintHandler, - IComponentHandler updateBlueprintHandler, - IComponentHandler deleteBlueprintHandler, + public MongoSampleController( + IComponentHandler getSampleHandler, + IComponentHandler getAllSamplesHandler, + IComponentHandler createSampleHandler, + IComponentHandler updateSampleHandler, + IComponentHandler deleteSampleHandler, IMongoPort port ) { - this.createBlueprintHandler = createBlueprintHandler; - this.updateBlueprintHandler = updateBlueprintHandler; - this.deleteBlueprintHandler = deleteBlueprintHandler; - this.getAllBlueprintsHandler = getAllBlueprintsHandler; - this.getBlueprintHandler = getBlueprintHandler; + this.createSampleHandler = createSampleHandler; + this.updateSampleHandler = updateSampleHandler; + this.deleteSampleHandler = deleteSampleHandler; + this.getAllSamplesHandler = getAllSamplesHandler; + this.getSampleHandler = getSampleHandler; this.port = port; } /// - /// Creates a new blueprint. + /// Creates a new sample. /// [HttpPost("Create")] [ProducesResponseType(StatusCodes.Status200OK)] @@ -53,14 +53,14 @@ namespace Core.Cerberos.Service.API.Controllers [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status400BadRequest)] - public async Task CreateBlueprintAsync([FromBody] CreateBlueprintRequest newBlueprint, CancellationToken cancellationToken = default) + public async Task CreateSampleAsync([FromBody] CreateMongoSampleRequest newSample, CancellationToken cancellationToken = default) { - await createBlueprintHandler.ExecuteAsync(newBlueprint, cancellationToken).ConfigureAwait(false); + await createSampleHandler.ExecuteAsync(newSample, cancellationToken).ConfigureAwait(false); return port.ViewModel; } /// - /// Gets all blueprints. + /// Gets all samples. /// [HttpGet("GetAll")] [ProducesResponseType(StatusCodes.Status200OK)] @@ -70,14 +70,14 @@ namespace Core.Cerberos.Service.API.Controllers [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status400BadRequest)] - public async Task GetAllBlueprintsAsync(CancellationToken cancellationToken) + public async Task GetAllSamplesAsync(CancellationToken cancellationToken) { - await getAllBlueprintsHandler.ExecuteAsync(new GetAllBlueprintsRequest { }, cancellationToken).ConfigureAwait(false); + await getAllSamplesHandler.ExecuteAsync(new GetAllMongoSamplesRequest { }, cancellationToken).ConfigureAwait(false); return port.ViewModel; } /// - /// Gets the blueprint by identifier. + /// Gets the sample by identifier. /// [HttpPost] [Route("GetById")] @@ -88,17 +88,17 @@ namespace Core.Cerberos.Service.API.Controllers [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task GetBlueprintById([FromBody] GetBlueprintRequest request, CancellationToken cancellationToken) + public async Task 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; } /// - /// Updates a full blueprint by identifier. + /// Updates a full sample by identifier. /// [HttpPut("Update")] [ProducesResponseType(StatusCodes.Status200OK)] @@ -108,17 +108,17 @@ namespace Core.Cerberos.Service.API.Controllers [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status400BadRequest)] - public async Task UpdateBlueprintAsync([FromBody] UpdateBlueprintRequest request, CancellationToken cancellationToken = default) + public async Task 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; } /// - /// Deletes a blueprint. + /// Deletes a sample. /// [HttpDelete] [Route("Delete")] @@ -129,12 +129,12 @@ namespace Core.Cerberos.Service.API.Controllers [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task DeleteBlueprintAsync([FromBody] DeleteBlueprintRequest request, + public async Task DeleteSampleAsync([FromBody] DeleteMongoSampleRequest request, 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; } diff --git a/Core.Blueprint.Service.API/Controllers/SQLUserProjectController.cs b/Core.Blueprint.Service.API/Controllers/SqlSampleController.cs similarity index 57% rename from Core.Blueprint.Service.API/Controllers/SQLUserProjectController.cs rename to Core.Blueprint.Service.API/Controllers/SqlSampleController.cs index 6ccfd05..f172a5a 100644 --- a/Core.Blueprint.Service.API/Controllers/SQLUserProjectController.cs +++ b/Core.Blueprint.Service.API/Controllers/SqlSampleController.cs @@ -7,43 +7,43 @@ using Microsoft.AspNetCore.Mvc; namespace Core.Cerberos.Service.API.Controllers { /// - /// Handles all services and business rules related to . + /// Handles all services and business rules related to . /// [ApiVersion("1.0")] [Route("api/v{api-version:apiVersion}/[controller]")] [Produces("application/json")] [ApiController] - public class SQLUserProjectController : ControllerBase + public class SqlSampleController : ControllerBase { - private readonly IComponentHandler createUserProjectHandler; - private readonly IComponentHandler getAllUserProjectsHandler; - private readonly IComponentHandler getUserProjectHandler; - private readonly IComponentHandler updateUserProjectHandler; - private readonly IComponentHandler deleteUserProjectStatusHandler; + private readonly IComponentHandler createSampleHandler; + private readonly IComponentHandler getAllSamplesHandler; + private readonly IComponentHandler getSampleHandler; + private readonly IComponentHandler updateSampleHandler; + private readonly IComponentHandler deleteSampleStatusHandler; private readonly ISQLPort port; /// - /// Handles all services and business rules related to . + /// Handles all services and business rules related to . /// - public SQLUserProjectController( - IComponentHandler getUserProjectHandler, - IComponentHandler getAllUserProjectsHandler, - IComponentHandler createUserProjectHandler, - IComponentHandler updateUserProjectHandler, - IComponentHandler deleteUserProjectStatusHandler, + public SqlSampleController( + IComponentHandler getSampleHandler, + IComponentHandler getAllSamplesHandler, + IComponentHandler createSampleHandler, + IComponentHandler updateSampleHandler, + IComponentHandler deleteSampleStatusHandler, ISQLPort port ) { - this.createUserProjectHandler = createUserProjectHandler; - this.updateUserProjectHandler = updateUserProjectHandler; - this.deleteUserProjectStatusHandler = deleteUserProjectStatusHandler; - this.getAllUserProjectsHandler = getAllUserProjectsHandler; - this.getUserProjectHandler = getUserProjectHandler; + this.createSampleHandler = createSampleHandler; + this.updateSampleHandler = updateSampleHandler; + this.deleteSampleStatusHandler = deleteSampleStatusHandler; + this.getAllSamplesHandler = getAllSamplesHandler; + this.getSampleHandler = getSampleHandler; this.port = port; } /// - /// Creates a new UserProject. + /// Creates a new Sample. /// [HttpPost("Create")] [ProducesResponseType(StatusCodes.Status200OK)] @@ -53,14 +53,14 @@ namespace Core.Cerberos.Service.API.Controllers [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status400BadRequest)] - public async Task CreateUserProjectAsync([FromBody] CreateUserProjectRequest newUserProject, CancellationToken cancellationToken = default) + public async Task CreateSampleAsync([FromBody] CreateSqlSampleRequest newSample, CancellationToken cancellationToken = default) { - await createUserProjectHandler.ExecuteAsync(newUserProject, cancellationToken).ConfigureAwait(false); + await createSampleHandler.ExecuteAsync(newSample, cancellationToken).ConfigureAwait(false); return port.ViewModel; } /// - /// Gets all UserProjects. + /// Gets all Samples. /// [HttpGet("GetAll")] [ProducesResponseType(StatusCodes.Status200OK)] @@ -70,14 +70,14 @@ namespace Core.Cerberos.Service.API.Controllers [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status400BadRequest)] - public async Task GetAllUserProjectsAsync(CancellationToken cancellationToken) + public async Task GetAllSamplesAsync(CancellationToken cancellationToken) { - await getAllUserProjectsHandler.ExecuteAsync(new GetAllUserProjectsRequest { }, cancellationToken).ConfigureAwait(false); + await getAllSamplesHandler.ExecuteAsync(new GetAllSqlSamplesRequest { }, cancellationToken).ConfigureAwait(false); return port.ViewModel; } /// - /// Gets the UserProject by identifier. + /// Gets the Sample by identifier. /// [HttpPost] [Route("GetById")] @@ -88,17 +88,17 @@ namespace Core.Cerberos.Service.API.Controllers [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task GetUserProjectById([FromBody] GetUserProjectRequest request, CancellationToken cancellationToken) + public async Task 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; } /// - /// Updates a full UserProject by identifier. + /// Updates a full Sample by identifier. /// [HttpPut("Update")] [ProducesResponseType(StatusCodes.Status200OK)] @@ -108,17 +108,17 @@ namespace Core.Cerberos.Service.API.Controllers [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status400BadRequest)] - public async Task UpdateUserProjectAsync([FromBody] UpdateUserProjectRequest request, CancellationToken cancellationToken = default) + public async Task 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; } /// - /// Deletes a UserProject. + /// Deletes a Sample. /// [HttpDelete] [Route("Delete")] @@ -129,12 +129,12 @@ namespace Core.Cerberos.Service.API.Controllers [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task DeleteUserProjectStatusAsync([FromBody] DeleteUserProjectRequest request, + public async Task DeleteSampleStatusAsync([FromBody] DeleteSqlSampleRequest request, 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; } diff --git a/Core.Blueprint.Service.API/Extensions/ServiceCollectionExtension.cs b/Core.Blueprint.Service.API/Extensions/ServiceCollectionExtension.cs index 59499a9..6d1929a 100644 --- a/Core.Blueprint.Service.API/Extensions/ServiceCollectionExtension.cs +++ b/Core.Blueprint.Service.API/Extensions/ServiceCollectionExtension.cs @@ -1,19 +1,21 @@ 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.KeyVault.Adapter; using Core.Blueprint.Application.UsesCases.KeyVault.Input; 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.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.Input; 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.Validator; +using Core.Cerberos.Application.UseCases.Mongo.Validator; using Core.Cerberos.Application.UseCases.SQL.Validator; -using Core.Cerberos.Application.UseCases.UserProjects; using FluentValidation; using Lib.Architecture.BuildingBlocks; @@ -26,45 +28,45 @@ namespace Core.Blueprint.Service.API.Extensions #region Mongo Services services.AddScoped(); - services.AddValidatorsFromAssemblyContaining(); - services.AddScoped, CreateBlueprintValidator>(); - services.AddScoped, MongoHandler>(); + services.AddValidatorsFromAssemblyContaining(); + services.AddScoped, CreateMongoSampleValidator>(); + services.AddScoped, MongoHandler>(); - services.AddScoped, MongoHandler>(); + services.AddScoped, MongoHandler>(); - services.AddValidatorsFromAssemblyContaining(); - services.AddScoped, GetBlueprintValidator>(); - services.AddScoped, MongoHandler>(); + services.AddValidatorsFromAssemblyContaining(); + services.AddScoped, GetMongoSampleValidator>(); + services.AddScoped, MongoHandler>(); - services.AddValidatorsFromAssemblyContaining(); - services.AddScoped, UpdateBlueprintValidator>(); - services.AddScoped, MongoHandler>(); + services.AddValidatorsFromAssemblyContaining(); + services.AddScoped, UpdateMongoSampleValidator>(); + services.AddScoped, MongoHandler>(); - services.AddValidatorsFromAssemblyContaining(); - services.AddScoped, DeleteBlueprintValidator>(); - services.AddScoped, MongoHandler>(); + services.AddValidatorsFromAssemblyContaining(); + services.AddScoped, DeleteMongoSampleValidator>(); + services.AddScoped, MongoHandler>(); #endregion #region SQL Services services.AddScoped(); - services.AddValidatorsFromAssemblyContaining(); - services.AddScoped, CreateUserProjectValidator>(); - services.AddScoped, SQLHandler>(); + services.AddValidatorsFromAssemblyContaining(); + services.AddScoped, CreateSqlSampleValidator>(); + services.AddScoped, SQLHandler>(); - services.AddScoped, SQLHandler>(); + services.AddScoped, SQLHandler>(); - services.AddValidatorsFromAssemblyContaining(); - services.AddScoped, GetUserProjectValidator>(); - services.AddScoped, SQLHandler>(); + services.AddValidatorsFromAssemblyContaining(); + services.AddScoped, GetSqlSampleValidator>(); + services.AddScoped, SQLHandler>(); - services.AddValidatorsFromAssemblyContaining(); - services.AddScoped, UpdateUserProjectValidator>(); - services.AddScoped, SQLHandler>(); + services.AddValidatorsFromAssemblyContaining(); + services.AddScoped, UpdateSqlSampleValidator>(); + services.AddScoped, SQLHandler>(); - services.AddValidatorsFromAssemblyContaining(); - services.AddScoped, DeleteUserProjectValidator>(); - services.AddScoped, SQLHandler>(); + services.AddValidatorsFromAssemblyContaining(); + services.AddScoped, DeleteSqlSampleValidator>(); + services.AddScoped, SQLHandler>(); #endregion #region KeyVault Services diff --git a/Core.Blueprint.Service.External/Clients/Adapters/BlueprintAdapter.cs b/Core.Blueprint.Service.External/Clients/Adapters/MongoSampleAdapter.cs similarity index 93% rename from Core.Blueprint.Service.External/Clients/Adapters/BlueprintAdapter.cs rename to Core.Blueprint.Service.External/Clients/Adapters/MongoSampleAdapter.cs index 153ef97..a7b1800 100644 --- a/Core.Blueprint.Service.External/Clients/Adapters/BlueprintAdapter.cs +++ b/Core.Blueprint.Service.External/Clients/Adapters/MongoSampleAdapter.cs @@ -1,6 +1,6 @@ namespace Core.Blueprint.Service.External.Clients.Adapters { - public class BlueprintAdapter + public class MongoSampleAdapter { public string Name { get; set; } = null!; public string? Description { get; set; } diff --git a/Core.Blueprint.Service.External/Clients/Adapters/UserProjectAdapter.cs b/Core.Blueprint.Service.External/Clients/Adapters/SqlSampleAdapter.cs similarity index 94% rename from Core.Blueprint.Service.External/Clients/Adapters/UserProjectAdapter.cs rename to Core.Blueprint.Service.External/Clients/Adapters/SqlSampleAdapter.cs index 9723eac..8563d3f 100644 --- a/Core.Blueprint.Service.External/Clients/Adapters/UserProjectAdapter.cs +++ b/Core.Blueprint.Service.External/Clients/Adapters/SqlSampleAdapter.cs @@ -1,6 +1,6 @@ namespace Core.Blueprint.Service.External.Clients.Adapters { - public class UserProjectAdapter + public class SqlSampleAdapter { public string ProjectCode { get; set; } = null!; public string ProjectDescription { get; set; } = null!; diff --git a/Core.Blueprint.Service.External/Clients/IBlueprintServiceClient.cs b/Core.Blueprint.Service.External/Clients/IBlueprintServiceClient.cs index 57b7e10..1c774ac 100644 --- a/Core.Blueprint.Service.External/Clients/IBlueprintServiceClient.cs +++ b/Core.Blueprint.Service.External/Clients/IBlueprintServiceClient.cs @@ -10,35 +10,35 @@ namespace Core.Blueprint.Service.External.Clients { public interface IBlueprintServiceClient { - [Post("/v1/MongoBlueprint/Create")] - Task CreateBlueprintAsync([FromBody] BlueprintRequest newBlueprint, CancellationToken cancellationToken = default); + [Post("/v1/MongoSample/Create")] + Task CreateMongoSampleAsync([FromBody] MongoSampleRequest newSample, CancellationToken cancellationToken = default); - [Get("/v1/MongoBlueprint/GetAll")] - Task> GetAllBlueprintsAsync(CancellationToken cancellationToken = default); + [Get("/v1/MongoSample/GetAll")] + Task> GetAllMongoSamplesAsync(CancellationToken cancellationToken = default); - [Get("/v1/MongoBlueprint/{_id}/GetBy_Id")] - Task GetBlueprintByIdAsync([FromRoute] string _id, CancellationToken cancellationToken = default); + [Get("/v1/MongoSample/{_id}/GetBy_Id")] + Task GetMongoSampleByIdAsync([FromRoute] string _id, CancellationToken cancellationToken = default); - [Put("/v1/MongoBlueprint/{_id}/Update")] - Task UpdateBlueprintAsync([FromRoute] string _id, [FromBody] BlueprintAdapter entity, CancellationToken cancellationToken = default); + [Put("/v1/MongoSample/{_id}/Update")] + Task UpdateMongoSampleAsync([FromRoute] string _id, [FromBody] MongoSampleAdapter entity, CancellationToken cancellationToken = default); - [Delete("/v1/MongoBlueprint/{_id}/Delete")] - Task DeleteBlueprintAsync([FromRoute] string _id, CancellationToken cancellationToken = default); + [Delete("/v1/MongoSample/{_id}/Delete")] + Task DeleteMongoSampleAsync([FromRoute] string _id, CancellationToken cancellationToken = default); - [Post("/v1/UserProject/Create")] - Task CreateUserProjectAsync([FromBody] UserProjectRequest newUserProject, CancellationToken cancellationToken = default); + [Post("/v1/SqlSample/Create")] + Task CreateSqlSampleAsync([FromBody] SqlSampleRequest newSqlSample, CancellationToken cancellationToken = default); - [Get("/v1/UserProject/GetAll")] - Task> GetAllUserProjectsAsync(CancellationToken cancellationToken = default); + [Get("/v1/SqlSample/GetAll")] + Task> GetAllSqlSamplesAsync(CancellationToken cancellationToken = default); - [Get("/v1/UserProject/{id}/GetById")] - Task GetUserProjectByIdAsync([FromRoute] int id, CancellationToken cancellationToken = default); + [Get("/v1/SqlSample/{id}/GetById")] + Task GetSqlSampleByIdAsync([FromRoute] int id, CancellationToken cancellationToken = default); - [Put("/v1/UserProject/{id}/Update")] - Task UpdateUserProjectAsync([FromRoute] int id, [FromBody] UserProjectAdapter entity, CancellationToken cancellationToken = default); + [Put("/v1/SqlSample/{id}/Update")] + Task UpdateSqlSampleAsync([FromRoute] int id, [FromBody] SqlSampleAdapter entity, CancellationToken cancellationToken = default); - [Delete("/v1/UserProject/{id}/Delete")] - Task DeleteUserProjectAsync([FromRoute] int id, CancellationToken cancellationToken = default); + [Delete("/v1/SqlSample/{id}/Delete")] + Task DeleteSqlSampleAsync([FromRoute] int id, CancellationToken cancellationToken = default); [Post("/v1/KeyVault/CreateSecret")] Task CreateSecretAsync([FromBody] KeyVaultRequest newKeyVault, CancellationToken cancellationToken = default); diff --git a/Core.Blueprint.Service.External/Clients/Requests/BlueprintRequest.cs b/Core.Blueprint.Service.External/Clients/Requests/MongoSampleRequest.cs similarity index 83% rename from Core.Blueprint.Service.External/Clients/Requests/BlueprintRequest.cs rename to Core.Blueprint.Service.External/Clients/Requests/MongoSampleRequest.cs index 9bf5437..838d3f4 100644 --- a/Core.Blueprint.Service.External/Clients/Requests/BlueprintRequest.cs +++ b/Core.Blueprint.Service.External/Clients/Requests/MongoSampleRequest.cs @@ -1,6 +1,6 @@ namespace Core.Blueprint.Service.External.Clients.Requests { - public class BlueprintRequest + public class MongoSampleRequest { public string Name { get; set; } = null!; public string? Description { get; set; } diff --git a/Core.Blueprint.Service.External/Clients/Requests/SqlSampleRequest.cs b/Core.Blueprint.Service.External/Clients/Requests/SqlSampleRequest.cs new file mode 100644 index 0000000..cbac45c --- /dev/null +++ b/Core.Blueprint.Service.External/Clients/Requests/SqlSampleRequest.cs @@ -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!; + } +} diff --git a/Core.Blueprint.Service.External/Clients/Requests/UserProjectRequest.cs b/Core.Blueprint.Service.External/Clients/Requests/UserProjectRequest.cs deleted file mode 100644 index f111663..0000000 --- a/Core.Blueprint.Service.External/Clients/Requests/UserProjectRequest.cs +++ /dev/null @@ -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!; - } -}