Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d82cc33
Adiciona .editorconfig e Directory.Build.props ao projeto
MarcioGoncalves Aug 11, 2026
21b3199
Refatora nomenclatura de eventos e organiza classes
MarcioGoncalves Aug 11, 2026
2bba29f
Ajusta regras de análise no .editorconfig
MarcioGoncalves Aug 11, 2026
211b490
Refatoração geral, melhorias e ajustes em domínios
MarcioGoncalves Aug 11, 2026
0c9161a
Ajusta regras de análise no .editorconfig
MarcioGoncalves Aug 11, 2026
7b528eb
Refatora e organiza código em todo o projeto
MarcioGoncalves Aug 11, 2026
97e2088
Refatoração geral, melhorias e novos endpoints públicos
MarcioGoncalves Aug 11, 2026
f1e4ec0
Refatoração e padronização de código em diversos arquivos.
MarcioGoncalves Aug 11, 2026
2dc72a7
Refatora testes unitários da camada EduPag
MarcioGoncalves Aug 11, 2026
4a2617a
Ajusta .editorconfig com novas sugestões de código
MarcioGoncalves Aug 11, 2026
7af3d0c
Refatora testes de integração e organiza mocks/utilitários
MarcioGoncalves Aug 11, 2026
fe189b4
Padroniza e refatora testes de integração das APIs
MarcioGoncalves Aug 11, 2026
a77b031
Refatora testes: sealed, Dispose e ajustes de estilo
MarcioGoncalves Aug 11, 2026
6b1c126
Atualiza pacotes, refatora testes e reorganiza arquivos
MarcioGoncalves Aug 11, 2026
88dff02
Adiciona testes unitários para MessageBus
MarcioGoncalves Aug 11, 2026
fc2b289
Adiciona [ExcludeFromCodeCoverage] e config do MessageBus
MarcioGoncalves Aug 12, 2026
7ba71e8
Adiciona novos testes unitários e ajustes em MessageBus
MarcioGoncalves Aug 12, 2026
72a5cb0
Adiciona testes unitários para RefreshToken no controller
MarcioGoncalves Aug 12, 2026
6c2e999
Remover operador ! e marcar DbSet como required
MarcioGoncalves Aug 12, 2026
4650042
Refatora inicialização de DbSet no contexto EF
MarcioGoncalves Aug 12, 2026
9a414af
Ajusta inicialização de RefreshTokens no contexto
MarcioGoncalves Aug 12, 2026
5081399
Padroniza quebras de linha para LF no .editorconfig
MarcioGoncalves Aug 12, 2026
35290bf
Comenta charset=utf-8 na seção [*.cs] do .editorconfig
MarcioGoncalves Aug 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
155 changes: 155 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
root = true

# Regras gerais para C#
[*.cs]
#charset = utf-8
dotnet_diagnostic.SA0001.severity = none
dotnet_diagnostic.IDE0005.severity = none
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true

# Forçar severidade padrão dos analisadores Roslyn
dotnet_analyzer_diagnostic.severity = warning

# Estilo de código recomendados (exemplos)
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion

# Ordenação de using
dotnet_sort_system_directives_first = true:warning

# Exemplos de severidade para regras específicas (StyleCop)
dotnet_diagnostic.SA1200.severity = none
dotnet_diagnostic.SA1309.severity = none

# Nomes e formatos (exemplo simples)
dotnet_naming_rule.private_fields_should_be_camel_case.severity = suggestion

# Regras de nomenclatura
dotnet_naming_rule.private_fields_should_be_camel_case.severity = suggestion
dotnet_naming_rule.private_fields_should_be_camel_case.symbols = private_fields
dotnet_naming_rule.private_fields_should_be_camel_case.style = camel_case

dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private

dotnet_naming_style.camel_case.capitalization = camel_case

# Regras de estilo de código
csharp_style_expression_bodied_methods = false:suggestion
csharp_style_expression_bodied_constructors = false:suggestion
csharp_style_expression_bodied_operators = false:suggestion
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_indexers = true:suggestion
csharp_style_expression_bodied_accessors = true:suggestion

csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion

csharp_style_prefer_method_group_conversion = true:suggestion
csharp_style_prefer_top_level_statements = true:suggestion
csharp_style_prefer_primary_constructors = false:suggestion

# Regras de espaço e formatação
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false

# Default severity for analyzer diagnostics with category 'StyleCop.CSharp.DocumentationRules'
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.DocumentationRules.severity = none

