From e4676611e42c887cc55423b00f86f8c23d2f26bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87etinkaya?= Date: Wed, 7 Feb 2024 13:51:25 +0300 Subject: [PATCH] refactor(*): upgrade to v0.1.0 --- .../CommandLine/Git/GitCommandHelper.cs | 2 +- .../Commands/New/CreateNewProjectCommand.cs | 113 +++++++++--------- .../New/CreateNewProjectCliCommandSettings.cs | 4 +- src/nArchGen/Domain/Domain.csproj | 25 +--- .../Create/CreateENTITYCommand.cs.sbn | 2 +- .../Delete/DeleteENTITYCommand.cs.sbn | 2 +- .../Update/UpdateENTITYCommand.cs.sbn | 2 +- .../PLURAL_ENTITYBusinessMessages.cs.sbn | 4 +- .../Queries/GetById/GetByIdENTITYQuery.cs.sbn | 2 +- .../Queries/GetList/GetListENTITYQuery.cs.sbn | 2 +- .../Locales/PLURAL_ENTITY.en.yaml.sbn | 1 + .../Rules/ENTITYBusinessRules.cs.sbn | 16 ++- .../Commands/COMMAND/COMMANDCommand.cs.sbn | 2 +- .../FEATURE/Queries/QUERY/QUERYQuery.cs.sbn | 4 +- 14 files changed, 88 insertions(+), 93 deletions(-) create mode 100644 src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Resources/Locales/PLURAL_ENTITY.en.yaml.sbn diff --git a/src/corePackages/Core.CodeGen/CommandLine/Git/GitCommandHelper.cs b/src/corePackages/Core.CodeGen/CommandLine/Git/GitCommandHelper.cs index d998887..3cb9ca6 100644 --- a/src/corePackages/Core.CodeGen/CommandLine/Git/GitCommandHelper.cs +++ b/src/corePackages/Core.CodeGen/CommandLine/Git/GitCommandHelper.cs @@ -11,7 +11,7 @@ public static Process GetGitProcess() gitProcess.StartInfo.WorkingDirectory = Environment.CurrentDirectory; gitProcess.StartInfo.UseShellExecute = false; gitProcess.StartInfo.RedirectStandardOutput = true; - gitProcess.StartInfo.RedirectStandardError = true; + gitProcess.StartInfo.RedirectStandardError = false; return gitProcess; } diff --git a/src/nArchGen/Application/Features/Create/Commands/New/CreateNewProjectCommand.cs b/src/nArchGen/Application/Features/Create/Commands/New/CreateNewProjectCommand.cs index 32a766c..a1687bf 100644 --- a/src/nArchGen/Application/Features/Create/Commands/New/CreateNewProjectCommand.cs +++ b/src/nArchGen/Application/Features/Create/Commands/New/CreateNewProjectCommand.cs @@ -2,6 +2,7 @@ using Core.CodeGen.CommandLine.Git; using Core.CodeGen.File; using MediatR; +using System.IO.Compression; using System.Runtime.CompilerServices; namespace Application.Features.Create.Commands.New; @@ -36,7 +37,7 @@ [EnumeratorCancellation] CancellationToken cancellationToken response.CurrentStatusMessage = "Cloning starter project and core packages..."; yield return response; response.OutputMessage = null; - await cloneCorePackagesAndStarterProject(request.ProjectName); + await downloadStarterProject(request.ProjectName); response.LastOperationMessage = "Starter project has been cloned from 'https://github.com/kodlamaio-projects/nArchitecture'."; @@ -48,9 +49,6 @@ [EnumeratorCancellation] CancellationToken cancellationToken response.LastOperationMessage = $"Project has been prepared with {request.ProjectName.ToPascalCase()}."; - DirectoryHelper.DeleteDirectory( - $"{Environment.CurrentDirectory}/{request.ProjectName}/.git" - ); ICollection newFiles = DirectoryHelper.GetFilesInDirectoryTree( root: $"{Environment.CurrentDirectory}/{request.ProjectName}", searchPattern: "*" @@ -70,10 +68,26 @@ [EnumeratorCancellation] CancellationToken cancellationToken yield return response; } - private async Task cloneCorePackagesAndStarterProject(string projectName) => - await GitCommandHelper.RunAsync( - $"clone https://github.com/kodlamaio-projects/nArchitecture.git ./{projectName}" + private async Task downloadStarterProject(string projectName) + { + // Download zip on url + string releaseUrl = + "https://github.com/kodlamaio-projects/nArchitecture/archive/refs/tags/v0.1.0.zip"; + using HttpClient client = new(); + using HttpResponseMessage response = await client.GetAsync(releaseUrl); + response.EnsureSuccessStatusCode(); + string zipPath = $"{Environment.CurrentDirectory}/{projectName}.zip"; + await using Stream zipStream = await response.Content.ReadAsStreamAsync(); + await using FileStream fileStream = new(zipPath, FileMode.Create, FileAccess.Write); + await zipStream.CopyToAsync(fileStream); + fileStream.Close(); + ZipFile.ExtractToDirectory(zipPath, Environment.CurrentDirectory); + File.Delete(zipPath); + Directory.Move( + sourceDirName: $"{Environment.CurrentDirectory}/nArchitecture-0.1.0", + $"{Environment.CurrentDirectory}/{projectName}" ); + } private async Task renameProject(string projectName) { @@ -314,50 +328,18 @@ await FileHelper.RemoveContentAsync( filePath: $"{projectSourcePath}/WebAPI/Program.cs", contents: new[] { - "using Core.Security;", - "using Core.Security.Encryption;", - "using Core.Security.JWT;", - "using Core.WebAPI.Extensions.Swagger;", - "using Microsoft.AspNetCore.Authentication.JwtBearer;", - "using Microsoft.IdentityModel.Tokens;", - "using Microsoft.OpenApi.Models;", - "builder.Services.AddSecurityServices();", - @"const string tokenOptionsConfigurationSection = ""TokenOptions""; -TokenOptions tokenOptions = - builder.Configuration.GetSection(tokenOptionsConfigurationSection).Get() - ?? throw new InvalidOperationException($""\""{tokenOptionsConfigurationSection}\"" section cannot found in configuration.""); -builder.Services - .AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddJwtBearer(options => - { - options.TokenValidationParameters = new TokenValidationParameters - { - ValidateIssuer = true, - ValidateAudience = true, - ValidateLifetime = true, - ValidIssuer = tokenOptions.Issuer, - ValidAudience = tokenOptions.Audience, - ValidateIssuerSigningKey = true, - IssuerSigningKey = SecurityKeyHelper.CreateSecurityKey(tokenOptions.SecurityKey) - }; - });", - @"opt.AddSecurityDefinition( - name: ""Bearer"", - securityScheme: new OpenApiSecurityScheme - { - Name = ""Authorization"", - Type = SecuritySchemeType.Http, - Scheme = ""Bearer"", - BearerFormat = ""JWT"", - In = ParameterLocation.Header, - Description = - ""JWT Authorization header using the Bearer scheme. Example: \""Authorization: Bearer YOUR_TOKEN\"". \r\n\r\n"" - + ""`Enter your token in the text input below.`"" - } - ); - opt.OperationFilter();", - @"app.UseAuthentication(); -app.UseAuthorization();" + "using Core.Security;\n", + "using Core.Security.Encryption;\n", + "using Core.Security.JWT;\n", + "using Core.WebAPI.Extensions.Swagger;\n", + "using Microsoft.AspNetCore.Authentication.JwtBearer;\n", + "using Microsoft.IdentityModel.Tokens;\n", + "using Microsoft.OpenApi.Models;\n", + "builder.Services.AddSecurityServices();\n", + "const string tokenOptionsConfigurationSection = \"TokenOptions\";\nTokenOptions tokenOptions =\n builder.Configuration.GetSection(tokenOptionsConfigurationSection).Get()\n ?? throw new InvalidOperationException($\"\\\"{tokenOptionsConfigurationSection}\\\" section cannot found in configuration.\");\nbuilder\n .Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)\n .AddJwtBearer(options =>\n {\n options.TokenValidationParameters = new TokenValidationParameters\n {\n ValidateIssuer = true,\n ValidateAudience = true,\n ValidateLifetime = true,\n ValidIssuer = tokenOptions.Issuer,\n ValidAudience = tokenOptions.Audience,\n ValidateIssuerSigningKey = true,\n IssuerSigningKey = SecurityKeyHelper.CreateSecurityKey(tokenOptions.SecurityKey)\n };\n });\n\n", + " opt.AddSecurityDefinition(\n name: \"Bearer\",\n securityScheme: new OpenApiSecurityScheme\n {\n Name = \"Authorization\",\n Type = SecuritySchemeType.Http,\n Scheme = \"Bearer\",\n BearerFormat = \"JWT\",\n In = ParameterLocation.Header,\n Description =\n \"JWT Authorization header using the Bearer scheme. Example: \\\"Authorization: Bearer YOUR_TOKEN\\\". \\r\\n\\r\\n\"\n + \"`Enter your token in the text input below.`\"\n }\n );\n opt.OperationFilter();\n", + "app.UseAuthentication();\n", + "app.UseAuthorization();\n" } ); } @@ -367,14 +349,35 @@ private async Task initializeGitRepository(string projectName) Directory.SetCurrentDirectory($"./{projectName}"); await GitCommandHelper.RunAsync($"init"); await GitCommandHelper.RunAsync($"branch -m master main"); - Directory.Delete($"{Environment.CurrentDirectory}/src/corePackages/"); - await GitCommandHelper.RunAsync( - "submodule add https://github.com/kodlamaio-projects/nArchitecture.Core ./src/corePackages" - ); + await downloadCorePackages(projectName); await GitCommandHelper.CommitChangesAsync( "chore: initial commit from nArchitecture.Gen" ); Directory.SetCurrentDirectory("../"); } + + private async Task downloadCorePackages(string projectName) + { + string releaseUrl = + "https://github.com/kodlamaio-projects/nArchitecture.Core/archive/refs/tags/v0.1.0.zip"; + using HttpClient client = new(); + using HttpResponseMessage response = await client.GetAsync(releaseUrl); + response.EnsureSuccessStatusCode(); + string zipPath = $"{Environment.CurrentDirectory}/{projectName}.zip"; + await using Stream zipStream = await response.Content.ReadAsStreamAsync(); + await using FileStream fileStream = new(zipPath, FileMode.Create, FileAccess.Write); + await zipStream.CopyToAsync(fileStream); + fileStream.Close(); + ZipFile.ExtractToDirectory(zipPath, Environment.CurrentDirectory); + File.Delete(zipPath); + + string corePackagesDir = $"{Environment.CurrentDirectory}/src/corePackages"; + if (Directory.Exists(corePackagesDir)) + Directory.Delete(corePackagesDir, recursive: true); + Directory.Move( + sourceDirName: $"{Environment.CurrentDirectory}/nArchitecture.Core-0.1.0", + $"{Environment.CurrentDirectory}/src/corePackages" + ); + } } } diff --git a/src/nArchGen/ConsoleUI/Commands/New/CreateNewProjectCliCommandSettings.cs b/src/nArchGen/ConsoleUI/Commands/New/CreateNewProjectCliCommandSettings.cs index 544480c..5f1531b 100644 --- a/src/nArchGen/ConsoleUI/Commands/New/CreateNewProjectCliCommandSettings.cs +++ b/src/nArchGen/ConsoleUI/Commands/New/CreateNewProjectCliCommandSettings.cs @@ -10,7 +10,7 @@ public class Settings : CommandSettings [CommandArgument(position: 0, template: "[ProjectName]")] public string? ProjectName { get; set; } - [CommandOption("--no-security")] + [CommandOption("--security")] public bool IsThereSecurityMechanism { get; set; } public void CheckProjectNameArgument() @@ -30,7 +30,7 @@ public void CheckIsThereSecurityMechanismArgument() return; IsThereSecurityMechanism = AnsiConsole.Confirm( prompt: "Do you want to add security mechanism to your project?", - defaultValue: true + defaultValue: false ); } } diff --git a/src/nArchGen/Domain/Domain.csproj b/src/nArchGen/Domain/Domain.csproj index dd42ce6..10759b8 100644 --- a/src/nArchGen/Domain/Domain.csproj +++ b/src/nArchGen/Domain/Domain.csproj @@ -7,33 +7,14 @@ - + + - + PreserveNewest Templates\%(RecursiveDir)\%(Filename)%(Extension) - - - - - - - - - - - - - - PreserveNewest - - - PreserveNewest - - - \ No newline at end of file diff --git a/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Commands/Create/CreateENTITYCommand.cs.sbn b/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Commands/Create/CreateENTITYCommand.cs.sbn index ca07c3e..cb47fba 100644 --- a/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Commands/Create/CreateENTITYCommand.cs.sbn +++ b/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Commands/Create/CreateENTITYCommand.cs.sbn @@ -17,7 +17,7 @@ public class Create{{ entity.name | string.pascalcase }}Command : IRequest new[] { Admin, Write, {{ entity.name | string.pascalcase | string.plural }}OperationClaims.Create };{{ end }}{{ if is_caching_used }} + public string[] Roles => [Admin, Write, {{ entity.name | string.pascalcase | string.plural }}OperationClaims.Create];{{ end }}{{ if is_caching_used }} public bool BypassCache { get; } public string? CacheKey { get; } diff --git a/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Commands/Delete/DeleteENTITYCommand.cs.sbn b/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Commands/Delete/DeleteENTITYCommand.cs.sbn index 3bf90e5..fb44ff1 100644 --- a/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Commands/Delete/DeleteENTITYCommand.cs.sbn +++ b/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Commands/Delete/DeleteENTITYCommand.cs.sbn @@ -17,7 +17,7 @@ public class Delete{{ entity.name | string.pascalcase }}Command : IRequest new[] { Admin, Write, {{ entity.name | string.pascalcase | string.plural }}OperationClaims.Delete };{{ end }}{{ if is_caching_used }} + public string[] Roles => [Admin, Write, {{ entity.name | string.pascalcase | string.plural }}OperationClaims.Delete];{{ end }}{{ if is_caching_used }} public bool BypassCache { get; } public string? CacheKey { get; } diff --git a/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Commands/Update/UpdateENTITYCommand.cs.sbn b/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Commands/Update/UpdateENTITYCommand.cs.sbn index 0334959..f4c4403 100644 --- a/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Commands/Update/UpdateENTITYCommand.cs.sbn +++ b/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Commands/Update/UpdateENTITYCommand.cs.sbn @@ -18,7 +18,7 @@ public class Update{{ entity.name | string.pascalcase }}Command : IRequest new[] { Admin, Write, {{ entity.name | string.pascalcase | string.plural }}OperationClaims.Update };{{ end }}{{ if is_caching_used }} + public string[] Roles => [Admin, Write, {{ entity.name | string.pascalcase | string.plural }}OperationClaims.Update];{{ end }}{{ if is_caching_used }} public bool BypassCache { get; } public string? CacheKey { get; } diff --git a/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Constants/PLURAL_ENTITYBusinessMessages.cs.sbn b/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Constants/PLURAL_ENTITYBusinessMessages.cs.sbn index 53264a4..fc1738f 100644 --- a/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Constants/PLURAL_ENTITYBusinessMessages.cs.sbn +++ b/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Constants/PLURAL_ENTITYBusinessMessages.cs.sbn @@ -2,5 +2,7 @@ namespace Application.Features.{{ entity.name | string.pascalcase | string.plura public static class {{ entity.name | string.pascalcase | string.plural }}BusinessMessages { - public const string {{ entity.name | string.pascalcase }}NotExists = "{{ entity.name | string.words | string.downcase | string.capitalize }} not exists."; + public const string SectionName = "{{ entity.name | string.pascalcase }}"; + + public const string {{ entity.name | string.pascalcase }}NotExists = "{{ entity.name | string.pascalcase }}NotExists"; } \ No newline at end of file diff --git a/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Queries/GetById/GetByIdENTITYQuery.cs.sbn b/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Queries/GetById/GetByIdENTITYQuery.cs.sbn index e399713..b2b2967 100644 --- a/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Queries/GetById/GetByIdENTITYQuery.cs.sbn +++ b/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Queries/GetById/GetByIdENTITYQuery.cs.sbn @@ -13,7 +13,7 @@ public class GetById{{ entity.name | string.pascalcase }}Query : IRequest new[] { Admin, Read };{{ end }} + public string[] Roles => [Admin, Read];{{ end }} public class GetById{{ entity.name | string.pascalcase }}QueryHandler : IRequestHandler { diff --git a/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Queries/GetList/GetListENTITYQuery.cs.sbn b/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Queries/GetList/GetListENTITYQuery.cs.sbn index 8a22e6e..5f50056 100644 --- a/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Queries/GetList/GetListENTITYQuery.cs.sbn +++ b/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Queries/GetList/GetListENTITYQuery.cs.sbn @@ -16,7 +16,7 @@ public class GetList{{ entity.name | string.pascalcase }}Query : IRequest new[] { Admin, Read };{{ end }}{{ if is_caching_used }} + public string[] Roles => [Admin, Read];{{ end }}{{ if is_caching_used }} public bool BypassCache { get; } public string? CacheKey => $"GetList{{ entity.name | string.pascalcase | string.plural }}({PageRequest.PageIndex},{PageRequest.PageSize})"; diff --git a/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Resources/Locales/PLURAL_ENTITY.en.yaml.sbn b/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Resources/Locales/PLURAL_ENTITY.en.yaml.sbn new file mode 100644 index 0000000..43a1eb5 --- /dev/null +++ b/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Resources/Locales/PLURAL_ENTITY.en.yaml.sbn @@ -0,0 +1 @@ +{{ entity.name | string.pascalcase }}NotExists: "{{ entity.name | string.words | string.downcase | string.capitalize }} don't exists." \ No newline at end of file diff --git a/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Rules/ENTITYBusinessRules.cs.sbn b/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Rules/ENTITYBusinessRules.cs.sbn index 7c4f441..f2069e4 100644 --- a/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Rules/ENTITYBusinessRules.cs.sbn +++ b/src/nArchGen/Domain/Templates/CRUD/Folders/Application/Features/PLURAL_ENTITY/Rules/ENTITYBusinessRules.cs.sbn @@ -2,6 +2,7 @@ using Application.Services.Repositories; using Core.Application.Rules; using Core.CrossCuttingConcerns.Exceptions.Types; +using Core.Localization.Abstraction; using Domain.Entities; namespace Application.Features.{{ entity.name | string.pascalcase | string.plural }}.Rules; @@ -9,17 +10,24 @@ namespace Application.Features.{{ entity.name | string.pascalcase | string.plura public class {{ entity.name | string.pascalcase }}BusinessRules : BaseBusinessRules { private readonly I{{ entity.name | string.pascalcase }}Repository _{{ entity.name | string.camelcase }}Repository; + private readonly ILocalizationService _localizationService; - public {{ entity.name | string.pascalcase }}BusinessRules(I{{ entity.name | string.pascalcase }}Repository {{ entity.name | string.camelcase }}Repository) + public {{ entity.name | string.pascalcase }}BusinessRules(I{{ entity.name | string.pascalcase }}Repository {{ entity.name | string.camelcase }}Repository, ILocalizationService localizationService) { _{{ entity.name | string.camelcase }}Repository = {{ entity.name | string.camelcase }}Repository; + _localizationService = localizationService; } - public Task {{ entity.name | string.pascalcase }}ShouldExistWhenSelected({{ entity.name | string.pascalcase }}? {{ entity.name | string.camelcase }}) + private async Task throwBusinessException(string messageKey) + { + string message = await _localizationService.GetLocalizedAsync(messageKey, {{ entity.name | string.pascalcase | string.plural }}BusinessMessages.SectionName); + throw new BusinessException(message); + } + + public async Task {{ entity.name | string.pascalcase }}ShouldExistWhenSelected({{ entity.name | string.pascalcase }}? {{ entity.name | string.camelcase }}) { if ({{ entity.name | string.camelcase }} == null) - throw new BusinessException({{ entity.name | string.pascalcase | string.plural }}BusinessMessages.{{ entity.name | string.pascalcase }}NotExists); - return Task.CompletedTask; + await throwBusinessException({{ entity.name | string.pascalcase | string.plural }}BusinessMessages.{{ entity.name | string.pascalcase }}NotExists); } public async Task {{ entity.name | string.pascalcase }}IdShouldExistWhenSelected({{ entity.id_type }} id, CancellationToken cancellationToken) diff --git a/src/nArchGen/Domain/Templates/Command/Folders/Application/Features/FEATURE/Commands/COMMAND/COMMANDCommand.cs.sbn b/src/nArchGen/Domain/Templates/Command/Folders/Application/Features/FEATURE/Commands/COMMAND/COMMANDCommand.cs.sbn index 167d943..14476f6 100644 --- a/src/nArchGen/Domain/Templates/Command/Folders/Application/Features/FEATURE/Commands/COMMAND/COMMANDCommand.cs.sbn +++ b/src/nArchGen/Domain/Templates/Command/Folders/Application/Features/FEATURE/Commands/COMMAND/COMMANDCommand.cs.sbn @@ -13,7 +13,7 @@ namespace Application.Features.{{ feature_name }}.Commands.{{ command_name | str public class {{ command_name | string.pascalcase }}Command : IRequest<{{ command_name | string.pascalcase }}Response>{{ if is_secured_operation_used }}, ISecuredRequest{{ end }}{{ if is_caching_used }}, ICacheRemoverRequest{{ end }}{{ if is_logging_used }}, ILoggableRequest{{ end }}{{ if is_transaction_used }}, ITransactionalRequest{{ end }} {%{{}%}{{ if is_secured_operation_used }} - public string[] Roles => new[] { Admin, Write, {{ feature_name | string.pascalcase }}OperationClaims.{{ command_name }} };{{ end }}{{ if is_caching_used }} + public string[] Roles => [Admin, Write, {{ feature_name | string.pascalcase }}OperationClaims.{{ command_name }}];{{ end }}{{ if is_caching_used }} public bool BypassCache { get; } public string? CacheKey { get; } diff --git a/src/nArchGen/Domain/Templates/Query/Folders/Application/Features/FEATURE/Queries/QUERY/QUERYQuery.cs.sbn b/src/nArchGen/Domain/Templates/Query/Folders/Application/Features/FEATURE/Queries/QUERY/QUERYQuery.cs.sbn index bd7c25b..1fd01fc 100644 --- a/src/nArchGen/Domain/Templates/Query/Folders/Application/Features/FEATURE/Queries/QUERY/QUERYQuery.cs.sbn +++ b/src/nArchGen/Domain/Templates/Query/Folders/Application/Features/FEATURE/Queries/QUERY/QUERYQuery.cs.sbn @@ -9,10 +9,10 @@ using static Application.Features.{{ feature_name }}.Constants.{{ feature_name } namespace Application.Features.{{ feature_name }}.Queries.{{ query_name | string.pascalcase }}; -public class {{ query_name | string.pascalcase }}Query : IRequest<{{ query_name | string.pascalcase }}Response>{{ if is_secured_operation_used }}, ISecuredRequest{{ end }}{{ if is_caching_used }}, ICacheRemoverRequest{{ end }}{{ if is_logging_used }}, ILoggableRequest{{ end }} +public class {{ query_name | string.pascalcase }}Query : IRequest<{{ query_name | string.pascalcase }}Response>{{ if is_secured_operation_used }}, ISecuredRequest{{ end }}{{ if is_caching_used }}, ICachableRequest{{ end }}{{ if is_logging_used }}, ILoggableRequest{{ end }} {%{{}%}{{ if is_secured_operation_used }} - public string[] Roles => new[] { Admin, Read, {{ feature_name | string.pascalcase }}OperationClaims.{{ query_name }} };{{ end }}{{ if is_caching_used }} + public string[] Roles => [Admin, Read, {{ feature_name | string.pascalcase }}OperationClaims.{{ query_name }}];{{ end }}{{ if is_caching_used }} public bool BypassCache { get; } public string? CacheKey => $"{{ query_name }}";