# SYSLIB1045: Converter em 'GeneratedRegexAttribute'.
dotnet_diagnostic.SYSLIB1045.severity = none

# SA1101: Prefix local calls with this
dotnet_diagnostic.SA1101.severity = none

# IDE1006: Estilos de Nomenclatura
dotnet_diagnostic.IDE1006.severity = none

# IDE0058: O valor da expressão nunca é usado
dotnet_diagnostic.IDE0058.severity = none

# IDE0046: Converter em expressão condicional
dotnet_diagnostic.IDE0046.severity = suggestion

# SA1201: Elements should appear in the correct order
dotnet_diagnostic.SA1201.severity = suggestion

# IDE0041: Usar verificação 'is null'
dotnet_diagnostic.IDE0041.severity = suggestion

# SA1503: Braces should not be omitted
dotnet_diagnostic.SA1503.severity = suggestion

# IDE0011: Adicionar chaves
dotnet_diagnostic.IDE0011.severity = none

# IDE0028: Simplificar a inicialização de coleção
dotnet_diagnostic.IDE0028.severity = suggestion

# IDE0200: Remover expressão lambda desnecessária
dotnet_diagnostic.IDE0200.severity = suggestion

# IDE0305: Simplificar a inicialização de coleção
dotnet_diagnostic.IDE0305.severity = suggestion

# IDE0060: Remover o parâmetro não utilizado
dotnet_diagnostic.IDE0060.severity = suggestion

# CA1720: O identificador contém o nome de tipo
dotnet_diagnostic.CA1720.severity = none

# Desabilita SA1633 (cabeçalho de arquivo) globalmente para arquivos C#
dotnet_diagnostic.SA1633.severity = none

# SA1413: Use trailing comma in multi-line initializers
dotnet_diagnostic.SA1413.severity = suggestion

# IDE0100: Remover a igualdade redundante
dotnet_diagnostic.IDE0100.severity = none

# CA1816: Os métodos Dispose devem chamar SuppressFinalize
dotnet_diagnostic.CA1816.severity = suggestion

# IDE0052: Remover membros particulares não lidos
dotnet_diagnostic.IDE0052.severity = suggestion

# CA1051: Não declarar campos de instância visíveis
dotnet_diagnostic.CA1051.severity = suggestion

# SA1401: Fields should be private
dotnet_diagnostic.SA1401.severity = suggestion

# SA1306: Field names should begin with lower-case letter
dotnet_diagnostic.SA1306.severity = suggestion

# SA1100: Do not prefix calls with base unless local implementation exists
dotnet_diagnostic.SA1100.severity = suggestion

# CA1707: Identificadores não devem conter sublinhados
dotnet_diagnostic.CA1707.severity = none

# IDE0022: Usar o corpo do bloco para método
dotnet_diagnostic.IDE0022.severity = none

# IDE0301: Simplificar a inicialização de coleção
dotnet_diagnostic.IDE0301.severity = suggestion

# CA1305: Especificar IFormatProvider
dotnet_diagnostic.CA1305.severity = suggestion

# IDE0059: Atribuição desnecessária de um valor
dotnet_diagnostic.IDE0059.severity = suggestion

# CS8604: Possível argumento de referência nula.
dotnet_diagnostic.CS8604.severity = suggestion

# CA1827: Não usar Count() ou LongCount() quando Any() puder ser usado
dotnet_diagnostic.CA1827.severity = suggestion
35 changes: 35 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<Project>
<PropertyGroup>
<!-- Alvo padrão (projetos já em .NET 8 podem herdar) -->
<TargetFramework>net8.0</TargetFramework>

<!-- Habilita nullable e usings implícitos do .NET moderno -->
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>

<!-- Versão do C# compatível com .NET 8 -->
<LangVersion>12.0</LangVersion>

<!-- Ajuste de warnings -->
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

<!-- Analisadores e modo de análise -->
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<AnalysisLevel>latest</AnalysisLevel>
<CodeAnalysisTreatWarningsAsErrors>$(TreatWarningsAsErrors)</CodeAnalysisTreatWarningsAsErrors>

<!-- (Opcional) URL do repositório para pacotes e SourceLink -->
<RepositoryUrl>https://github.com/rinaldoserra-dev/plataforma-educacao-devops</RepositoryUrl>

</PropertyGroup>

<!-- Pacotes de analisadores aplicados a todos os projetos (PrivateAssets para não fluir para consumidores) -->
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="10.0.302" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
15 changes: 15 additions & 0 deletions PlataformaEducacao.sln
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{81405219-1
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlataformaEducacao.Core.Tests", "src\tests\PlataformaEducacaoCore\PlataformaEducacao.Core.Tests.csproj", "{7CF9F8F1-2CFE-4543-9F1B-D1D819344A03}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlataformaEducacao.GestaoConteudo.Data.Tests", "src\tests\PlataformaEducacao.GestaoConteudo.Data.Tests\PlataformaEducacao.GestaoConteudo.Data.Tests.csproj", "{0EDB1AC8-CC4B-487F-83AA-3072C0CF5689}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -443,6 +445,18 @@ Global
{7CF9F8F1-2CFE-4543-9F1B-D1D819344A03}.Release|x64.Build.0 = Release|Any CPU
{7CF9F8F1-2CFE-4543-9F1B-D1D819344A03}.Release|x86.ActiveCfg = Release|Any CPU
{7CF9F8F1-2CFE-4543-9F1B-D1D819344A03}.Release|x86.Build.0 = Release|Any CPU
{0EDB1AC8-CC4B-487F-83AA-3072C0CF5689}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0EDB1AC8-CC4B-487F-83AA-3072C0CF5689}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0EDB1AC8-CC4B-487F-83AA-3072C0CF5689}.Debug|x64.ActiveCfg = Debug|Any CPU
{0EDB1AC8-CC4B-487F-83AA-3072C0CF5689}.Debug|x64.Build.0 = Debug|Any CPU
{0EDB1AC8-CC4B-487F-83AA-3072C0CF5689}.Debug|x86.ActiveCfg = Debug|Any CPU
{0EDB1AC8-CC4B-487F-83AA-3072C0CF5689}.Debug|x86.Build.0 = Debug|Any CPU
{0EDB1AC8-CC4B-487F-83AA-3072C0CF5689}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0EDB1AC8-CC4B-487F-83AA-3072C0CF5689}.Release|Any CPU.Build.0 = Release|Any CPU
{0EDB1AC8-CC4B-487F-83AA-3072C0CF5689}.Release|x64.ActiveCfg = Release|Any CPU
{0EDB1AC8-CC4B-487F-83AA-3072C0CF5689}.Release|x64.Build.0 = Release|Any CPU
{0EDB1AC8-CC4B-487F-83AA-3072C0CF5689}.Release|x86.ActiveCfg = Release|Any CPU
{0EDB1AC8-CC4B-487F-83AA-3072C0CF5689}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -494,6 +508,7 @@ Global
{CB93565F-3313-4670-AB4C-8F71ADF66D63} = {56D316E0-2671-4404-9D44-01FCE4AD8192}
{81405219-192E-4FA9-96E4-F550F8A8386F} = {56D316E0-2671-4404-9D44-01FCE4AD8192}
{7CF9F8F1-2CFE-4543-9F1B-D1D819344A03} = {81405219-192E-4FA9-96E4-F550F8A8386F}
{0EDB1AC8-CC4B-487F-83AA-3072C0CF5689} = {53FF5E3B-DD37-43A1-9553-3B4135CA7E9E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5076C19C-1C60-4400-A9A6-CA081FE46BAE}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static IHostBuilder ConfigureAppSettings(this IHostBuilder host)

return host;
}

public static IServiceCollection AddApiConfig(this IServiceCollection services, IConfiguration configuration)
{
services.AddControllers();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
namespace PlataformaEducacao.Bff.Api.Configurations
using PlataformaEducacao.Core.Utils;
using PlataformaEducacao.MessageBus;

namespace PlataformaEducacao.Bff.Api.Configurations
{
public static class MessageBusConfig
{
public static IServiceCollection AddMessageBusConfiguration(this IServiceCollection services, IConfiguration configuration)
{
services.AddMessageBus(configuration.GetMessageQueueConnection("MessageBus"));

return services;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public static IServiceCollection AddSwaggerConfiguration(this IServiceCollection
License = new OpenApiLicense { Name = "MIT", Url = new Uri("https://opensource.org/licenses/MIT") }
});


option.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
In = ParameterLocation.Header,
Expand All @@ -38,10 +37,9 @@ public static IServiceCollection AddSwaggerConfiguration(this IServiceCollection
Id = "Bearer"
}
},
new string[] {}
Array.Empty<string>()
}
});

});

return services;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected ActionResult CustomResponse(ModelStateDictionary modelState)

protected ActionResult CustomResponse(ResponseResult response)
{
if (response == null || !response.Sucesso || response.Erros.Mensagens.Any())
if (response == null || !response.Sucesso || response.Erros.Mensagens.Count != 0)
{
return BadRequest(response);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Microsoft.AspNetCore.Authorization;
using System.Text.Json;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using PlataformaEducacao.Bff.Api.Models.GestaoAlunos;
using PlataformaEducacao.Bff.Api.Models.GestaoConteudo;
using PlataformaEducacao.Bff.Api.Services;
using PlataformaEducacao.WebApi.Core.Controllers;
using System.Text.Json;

namespace PlataformaEducacao.Bff.Api.Controllers
{
Expand All @@ -30,9 +30,7 @@ public async Task<IActionResult> Matricular(MatricularDTO matricular)
}

var cursoDetalhes = JsonSerializer.Deserialize<CursoDetalhesDTO>(
curso!.Data.ToString()!,
new JsonSerializerOptions { PropertyNameCaseInsensitive = true }
);
curso.Data.ToString(), JsonSerializerOptions);

if (cursoDetalhes != null)
{
Expand Down Expand Up @@ -115,5 +113,10 @@ public async Task<IActionResult> BaixarCertificado(Guid certificadoId)

return File(bytes, contentType, fileName.Trim('"'));
}

private static readonly JsonSerializerOptions JsonSerializerOptions = new()
{
PropertyNameCaseInsensitive = true
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public async Task<IActionResult> AdicionarCurso([FromBody] AdicionarCursoRequest

return CustomResponse(resposta);
}

[HttpPut("{id:guid}")]
[Authorize(Roles = "ADMIN")]
public async Task<IActionResult> Atualizar(Guid id, [FromBody] AtualizarCursoRequest cursoRequest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
public class AppServicesSettings
{
public string IdentidadeUrl { get; set; } = string.Empty;

public string GestaoConteudoUrl { get; set; } = string.Empty;

public string GestaoAlunosUrl { get; set; } = string.Empty;

public string GestaoFinanceiraUrl { get; set; } = string.Empty;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,19 @@ public HttpClientAuthorizationDelegatingHandler(IAspNetUser aspNetUser)

protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
var authorizationHeader = _aspNetUser.ObterHttpContext().Request.Headers["Authorization"];
var authorizationHeader = _aspNetUser.ObterHttpContext().Request.Headers.Authorization;

if (!string.IsNullOrEmpty(authorizationHeader))
{
request.Headers.Add("Authorization", new List<string>() { authorizationHeader! });
request.Headers.Add("Authorization", new List<string>() { authorizationHeader });
}

//var token = _aspNetUser.ObterUserToken();
// var token = _aspNetUser.ObterUserToken();

//if (!string.IsNullOrEmpty(authorizationHeader))
//{
// if (!string.IsNullOrEmpty(authorizationHeader))
// {
// request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MTE0OGJlNy05ZDA5LTQwOWUtYTFiNi0xZDI1ODI4YzM2NjkiLCJlbWFpbCI6ImFkbWluQHRlc3RlLmNvbSIsImp0aSI6IjQ5OGUxMWVjLTM0ZjktNDlkOS1iYzY0LWU3NTk3OGIyMGQ3NCIsIm5iZiI6MTc3MDM5MjI4MywiaWF0IjoxNzcwMzkyMjgzLCJyb2xlIjoiQURNSU4iLCJleHAiOjE3NzAzOTk0ODMsImlzcyI6IlBsYXRhZm9ybWFFZHVjYWNhbyIsImF1ZCI6Imh0dHBzOi8vbG9jYWxob3N0In0.N8St5rJDb-iUgsJbc5WhESypBwXMhbAFZ6IUNbsCmRM");
//}

// }
return await base.SendAsync(request, cancellationToken);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ public class RealizarAulaDTO
[Required(ErrorMessage = "O id da aula é obrigatório.")]
public Guid AulaId { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ namespace PlataformaEducacao.Bff.Api.Models.GestaoConteudo
public class CursoDetalhesDTO
{
public Guid Id { get; set; }

public string Nome { get; set; } = string.Empty;

public decimal Valor { get; set; }

public bool Disponivel { get; set; }

public IEnumerable<AulaResumoDTO> Aulas { get; set; } = Enumerable.Empty<AulaResumoDTO>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ namespace PlataformaEducacao.Bff.Api.Models.Health
public class HealthStatusDTO
{
public string Servico { get; set; } = string.Empty;

public string Url { get; set; } = string.Empty;

public bool Saudavel { get; set; }

public int Status { get; set; }

public string Mensagem { get; set; } = string.Empty;
}
}
Loading
Loading