diff --git a/src/Modules/Catalogs/API/Endpoints/CatalogsModuleEndpoints.cs b/src/Modules/Catalogs/API/Endpoints/CatalogsModuleEndpoints.cs
deleted file mode 100644
index c4926f451..000000000
--- a/src/Modules/Catalogs/API/Endpoints/CatalogsModuleEndpoints.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.API.Endpoints.Service;
-using MeAjudaAi.Modules.Catalogs.API.Endpoints.ServiceCategory;
-using MeAjudaAi.Shared.Endpoints;
-using Microsoft.AspNetCore.Builder;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints;
-
-///
-/// Classe responsável pelo mapeamento de todos os endpoints do módulo Catalogs.
-///
-public static class CatalogsModuleEndpoints
-{
- ///
- /// Mapeia todos os endpoints do módulo Catalogs.
- ///
- /// Aplicação web para configuração das rotas
- public static void MapCatalogsEndpoints(this WebApplication app)
- {
- // Service Categories endpoints
- var categoriesEndpoints = BaseEndpoint.CreateVersionedGroup(app, "catalogs/categories", "ServiceCategories");
-
- categoriesEndpoints.MapEndpoint()
- .MapEndpoint()
- .MapEndpoint()
- .MapEndpoint()
- .MapEndpoint()
- .MapEndpoint()
- .MapEndpoint();
-
- // Services endpoints
- var servicesEndpoints = BaseEndpoint.CreateVersionedGroup(app, "catalogs/services", "Services");
-
- servicesEndpoints.MapEndpoint()
- .MapEndpoint()
- .MapEndpoint()
- .MapEndpoint()
- .MapEndpoint()
- .MapEndpoint()
- .MapEndpoint()
- .MapEndpoint()
- .MapEndpoint()
- .MapEndpoint();
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/Service/ActivateServiceEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/Service/ActivateServiceEndpoint.cs
deleted file mode 100644
index 51e09c9a1..000000000
--- a/src/Modules/Catalogs/API/Endpoints/Service/ActivateServiceEndpoint.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-using MeAjudaAi.Shared.Authorization;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.Service;
-
-public class ActivateServiceEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapPost("/{id:guid}/activate", ActivateAsync)
- .WithName("ActivateService")
- .WithSummary("Ativar serviço")
- .Produces(StatusCodes.Status204NoContent)
- .RequireAdmin();
-
- private static async Task ActivateAsync(
- Guid id,
- ICommandDispatcher commandDispatcher,
- CancellationToken cancellationToken)
- {
- var command = new ActivateServiceCommand(id);
- var result = await commandDispatcher.SendAsync(command, cancellationToken);
- return HandleNoContent(result);
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/Service/ChangeServiceCategoryEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/Service/ChangeServiceCategoryEndpoint.cs
deleted file mode 100644
index c71e420eb..000000000
--- a/src/Modules/Catalogs/API/Endpoints/Service/ChangeServiceCategoryEndpoint.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-using MeAjudaAi.Modules.Catalogs.Application.DTOs.Requests.Service;
-using MeAjudaAi.Shared.Authorization;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.Service;
-
-public class ChangeServiceCategoryEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapPost("/{id:guid}/change-category", ChangeAsync)
- .WithName("ChangeServiceCategory")
- .WithSummary("Alterar categoria do serviço")
- .Produces(StatusCodes.Status204NoContent)
- .RequireAdmin();
-
- private static async Task ChangeAsync(
- Guid id,
- [FromBody] ChangeServiceCategoryRequest request,
- ICommandDispatcher commandDispatcher,
- CancellationToken cancellationToken)
- {
- var command = new ChangeServiceCategoryCommand(id, request.NewCategoryId);
- var result = await commandDispatcher.SendAsync(command, cancellationToken);
- return HandleNoContent(result);
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/Service/CreateServiceEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/Service/CreateServiceEndpoint.cs
deleted file mode 100644
index 47d31d65b..000000000
--- a/src/Modules/Catalogs/API/Endpoints/Service/CreateServiceEndpoint.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Modules.Catalogs.Application.DTOs.Requests.Service;
-using MeAjudaAi.Shared.Authorization;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Contracts;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.Service;
-
-public class CreateServiceEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapPost("/", CreateAsync)
- .WithName("CreateService")
- .WithSummary("Criar serviço")
- .Produces>(StatusCodes.Status201Created)
- .RequireAdmin();
-
- private static async Task CreateAsync(
- [FromBody] CreateServiceRequest request,
- ICommandDispatcher commandDispatcher,
- CancellationToken cancellationToken)
- {
- var command = new CreateServiceCommand(request.CategoryId, request.Name, request.Description, request.DisplayOrder);
- var result = await commandDispatcher.SendAsync>(command, cancellationToken);
-
- if (!result.IsSuccess)
- return Handle(result);
-
- return Handle(result, "GetServiceById", new { id = result.Value!.Id });
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/Service/DeactivateServiceEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/Service/DeactivateServiceEndpoint.cs
deleted file mode 100644
index e2856f744..000000000
--- a/src/Modules/Catalogs/API/Endpoints/Service/DeactivateServiceEndpoint.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-using MeAjudaAi.Shared.Authorization;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.Service;
-
-public class DeactivateServiceEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapPost("/{id:guid}/deactivate", DeactivateAsync)
- .WithName("DeactivateService")
- .WithSummary("Desativar serviço")
- .Produces(StatusCodes.Status204NoContent)
- .RequireAdmin();
-
- private static async Task DeactivateAsync(
- Guid id,
- ICommandDispatcher commandDispatcher,
- CancellationToken cancellationToken)
- {
- var command = new DeactivateServiceCommand(id);
- var result = await commandDispatcher.SendAsync(command, cancellationToken);
- return HandleNoContent(result);
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/Service/DeleteServiceEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/Service/DeleteServiceEndpoint.cs
deleted file mode 100644
index a8616ccaf..000000000
--- a/src/Modules/Catalogs/API/Endpoints/Service/DeleteServiceEndpoint.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-using MeAjudaAi.Shared.Authorization;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.Service;
-
-public class DeleteServiceEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapDelete("/{id:guid}", DeleteAsync)
- .WithName("DeleteService")
- .WithSummary("Deletar serviço")
- .Produces(StatusCodes.Status204NoContent)
- .RequireAdmin();
-
- private static async Task DeleteAsync(
- Guid id,
- ICommandDispatcher commandDispatcher,
- CancellationToken cancellationToken)
- {
- var command = new DeleteServiceCommand(id);
- var result = await commandDispatcher.SendAsync(command, cancellationToken);
- return HandleNoContent(result);
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/Service/GetAllServicesEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/Service/GetAllServicesEndpoint.cs
deleted file mode 100644
index 530354cf2..000000000
--- a/src/Modules/Catalogs/API/Endpoints/Service/GetAllServicesEndpoint.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Modules.Catalogs.Application.Queries.Service;
-using MeAjudaAi.Shared.Contracts;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.Service;
-
-public class GetAllServicesEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapGet("/", GetAllAsync)
- .WithName("GetAllServices")
- .WithSummary("Listar todos os serviços")
- .Produces>>(StatusCodes.Status200OK);
-
- private static async Task GetAllAsync(
- [AsParameters] GetAllServicesQuery query,
- IQueryDispatcher queryDispatcher,
- CancellationToken cancellationToken)
- {
- var result = await queryDispatcher.QueryAsync>>(
- query, cancellationToken);
- return Handle(result);
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/Service/GetServiceByIdEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/Service/GetServiceByIdEndpoint.cs
deleted file mode 100644
index a661b4e2c..000000000
--- a/src/Modules/Catalogs/API/Endpoints/Service/GetServiceByIdEndpoint.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Modules.Catalogs.Application.Queries.Service;
-using MeAjudaAi.Shared.Contracts;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.Service;
-
-public class GetServiceByIdEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapGet("/{id:guid}", GetByIdAsync)
- .WithName("GetServiceById")
- .WithSummary("Buscar serviço por ID")
- .Produces>(StatusCodes.Status200OK)
- .Produces(StatusCodes.Status404NotFound);
-
- private static async Task GetByIdAsync(
- Guid id,
- IQueryDispatcher queryDispatcher,
- CancellationToken cancellationToken)
- {
- var query = new GetServiceByIdQuery(id);
- var result = await queryDispatcher.QueryAsync>(query, cancellationToken);
-
- if (result.IsSuccess && result.Value is null)
- {
- return Results.NotFound();
- }
-
- return Handle(result);
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/Service/GetServicesByCategoryEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/Service/GetServicesByCategoryEndpoint.cs
deleted file mode 100644
index eded83ca1..000000000
--- a/src/Modules/Catalogs/API/Endpoints/Service/GetServicesByCategoryEndpoint.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Modules.Catalogs.Application.Queries.Service;
-using MeAjudaAi.Shared.Contracts;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.Service;
-
-public class GetServicesByCategoryEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapGet("/category/{categoryId:guid}", GetByCategoryAsync)
- .WithName("GetServicesByCategory")
- .WithSummary("Listar serviços por categoria")
- .Produces>>(StatusCodes.Status200OK);
-
- private static async Task GetByCategoryAsync(
- Guid categoryId,
- [AsParameters] GetServicesByCategoryQuery query,
- IQueryDispatcher queryDispatcher,
- CancellationToken cancellationToken)
- {
- var queryWithCategory = query with { CategoryId = categoryId };
- var result = await queryDispatcher.QueryAsync>>(queryWithCategory, cancellationToken);
- return Handle(result);
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/Service/UpdateServiceEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/Service/UpdateServiceEndpoint.cs
deleted file mode 100644
index 007299d6b..000000000
--- a/src/Modules/Catalogs/API/Endpoints/Service/UpdateServiceEndpoint.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-using MeAjudaAi.Modules.Catalogs.Application.DTOs.Requests.Service;
-using MeAjudaAi.Shared.Authorization;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.Service;
-
-public class UpdateServiceEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapPut("/{id:guid}", UpdateAsync)
- .WithName("UpdateService")
- .WithSummary("Atualizar serviço")
- .Produces(StatusCodes.Status204NoContent)
- .RequireAdmin();
-
- private static async Task UpdateAsync(
- Guid id,
- [FromBody] UpdateServiceRequest request,
- ICommandDispatcher commandDispatcher,
- CancellationToken cancellationToken)
- {
- var command = new UpdateServiceCommand(id, request.Name, request.Description, request.DisplayOrder);
- var result = await commandDispatcher.SendAsync(command, cancellationToken);
- return HandleNoContent(result);
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/Service/ValidateServicesEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/Service/ValidateServicesEndpoint.cs
deleted file mode 100644
index 64b3203b6..000000000
--- a/src/Modules/Catalogs/API/Endpoints/Service/ValidateServicesEndpoint.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs.Requests.Service;
-using MeAjudaAi.Shared.Authorization;
-using MeAjudaAi.Shared.Contracts;
-using MeAjudaAi.Shared.Contracts.Modules.Catalogs;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.Service;
-
-public class ValidateServicesEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapPost("/validate", ValidateAsync)
- .WithName("ValidateServices")
- .WithSummary("Validar múltiplos serviços")
- .Produces>(StatusCodes.Status200OK)
- .RequireAdmin();
-
- private static async Task ValidateAsync(
- [FromBody] ValidateServicesRequest request,
- [FromServices] ICatalogsModuleApi moduleApi,
- CancellationToken cancellationToken)
- {
- var result = await moduleApi.ValidateServicesAsync(request.ServiceIds, cancellationToken);
-
- if (!result.IsSuccess)
- return Handle(result);
-
- // Mapear do DTO do módulo para o DTO da API
- var response = new ValidateServicesResponse(
- result.Value!.AllValid,
- result.Value.InvalidServiceIds,
- result.Value.InactiveServiceIds
- );
-
- return Handle(Result.Success(response));
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/ServiceCategory/ActivateServiceCategoryEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/ServiceCategory/ActivateServiceCategoryEndpoint.cs
deleted file mode 100644
index 77704ba66..000000000
--- a/src/Modules/Catalogs/API/Endpoints/ServiceCategory/ActivateServiceCategoryEndpoint.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.ServiceCategory;
-using MeAjudaAi.Shared.Authorization;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.ServiceCategory;
-
-public class ActivateServiceCategoryEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapPost("/{id:guid}/activate", ActivateAsync)
- .WithName("ActivateServiceCategory")
- .WithSummary("Ativar categoria de serviço")
- .Produces(StatusCodes.Status204NoContent)
- .RequireAdmin();
-
- private static async Task ActivateAsync(
- Guid id,
- ICommandDispatcher commandDispatcher,
- CancellationToken cancellationToken)
- {
- var command = new ActivateServiceCategoryCommand(id);
- var result = await commandDispatcher.SendAsync(command, cancellationToken);
- return HandleNoContent(result);
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/ServiceCategory/CreateServiceCategoryEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/ServiceCategory/CreateServiceCategoryEndpoint.cs
deleted file mode 100644
index 3750097ae..000000000
--- a/src/Modules/Catalogs/API/Endpoints/ServiceCategory/CreateServiceCategoryEndpoint.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.ServiceCategory;
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Shared.Authorization;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Contracts;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.ServiceCategory;
-
-public record CreateServiceCategoryRequest(string Name, string? Description, int DisplayOrder);
-
-public class CreateServiceCategoryEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapPost("/", CreateAsync)
- .WithName("CreateServiceCategory")
- .WithSummary("Criar categoria de serviço")
- .Produces>(StatusCodes.Status201Created)
- .RequireAdmin();
-
- private static async Task CreateAsync(
- [FromBody] CreateServiceCategoryRequest request,
- ICommandDispatcher commandDispatcher,
- CancellationToken cancellationToken)
- {
- var command = new CreateServiceCategoryCommand(request.Name, request.Description, request.DisplayOrder);
- var result = await commandDispatcher.SendAsync>(
- command, cancellationToken);
-
- if (!result.IsSuccess)
- return Handle(result);
-
- return Handle(result, "GetServiceCategoryById", new { id = result.Value!.Id });
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/ServiceCategory/DeactivateServiceCategoryEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/ServiceCategory/DeactivateServiceCategoryEndpoint.cs
deleted file mode 100644
index 5175711e4..000000000
--- a/src/Modules/Catalogs/API/Endpoints/ServiceCategory/DeactivateServiceCategoryEndpoint.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.ServiceCategory;
-using MeAjudaAi.Shared.Authorization;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.ServiceCategory;
-
-public class DeactivateServiceCategoryEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapPost("/{id:guid}/deactivate", DeactivateAsync)
- .WithName("DeactivateServiceCategory")
- .WithSummary("Desativar categoria de serviço")
- .Produces(StatusCodes.Status204NoContent)
- .RequireAdmin();
-
- private static async Task DeactivateAsync(
- Guid id,
- ICommandDispatcher commandDispatcher,
- CancellationToken cancellationToken)
- {
- var command = new DeactivateServiceCategoryCommand(id);
- var result = await commandDispatcher.SendAsync(command, cancellationToken);
- return HandleNoContent(result);
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/ServiceCategory/DeleteServiceCategoryEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/ServiceCategory/DeleteServiceCategoryEndpoint.cs
deleted file mode 100644
index cef204cd7..000000000
--- a/src/Modules/Catalogs/API/Endpoints/ServiceCategory/DeleteServiceCategoryEndpoint.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.ServiceCategory;
-using MeAjudaAi.Shared.Authorization;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.ServiceCategory;
-
-public class DeleteServiceCategoryEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapDelete("/{id:guid}", DeleteAsync)
- .WithName("DeleteServiceCategory")
- .WithSummary("Deletar categoria de serviço")
- .Produces(StatusCodes.Status204NoContent)
- .RequireAdmin();
-
- private static async Task DeleteAsync(
- Guid id,
- ICommandDispatcher commandDispatcher,
- CancellationToken cancellationToken)
- {
- var command = new DeleteServiceCategoryCommand(id);
- var result = await commandDispatcher.SendAsync(command, cancellationToken);
- return HandleNoContent(result);
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/ServiceCategory/GetAllServiceCategoriesEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/ServiceCategory/GetAllServiceCategoriesEndpoint.cs
deleted file mode 100644
index e3b8427e3..000000000
--- a/src/Modules/Catalogs/API/Endpoints/ServiceCategory/GetAllServiceCategoriesEndpoint.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Modules.Catalogs.Application.Queries.ServiceCategory;
-using MeAjudaAi.Shared.Contracts;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.ServiceCategory;
-
-public record GetAllCategoriesQuery(bool ActiveOnly = false);
-
-public class GetAllServiceCategoriesEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapGet("/", GetAllAsync)
- .WithName("GetAllServiceCategories")
- .WithSummary("Listar todas as categorias")
- .Produces>>(StatusCodes.Status200OK);
-
- private static async Task GetAllAsync(
- [AsParameters] GetAllCategoriesQuery query,
- IQueryDispatcher queryDispatcher,
- CancellationToken cancellationToken)
- {
- var qry = new GetAllServiceCategoriesQuery(query.ActiveOnly);
- var result = await queryDispatcher.QueryAsync>>(
- qry, cancellationToken);
-
- return Handle(result);
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/ServiceCategory/GetServiceCategoryByIdEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/ServiceCategory/GetServiceCategoryByIdEndpoint.cs
deleted file mode 100644
index 28ce306d4..000000000
--- a/src/Modules/Catalogs/API/Endpoints/ServiceCategory/GetServiceCategoryByIdEndpoint.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Modules.Catalogs.Application.Queries.ServiceCategory;
-using MeAjudaAi.Shared.Contracts;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.ServiceCategory;
-
-public class GetServiceCategoryByIdEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapGet("/{id:guid}", GetByIdAsync)
- .WithName("GetServiceCategoryById")
- .WithSummary("Buscar categoria por ID")
- .Produces>(StatusCodes.Status200OK)
- .Produces(StatusCodes.Status404NotFound);
-
- private static async Task GetByIdAsync(
- Guid id,
- IQueryDispatcher queryDispatcher,
- CancellationToken cancellationToken)
- {
- var query = new GetServiceCategoryByIdQuery(id);
- var result = await queryDispatcher.QueryAsync>(
- query, cancellationToken);
-
- if (result.IsSuccess && result.Value == null)
- return Results.NotFound();
-
- return Handle(result);
- }
-}
diff --git a/src/Modules/Catalogs/API/Endpoints/ServiceCategory/UpdateServiceCategoryEndpoint.cs b/src/Modules/Catalogs/API/Endpoints/ServiceCategory/UpdateServiceCategoryEndpoint.cs
deleted file mode 100644
index 6dfa06221..000000000
--- a/src/Modules/Catalogs/API/Endpoints/ServiceCategory/UpdateServiceCategoryEndpoint.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.ServiceCategory;
-using MeAjudaAi.Shared.Authorization;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Endpoints;
-using MeAjudaAi.Shared.Functional;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Routing;
-
-namespace MeAjudaAi.Modules.Catalogs.API.Endpoints.ServiceCategory;
-
-public record UpdateServiceCategoryRequest(string Name, string? Description, int DisplayOrder);
-
-public class UpdateServiceCategoryEndpoint : BaseEndpoint, IEndpoint
-{
- public static void Map(IEndpointRouteBuilder app)
- => app.MapPut("/{id:guid}", UpdateAsync)
- .WithName("UpdateServiceCategory")
- .WithSummary("Atualizar categoria de serviço")
- .Produces(StatusCodes.Status204NoContent)
- .RequireAdmin();
-
- private static async Task UpdateAsync(
- Guid id,
- [FromBody] UpdateServiceCategoryRequest request,
- ICommandDispatcher commandDispatcher,
- CancellationToken cancellationToken)
- {
- var command = new UpdateServiceCategoryCommand(id, request.Name, request.Description, request.DisplayOrder);
- var result = await commandDispatcher.SendAsync(command, cancellationToken);
- return HandleNoContent(result);
- }
-}
diff --git a/src/Modules/Catalogs/API/Extensions.cs b/src/Modules/Catalogs/API/Extensions.cs
deleted file mode 100644
index 3f5fc0411..000000000
--- a/src/Modules/Catalogs/API/Extensions.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.API.Endpoints;
-using MeAjudaAi.Modules.Catalogs.Application;
-using MeAjudaAi.Modules.Catalogs.Infrastructure;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
-using Microsoft.Extensions.Logging;
-
-namespace MeAjudaAi.Modules.Catalogs.API;
-
-public static class Extensions
-{
- ///
- /// Adiciona os serviços do módulo Catalogs.
- ///
- public static IServiceCollection AddCatalogsModule(
- this IServiceCollection services,
- IConfiguration configuration)
- {
- services.AddApplication();
- services.AddCatalogsInfrastructure(configuration);
-
- return services;
- }
-
- ///
- /// Configura os endpoints do módulo Catalogs.
- ///
- public static WebApplication UseCatalogsModule(this WebApplication app)
- {
- // Garantir que as migrações estão aplicadas
- EnsureDatabaseMigrations(app);
-
- app.MapCatalogsEndpoints();
-
- return app;
- }
-
- private static void EnsureDatabaseMigrations(WebApplication app)
- {
- if (app?.Services == null) return;
-
- try
- {
- using var scope = app.Services.CreateScope();
- var context = scope.ServiceProvider.GetService();
- if (context == null) return;
-
- // Em ambiente de teste, pular migrações automáticas
- if (app.Environment.IsEnvironment("Test") || app.Environment.IsEnvironment("Testing"))
- {
- return;
- }
-
- context.Database.Migrate();
- }
- catch (Exception ex)
- {
- using var scope = app.Services.CreateScope();
- var logger = scope.ServiceProvider.GetService>();
-
- // Only fallback to EnsureCreated in Development
- if (app.Environment.IsDevelopment())
- {
- logger?.LogWarning(ex, "Falha ao aplicar migrações do módulo Catalogs. Usando EnsureCreated como fallback em Development.");
- try
- {
- var context = scope.ServiceProvider.GetService();
- context?.Database.EnsureCreated();
- }
- catch (Exception fallbackEx)
- {
- logger?.LogError(fallbackEx, "Falha crítica ao inicializar o banco do módulo Catalogs.");
- throw; // Fail fast even in Development if EnsureCreated fails
- }
- }
- else
- {
- // Fail fast in non-development environments
- logger?.LogError(ex, "Falha crítica ao aplicar migrações do módulo Catalogs em ambiente de produção.");
- throw;
- }
- }
- }
-}
diff --git a/src/Modules/Catalogs/API/MeAjudaAi.Modules.Catalogs.API.csproj b/src/Modules/Catalogs/API/MeAjudaAi.Modules.Catalogs.API.csproj
deleted file mode 100644
index 088a8c64e..000000000
--- a/src/Modules/Catalogs/API/MeAjudaAi.Modules.Catalogs.API.csproj
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
- net10.0
- enable
- enable
- true
-
- NU1701;NU1507
- true
- true
- latest
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Modules/Catalogs/Application/Commands/Service/ActivateServiceCommand.cs b/src/Modules/Catalogs/Application/Commands/Service/ActivateServiceCommand.cs
deleted file mode 100644
index 658df556c..000000000
--- a/src/Modules/Catalogs/Application/Commands/Service/ActivateServiceCommand.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-
-///
-/// Command to activate a service, making it available for use.
-///
-public sealed record ActivateServiceCommand(Guid Id) : Command;
diff --git a/src/Modules/Catalogs/Application/Commands/Service/ChangeServiceCategoryCommand.cs b/src/Modules/Catalogs/Application/Commands/Service/ChangeServiceCategoryCommand.cs
deleted file mode 100644
index de1e93b89..000000000
--- a/src/Modules/Catalogs/Application/Commands/Service/ChangeServiceCategoryCommand.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-
-///
-/// Command to move a service to a different category.
-///
-public sealed record ChangeServiceCategoryCommand(
- Guid ServiceId,
- Guid NewCategoryId
-) : Command;
diff --git a/src/Modules/Catalogs/Application/Commands/Service/CreateServiceCommand.cs b/src/Modules/Catalogs/Application/Commands/Service/CreateServiceCommand.cs
deleted file mode 100644
index 14386b1e5..000000000
--- a/src/Modules/Catalogs/Application/Commands/Service/CreateServiceCommand.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-
-///
-/// Command to create a new service in a specific category.
-///
-public sealed record CreateServiceCommand(
- Guid CategoryId,
- string Name,
- string? Description,
- int DisplayOrder = 0
-) : Command>;
diff --git a/src/Modules/Catalogs/Application/Commands/Service/DeactivateServiceCommand.cs b/src/Modules/Catalogs/Application/Commands/Service/DeactivateServiceCommand.cs
deleted file mode 100644
index 1e2466a7f..000000000
--- a/src/Modules/Catalogs/Application/Commands/Service/DeactivateServiceCommand.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-
-///
-/// Command to deactivate a service, removing it from active use.
-///
-public sealed record DeactivateServiceCommand(Guid Id) : Command;
diff --git a/src/Modules/Catalogs/Application/Commands/Service/DeleteServiceCommand.cs b/src/Modules/Catalogs/Application/Commands/Service/DeleteServiceCommand.cs
deleted file mode 100644
index 5f372b364..000000000
--- a/src/Modules/Catalogs/Application/Commands/Service/DeleteServiceCommand.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-
-///
-/// Command to delete a service from the catalog.
-/// Note: Currently does not check for provider references (see handler TODO).
-///
-public sealed record DeleteServiceCommand(Guid Id) : Command;
diff --git a/src/Modules/Catalogs/Application/Commands/Service/UpdateServiceCommand.cs b/src/Modules/Catalogs/Application/Commands/Service/UpdateServiceCommand.cs
deleted file mode 100644
index b3bf2eea7..000000000
--- a/src/Modules/Catalogs/Application/Commands/Service/UpdateServiceCommand.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System.ComponentModel.DataAnnotations;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-
-///
-/// Command to update an existing service's details.
-/// Validation limits must match ValidationConstants.CatalogLimits.
-/// Note: Guid.Empty validation is handled by the command handler to provide domain-specific error messages.
-///
-public sealed record UpdateServiceCommand(
- Guid Id,
- [Required]
- [MaxLength(150)]
- string Name,
- [MaxLength(1000)]
- string? Description,
- [Range(0, int.MaxValue)]
- int DisplayOrder
-) : Command;
diff --git a/src/Modules/Catalogs/Application/Commands/ServiceCategory/ActivateServiceCategoryCommand.cs b/src/Modules/Catalogs/Application/Commands/ServiceCategory/ActivateServiceCategoryCommand.cs
deleted file mode 100644
index ab00c99e1..000000000
--- a/src/Modules/Catalogs/Application/Commands/ServiceCategory/ActivateServiceCategoryCommand.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Commands.ServiceCategory;
-
-public sealed record ActivateServiceCategoryCommand(Guid Id) : Command;
diff --git a/src/Modules/Catalogs/Application/Commands/ServiceCategory/CreateServiceCategoryCommand.cs b/src/Modules/Catalogs/Application/Commands/ServiceCategory/CreateServiceCategoryCommand.cs
deleted file mode 100644
index b66b77f47..000000000
--- a/src/Modules/Catalogs/Application/Commands/ServiceCategory/CreateServiceCategoryCommand.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Commands.ServiceCategory;
-
-public sealed record CreateServiceCategoryCommand(
- string Name,
- string? Description,
- int DisplayOrder = 0
-) : Command>;
diff --git a/src/Modules/Catalogs/Application/Commands/ServiceCategory/DeactivateServiceCategoryCommand.cs b/src/Modules/Catalogs/Application/Commands/ServiceCategory/DeactivateServiceCategoryCommand.cs
deleted file mode 100644
index 58fd6d3f9..000000000
--- a/src/Modules/Catalogs/Application/Commands/ServiceCategory/DeactivateServiceCategoryCommand.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Commands.ServiceCategory;
-
-public sealed record DeactivateServiceCategoryCommand(Guid Id) : Command;
diff --git a/src/Modules/Catalogs/Application/Commands/ServiceCategory/DeleteServiceCategoryCommand.cs b/src/Modules/Catalogs/Application/Commands/ServiceCategory/DeleteServiceCategoryCommand.cs
deleted file mode 100644
index 916fc20fa..000000000
--- a/src/Modules/Catalogs/Application/Commands/ServiceCategory/DeleteServiceCategoryCommand.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Commands.ServiceCategory;
-
-public sealed record DeleteServiceCategoryCommand(Guid Id) : Command;
diff --git a/src/Modules/Catalogs/Application/Commands/ServiceCategory/UpdateServiceCategoryCommand.cs b/src/Modules/Catalogs/Application/Commands/ServiceCategory/UpdateServiceCategoryCommand.cs
deleted file mode 100644
index 71f7873e6..000000000
--- a/src/Modules/Catalogs/Application/Commands/ServiceCategory/UpdateServiceCategoryCommand.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Commands.ServiceCategory;
-
-public sealed record UpdateServiceCategoryCommand(
- Guid Id,
- string Name,
- string? Description,
- int DisplayOrder = 0
-) : Command;
diff --git a/src/Modules/Catalogs/Application/DTOs/Requests/Service/ChangeServiceCategoryRequest.cs b/src/Modules/Catalogs/Application/DTOs/Requests/Service/ChangeServiceCategoryRequest.cs
deleted file mode 100644
index d8cf2bb58..000000000
--- a/src/Modules/Catalogs/Application/DTOs/Requests/Service/ChangeServiceCategoryRequest.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using MeAjudaAi.Shared.Contracts;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.DTOs.Requests.Service;
-
-public sealed record ChangeServiceCategoryRequest : Request
-{
- public Guid NewCategoryId { get; init; }
-}
diff --git a/src/Modules/Catalogs/Application/DTOs/Requests/Service/CreateServiceRequest.cs b/src/Modules/Catalogs/Application/DTOs/Requests/Service/CreateServiceRequest.cs
deleted file mode 100644
index e4970c636..000000000
--- a/src/Modules/Catalogs/Application/DTOs/Requests/Service/CreateServiceRequest.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using MeAjudaAi.Shared.Contracts;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.DTOs.Requests.Service;
-
-public sealed record CreateServiceRequest : Request
-{
- public Guid CategoryId { get; init; }
- public string Name { get; init; } = string.Empty;
- public string? Description { get; init; }
- public int DisplayOrder { get; init; } = 0;
-}
diff --git a/src/Modules/Catalogs/Application/DTOs/Requests/Service/UpdateServiceRequest.cs b/src/Modules/Catalogs/Application/DTOs/Requests/Service/UpdateServiceRequest.cs
deleted file mode 100644
index 99f8f3c2b..000000000
--- a/src/Modules/Catalogs/Application/DTOs/Requests/Service/UpdateServiceRequest.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using MeAjudaAi.Shared.Contracts;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.DTOs.Requests.Service;
-
-public sealed record UpdateServiceRequest : Request
-{
- public string Name { get; init; } = string.Empty;
- public string? Description { get; init; }
- public int DisplayOrder { get; init; }
-}
diff --git a/src/Modules/Catalogs/Application/DTOs/Requests/Service/ValidateServicesRequest.cs b/src/Modules/Catalogs/Application/DTOs/Requests/Service/ValidateServicesRequest.cs
deleted file mode 100644
index 56e2db827..000000000
--- a/src/Modules/Catalogs/Application/DTOs/Requests/Service/ValidateServicesRequest.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using MeAjudaAi.Shared.Contracts;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.DTOs.Requests.Service;
-
-public sealed record ValidateServicesRequest : Request
-{
- public IReadOnlyCollection ServiceIds { get; init; } = Array.Empty();
-}
diff --git a/src/Modules/Catalogs/Application/DTOs/Requests/Service/ValidateServicesResponse.cs b/src/Modules/Catalogs/Application/DTOs/Requests/Service/ValidateServicesResponse.cs
deleted file mode 100644
index 48170e5fe..000000000
--- a/src/Modules/Catalogs/Application/DTOs/Requests/Service/ValidateServicesResponse.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace MeAjudaAi.Modules.Catalogs.Application.DTOs.Requests.Service;
-
-public sealed record ValidateServicesResponse(
- bool AllValid,
- IReadOnlyCollection InvalidServiceIds,
- IReadOnlyCollection InactiveServiceIds
-);
diff --git a/src/Modules/Catalogs/Application/DTOs/Requests/ServiceCategory/UpdateServiceCategoryRequest.cs b/src/Modules/Catalogs/Application/DTOs/Requests/ServiceCategory/UpdateServiceCategoryRequest.cs
deleted file mode 100644
index b5218c937..000000000
--- a/src/Modules/Catalogs/Application/DTOs/Requests/ServiceCategory/UpdateServiceCategoryRequest.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System.ComponentModel.DataAnnotations;
-using MeAjudaAi.Shared.Contracts;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.DTOs.Requests.ServiceCategory;
-
-public sealed record UpdateServiceCategoryRequest : Request
-{
- [Required]
- [MaxLength(100)]
- public string Name { get; init; } = string.Empty;
-
- [MaxLength(500)]
- public string? Description { get; init; }
-
- [Range(0, int.MaxValue)]
- public int DisplayOrder { get; init; }
-}
diff --git a/src/Modules/Catalogs/Application/DTOs/ServiceCategoryDto.cs b/src/Modules/Catalogs/Application/DTOs/ServiceCategoryDto.cs
deleted file mode 100644
index f3518507d..000000000
--- a/src/Modules/Catalogs/Application/DTOs/ServiceCategoryDto.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-namespace MeAjudaAi.Modules.Catalogs.Application.DTOs;
-
-///
-/// DTO para informações de categoria de serviço.
-///
-public sealed record ServiceCategoryDto(
- Guid Id,
- string Name,
- string? Description,
- bool IsActive,
- int DisplayOrder,
- DateTime CreatedAt,
- DateTime? UpdatedAt
-);
diff --git a/src/Modules/Catalogs/Application/DTOs/ServiceCategoryWithCountDto.cs b/src/Modules/Catalogs/Application/DTOs/ServiceCategoryWithCountDto.cs
deleted file mode 100644
index 15467e5e4..000000000
--- a/src/Modules/Catalogs/Application/DTOs/ServiceCategoryWithCountDto.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-namespace MeAjudaAi.Modules.Catalogs.Application.DTOs;
-
-///
-/// DTO para categoria com a contagem de seus serviços.
-///
-public sealed record ServiceCategoryWithCountDto(
- Guid Id,
- string Name,
- string? Description,
- bool IsActive,
- int DisplayOrder,
- int ActiveServicesCount,
- int TotalServicesCount
-);
diff --git a/src/Modules/Catalogs/Application/DTOs/ServiceDto.cs b/src/Modules/Catalogs/Application/DTOs/ServiceDto.cs
deleted file mode 100644
index 9e288e2c4..000000000
--- a/src/Modules/Catalogs/Application/DTOs/ServiceDto.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-namespace MeAjudaAi.Modules.Catalogs.Application.DTOs;
-
-///
-/// DTO para informações de serviço.
-///
-public sealed record ServiceDto(
- Guid Id,
- Guid CategoryId,
- string CategoryName,
- string Name,
- string? Description,
- bool IsActive,
- int DisplayOrder,
- DateTime CreatedAt,
- DateTime? UpdatedAt
-);
diff --git a/src/Modules/Catalogs/Application/DTOs/ServiceListDto.cs b/src/Modules/Catalogs/Application/DTOs/ServiceListDto.cs
deleted file mode 100644
index 527aa0fd5..000000000
--- a/src/Modules/Catalogs/Application/DTOs/ServiceListDto.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace MeAjudaAi.Modules.Catalogs.Application.DTOs;
-
-///
-/// DTO simplificado para serviço sem detalhes de categoria (para listas).
-///
-public sealed record ServiceListDto(
- Guid Id,
- Guid CategoryId,
- string Name,
- string? Description,
- bool IsActive
-);
diff --git a/src/Modules/Catalogs/Application/Extensions.cs b/src/Modules/Catalogs/Application/Extensions.cs
deleted file mode 100644
index 5bded0b4d..000000000
--- a/src/Modules/Catalogs/Application/Extensions.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.ModuleApi;
-using MeAjudaAi.Shared.Contracts.Modules.Catalogs;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace MeAjudaAi.Modules.Catalogs.Application;
-
-public static class Extensions
-{
- public static IServiceCollection AddApplication(this IServiceCollection services)
- {
- // Note: Handlers are automatically registered through reflection in Infrastructure layer
- // via AddApplicationHandlers() which scans the Application assembly
-
- // Module API - register both interface and concrete type for DI flexibility
- services.AddScoped();
- services.AddScoped();
-
- return services;
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Commands/Service/ActivateServiceCommandHandler.cs b/src/Modules/Catalogs/Application/Handlers/Commands/Service/ActivateServiceCommandHandler.cs
deleted file mode 100644
index 9717cbd9f..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Commands/Service/ActivateServiceCommandHandler.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Commands.Service;
-
-public sealed class ActivateServiceCommandHandler(
- IServiceRepository serviceRepository)
- : ICommandHandler
-{
- public async Task HandleAsync(ActivateServiceCommand request, CancellationToken cancellationToken = default)
- {
- if (request.Id == Guid.Empty)
- return Result.Failure("Service ID cannot be empty.");
-
- var serviceId = ServiceId.From(request.Id);
- var service = await serviceRepository.GetByIdAsync(serviceId, cancellationToken);
-
- if (service is null)
- return Result.Failure($"Service with ID '{request.Id}' not found.");
-
- service.Activate();
-
- await serviceRepository.UpdateAsync(service, cancellationToken);
-
- return Result.Success();
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Commands/Service/ChangeServiceCategoryCommandHandler.cs b/src/Modules/Catalogs/Application/Handlers/Commands/Service/ChangeServiceCategoryCommandHandler.cs
deleted file mode 100644
index ef82e424e..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Commands/Service/ChangeServiceCategoryCommandHandler.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-using MeAjudaAi.Modules.Catalogs.Domain.Exceptions;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Commands.Service;
-
-public sealed class ChangeServiceCategoryCommandHandler(
- IServiceRepository serviceRepository,
- IServiceCategoryRepository categoryRepository)
- : ICommandHandler
-{
- public async Task HandleAsync(ChangeServiceCategoryCommand request, CancellationToken cancellationToken = default)
- {
- try
- {
- if (request.ServiceId == Guid.Empty)
- return Result.Failure("Service ID cannot be empty.");
-
- if (request.NewCategoryId == Guid.Empty)
- return Result.Failure("New category ID cannot be empty.");
-
- var serviceId = ServiceId.From(request.ServiceId);
- var service = await serviceRepository.GetByIdAsync(serviceId, cancellationToken);
-
- if (service is null)
- return Result.Failure($"Service with ID '{request.ServiceId}' not found.");
-
- var newCategoryId = ServiceCategoryId.From(request.NewCategoryId);
- var newCategory = await categoryRepository.GetByIdAsync(newCategoryId, cancellationToken);
-
- if (newCategory is null)
- return Result.Failure($"Category with ID '{request.NewCategoryId}' not found.");
-
- if (!newCategory.IsActive)
- return Result.Failure("Cannot move service to inactive category.");
-
- // Garantir que o nome ainda é único na categoria de destino
- if (await serviceRepository.ExistsWithNameAsync(
- service.Name,
- service.Id,
- newCategoryId,
- cancellationToken))
- {
- return Result.Failure(
- $"A service with name '{service.Name}' already exists in the target category.");
- }
-
- service.ChangeCategory(newCategoryId);
-
- await serviceRepository.UpdateAsync(service, cancellationToken);
-
- return Result.Success();
- }
- catch (CatalogDomainException ex)
- {
- return Result.Failure(ex.Message);
- }
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Commands/Service/CreateServiceCommandHandler.cs b/src/Modules/Catalogs/Application/Handlers/Commands/Service/CreateServiceCommandHandler.cs
deleted file mode 100644
index f36da5d73..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Commands/Service/CreateServiceCommandHandler.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Modules.Catalogs.Domain.Entities;
-using MeAjudaAi.Modules.Catalogs.Domain.Exceptions;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Commands.Service;
-
-public sealed class CreateServiceCommandHandler(
- IServiceRepository serviceRepository,
- IServiceCategoryRepository categoryRepository)
- : ICommandHandler>
-{
- public async Task> HandleAsync(CreateServiceCommand request, CancellationToken cancellationToken = default)
- {
- try
- {
- if (request.CategoryId == Guid.Empty)
- return Result.Failure("Category ID cannot be empty.");
-
- var categoryId = ServiceCategoryId.From(request.CategoryId);
-
- // Verificar se a categoria existe e está ativa
- var category = await categoryRepository.GetByIdAsync(categoryId, cancellationToken);
- if (category is null)
- return Result.Failure($"Category with ID '{request.CategoryId}' not found.");
-
- if (!category.IsActive)
- return Result.Failure("Cannot create service in inactive category.");
-
- var normalizedName = request.Name?.Trim();
-
- if (string.IsNullOrWhiteSpace(normalizedName))
- return Result.Failure("Service name is required.");
-
- // Verificar se já existe serviço com o mesmo nome na categoria
- if (await serviceRepository.ExistsWithNameAsync(normalizedName, null, categoryId, cancellationToken))
- return Result.Failure($"A service with name '{normalizedName}' already exists in this category.");
-
- var service = Domain.Entities.Service.Create(categoryId, normalizedName, request.Description, request.DisplayOrder);
-
- await serviceRepository.AddAsync(service, cancellationToken);
-
- var dto = new ServiceDto(
- service.Id.Value,
- service.CategoryId.Value,
- category.Name,
- service.Name,
- service.Description,
- service.IsActive,
- service.DisplayOrder,
- service.CreatedAt,
- service.UpdatedAt
- );
- return Result.Success(dto);
- }
- catch (CatalogDomainException ex)
- {
- return Result.Failure(ex.Message);
- }
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Commands/Service/DeactivateServiceCommandHandler.cs b/src/Modules/Catalogs/Application/Handlers/Commands/Service/DeactivateServiceCommandHandler.cs
deleted file mode 100644
index de78ac31e..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Commands/Service/DeactivateServiceCommandHandler.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Commands.Service;
-
-public sealed class DeactivateServiceCommandHandler(
- IServiceRepository serviceRepository)
- : ICommandHandler
-{
- public async Task HandleAsync(DeactivateServiceCommand request, CancellationToken cancellationToken = default)
- {
- if (request.Id == Guid.Empty)
- return Result.Failure("Service ID cannot be empty.");
-
- var serviceId = ServiceId.From(request.Id);
- var service = await serviceRepository.GetByIdAsync(serviceId, cancellationToken);
-
- if (service is null)
- return Result.Failure($"Service with ID '{request.Id}' not found.");
-
- service.Deactivate();
-
- await serviceRepository.UpdateAsync(service, cancellationToken);
-
- return Result.Success();
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Commands/Service/DeleteServiceCommandHandler.cs b/src/Modules/Catalogs/Application/Handlers/Commands/Service/DeleteServiceCommandHandler.cs
deleted file mode 100644
index 3a0dfcecd..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Commands/Service/DeleteServiceCommandHandler.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Commands.Service;
-
-public sealed class DeleteServiceCommandHandler(
- IServiceRepository serviceRepository)
- : ICommandHandler
-{
- public async Task HandleAsync(DeleteServiceCommand request, CancellationToken cancellationToken = default)
- {
- if (request.Id == Guid.Empty)
- return Result.Failure("Service ID cannot be empty.");
-
- var serviceId = ServiceId.From(request.Id);
- var service = await serviceRepository.GetByIdAsync(serviceId, cancellationToken);
-
- if (service is null)
- return Result.Failure($"Service with ID '{request.Id}' not found.");
-
- // TODO: Verificar se algum provedor oferece este serviço antes de deletar
- // Isso requer integração com o módulo Providers via IProvidersModuleApi
- // Considerar implementar:
- // 1. Chamar IProvidersModuleApi.HasProvidersOfferingServiceAsync(serviceId)
- // 2. Retornar falha se existirem provedores: "Cannot delete service: X providers offer this service"
- // 3. Ou implementar padrão de soft-delete para preservar dados históricos
-
- await serviceRepository.DeleteAsync(serviceId, cancellationToken);
-
- return Result.Success();
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Commands/Service/UpdateServiceCommandHandler.cs b/src/Modules/Catalogs/Application/Handlers/Commands/Service/UpdateServiceCommandHandler.cs
deleted file mode 100644
index ddf858f53..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Commands/Service/UpdateServiceCommandHandler.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
-using MeAjudaAi.Modules.Catalogs.Domain.Exceptions;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Commands.Service;
-
-public sealed class UpdateServiceCommandHandler(
- IServiceRepository serviceRepository)
- : ICommandHandler
-{
- public async Task HandleAsync(UpdateServiceCommand request, CancellationToken cancellationToken = default)
- {
- try
- {
- if (request.Id == Guid.Empty)
- return Result.Failure("Service ID cannot be empty.");
-
- var serviceId = ServiceId.From(request.Id);
- var service = await serviceRepository.GetByIdAsync(serviceId, cancellationToken);
-
- if (service is null)
- return Result.Failure($"Service with ID '{request.Id}' not found.");
-
- var normalizedName = request.Name?.Trim();
-
- if (string.IsNullOrWhiteSpace(normalizedName))
- return Result.Failure("Service name cannot be empty.");
-
- // Verificar se já existe serviço com o mesmo nome na categoria (excluindo o serviço atual)
- if (await serviceRepository.ExistsWithNameAsync(normalizedName, serviceId, service.CategoryId, cancellationToken))
- return Result.Failure($"A service with name '{normalizedName}' already exists in this category.");
-
- service.Update(normalizedName, request.Description, request.DisplayOrder);
-
- await serviceRepository.UpdateAsync(service, cancellationToken);
-
- return Result.Success();
- }
- catch (CatalogDomainException ex)
- {
- return Result.Failure(ex.Message);
- }
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Commands/ServiceCategory/ActivateServiceCategoryCommandHandler.cs b/src/Modules/Catalogs/Application/Handlers/Commands/ServiceCategory/ActivateServiceCategoryCommandHandler.cs
deleted file mode 100644
index 3f4080bc2..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Commands/ServiceCategory/ActivateServiceCategoryCommandHandler.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.ServiceCategory;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Commands.ServiceCategory;
-
-public sealed class ActivateServiceCategoryCommandHandler(
- IServiceCategoryRepository categoryRepository)
- : ICommandHandler
-{
- public async Task HandleAsync(ActivateServiceCategoryCommand request, CancellationToken cancellationToken = default)
- {
- if (request.Id == Guid.Empty)
- return Result.Failure("Category ID cannot be empty.");
-
- var categoryId = ServiceCategoryId.From(request.Id);
- var category = await categoryRepository.GetByIdAsync(categoryId, cancellationToken);
-
- if (category is null)
- return Result.Failure($"Category with ID '{request.Id}' not found.");
-
- category.Activate();
-
- await categoryRepository.UpdateAsync(category, cancellationToken);
-
- return Result.Success();
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Commands/ServiceCategory/CreateServiceCategoryCommandHandler.cs b/src/Modules/Catalogs/Application/Handlers/Commands/ServiceCategory/CreateServiceCategoryCommandHandler.cs
deleted file mode 100644
index cb1601272..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Commands/ServiceCategory/CreateServiceCategoryCommandHandler.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.ServiceCategory;
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Modules.Catalogs.Domain.Exceptions;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-using ServiceCategoryEntity = MeAjudaAi.Modules.Catalogs.Domain.Entities.ServiceCategory;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Commands.ServiceCategory;
-
-public sealed class CreateServiceCategoryCommandHandler(
- IServiceCategoryRepository categoryRepository)
- : ICommandHandler>
-{
- public async Task> HandleAsync(CreateServiceCategoryCommand request, CancellationToken cancellationToken = default)
- {
- try
- {
- var normalizedName = request.Name?.Trim();
-
- if (string.IsNullOrWhiteSpace(normalizedName))
- return Result.Failure("Category name is required.");
-
- // Verificar se já existe categoria com o mesmo nome
- if (await categoryRepository.ExistsWithNameAsync(normalizedName, null, cancellationToken))
- return Result.Failure($"A category with name '{normalizedName}' already exists.");
-
- var category = ServiceCategoryEntity.Create(normalizedName, request.Description, request.DisplayOrder);
-
- await categoryRepository.AddAsync(category, cancellationToken);
-
- var dto = new ServiceCategoryDto(
- category.Id.Value,
- category.Name,
- category.Description,
- category.IsActive,
- category.DisplayOrder,
- category.CreatedAt,
- category.UpdatedAt
- );
-
- return Result.Success(dto);
- }
- catch (CatalogDomainException ex)
- {
- return Result.Failure(ex.Message);
- }
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Commands/ServiceCategory/DeactivateServiceCategoryCommandHandler.cs b/src/Modules/Catalogs/Application/Handlers/Commands/ServiceCategory/DeactivateServiceCategoryCommandHandler.cs
deleted file mode 100644
index c04fca252..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Commands/ServiceCategory/DeactivateServiceCategoryCommandHandler.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.ServiceCategory;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Commands.ServiceCategory;
-
-public sealed class DeactivateServiceCategoryCommandHandler(
- IServiceCategoryRepository categoryRepository)
- : ICommandHandler
-{
- public async Task HandleAsync(DeactivateServiceCategoryCommand request, CancellationToken cancellationToken = default)
- {
- if (request.Id == Guid.Empty)
- return Result.Failure("Category ID cannot be empty.");
-
- var categoryId = ServiceCategoryId.From(request.Id);
- var category = await categoryRepository.GetByIdAsync(categoryId, cancellationToken);
-
- if (category is null)
- return Result.Failure($"Category with ID '{request.Id}' not found.");
-
- category.Deactivate();
-
- await categoryRepository.UpdateAsync(category, cancellationToken);
-
- return Result.Success();
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Commands/ServiceCategory/DeleteServiceCategoryCommandHandler.cs b/src/Modules/Catalogs/Application/Handlers/Commands/ServiceCategory/DeleteServiceCategoryCommandHandler.cs
deleted file mode 100644
index 277def7f1..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Commands/ServiceCategory/DeleteServiceCategoryCommandHandler.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.ServiceCategory;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Commands.ServiceCategory;
-
-public sealed class DeleteServiceCategoryCommandHandler(
- IServiceCategoryRepository categoryRepository,
- IServiceRepository serviceRepository)
- : ICommandHandler
-{
- public async Task HandleAsync(DeleteServiceCategoryCommand request, CancellationToken cancellationToken = default)
- {
- if (request.Id == Guid.Empty)
- return Result.Failure("Category ID cannot be empty.");
-
- var categoryId = ServiceCategoryId.From(request.Id);
- var category = await categoryRepository.GetByIdAsync(categoryId, cancellationToken);
-
- if (category is null)
- return Result.Failure($"Category with ID '{request.Id}' not found.");
-
- // Verificar se a categoria possui serviços
- var serviceCount = await serviceRepository.CountByCategoryAsync(categoryId, activeOnly: false, cancellationToken);
- if (serviceCount > 0)
- return Result.Failure($"Cannot delete category with {serviceCount} service(s). Remove or reassign services first.");
-
- await categoryRepository.DeleteAsync(categoryId, cancellationToken);
-
- return Result.Success();
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Commands/ServiceCategory/UpdateServiceCategoryCommandHandler.cs b/src/Modules/Catalogs/Application/Handlers/Commands/ServiceCategory/UpdateServiceCategoryCommandHandler.cs
deleted file mode 100644
index 2f3bf7df0..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Commands/ServiceCategory/UpdateServiceCategoryCommandHandler.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Commands.ServiceCategory;
-using MeAjudaAi.Modules.Catalogs.Domain.Exceptions;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Commands;
-using MeAjudaAi.Shared.Functional;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Commands.ServiceCategory;
-
-public sealed class UpdateServiceCategoryCommandHandler(
- IServiceCategoryRepository categoryRepository)
- : ICommandHandler
-{
- public async Task HandleAsync(UpdateServiceCategoryCommand request, CancellationToken cancellationToken = default)
- {
- try
- {
- if (request.Id == Guid.Empty)
- return Result.Failure("Category ID cannot be empty.");
-
- var categoryId = ServiceCategoryId.From(request.Id);
- var category = await categoryRepository.GetByIdAsync(categoryId, cancellationToken);
-
- if (category is null)
- return Result.Failure($"Category with ID '{request.Id}' not found.");
-
- var normalizedName = request.Name?.Trim();
-
- if (string.IsNullOrWhiteSpace(normalizedName))
- return Result.Failure("Category name cannot be empty.");
-
- // Verificar se já existe categoria com o mesmo nome (excluindo a categoria atual)
- if (await categoryRepository.ExistsWithNameAsync(normalizedName, categoryId, cancellationToken))
- return Result.Failure($"A category with name '{normalizedName}' already exists.");
-
- category.Update(normalizedName, request.Description, request.DisplayOrder);
-
- await categoryRepository.UpdateAsync(category, cancellationToken);
-
- return Result.Success();
- }
- catch (CatalogDomainException ex)
- {
- return Result.Failure(ex.Message);
- }
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Queries/Service/GetAllServicesQueryHandler.cs b/src/Modules/Catalogs/Application/Handlers/Queries/Service/GetAllServicesQueryHandler.cs
deleted file mode 100644
index 3248b9c66..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Queries/Service/GetAllServicesQueryHandler.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Modules.Catalogs.Application.Queries.Service;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Queries.Service;
-
-public sealed class GetAllServicesQueryHandler(IServiceRepository repository)
- : IQueryHandler>>
-{
- public async Task>> HandleAsync(
- GetAllServicesQuery request,
- CancellationToken cancellationToken = default)
- {
- var services = await repository.GetAllAsync(request.ActiveOnly, cancellationToken);
-
- var dtos = services.Select(s => new ServiceListDto(
- s.Id.Value,
- s.CategoryId.Value,
- s.Name,
- s.Description,
- s.IsActive
- )).ToList();
-
- return Result>.Success(dtos);
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Queries/Service/GetServiceByIdQueryHandler.cs b/src/Modules/Catalogs/Application/Handlers/Queries/Service/GetServiceByIdQueryHandler.cs
deleted file mode 100644
index 344464a76..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Queries/Service/GetServiceByIdQueryHandler.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Modules.Catalogs.Application.Queries.Service;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Constants;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Queries.Service;
-
-public sealed class GetServiceByIdQueryHandler(IServiceRepository repository)
- : IQueryHandler>
-{
- public async Task> HandleAsync(
- GetServiceByIdQuery request,
- CancellationToken cancellationToken = default)
- {
- if (request.Id == Guid.Empty)
- return Result.Success(null);
-
- var serviceId = ServiceId.From(request.Id);
- var service = await repository.GetByIdAsync(serviceId, cancellationToken);
-
- if (service is null)
- return Result.Success(null);
-
- // Nota: A propriedade de navegação Category deve ser carregada pelo repositório
- var categoryName = service.Category?.Name ?? ValidationMessages.Catalogs.UnknownCategoryName;
-
- var dto = new ServiceDto(
- service.Id.Value,
- service.CategoryId.Value,
- categoryName,
- service.Name,
- service.Description,
- service.IsActive,
- service.DisplayOrder,
- service.CreatedAt,
- service.UpdatedAt
- );
-
- return Result.Success(dto);
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Queries/Service/GetServicesByCategoryQueryHandler.cs b/src/Modules/Catalogs/Application/Handlers/Queries/Service/GetServicesByCategoryQueryHandler.cs
deleted file mode 100644
index 4a44b6384..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Queries/Service/GetServicesByCategoryQueryHandler.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Modules.Catalogs.Application.Queries.Service;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Queries.Service;
-
-public sealed class GetServicesByCategoryQueryHandler(IServiceRepository repository)
- : IQueryHandler>>
-{
- public async Task>> HandleAsync(
- GetServicesByCategoryQuery request,
- CancellationToken cancellationToken = default)
- {
- if (request.CategoryId == Guid.Empty)
- return Result>.Success(Array.Empty());
-
- var categoryId = ServiceCategoryId.From(request.CategoryId);
- var services = await repository.GetByCategoryAsync(categoryId, request.ActiveOnly, cancellationToken);
-
- var dtos = services.Select(s => new ServiceListDto(
- s.Id.Value,
- s.CategoryId.Value,
- s.Name,
- s.Description,
- s.IsActive
- )).ToList();
-
- return Result>.Success(dtos);
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Queries/ServiceCategory/GetAllServiceCategoriesQueryHandler.cs b/src/Modules/Catalogs/Application/Handlers/Queries/ServiceCategory/GetAllServiceCategoriesQueryHandler.cs
deleted file mode 100644
index b42ff2e66..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Queries/ServiceCategory/GetAllServiceCategoriesQueryHandler.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Modules.Catalogs.Application.Queries.ServiceCategory;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Queries.ServiceCategory;
-
-public sealed class GetAllServiceCategoriesQueryHandler(IServiceCategoryRepository repository)
- : IQueryHandler>>
-{
- public async Task>> HandleAsync(
- GetAllServiceCategoriesQuery request,
- CancellationToken cancellationToken = default)
- {
- var categories = await repository.GetAllAsync(request.ActiveOnly, cancellationToken);
-
- var dtos = categories.Select(c => new ServiceCategoryDto(
- c.Id.Value,
- c.Name,
- c.Description,
- c.IsActive,
- c.DisplayOrder,
- c.CreatedAt,
- c.UpdatedAt
- )).ToList();
-
- return Result>.Success(dtos);
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Queries/ServiceCategory/GetServiceCategoriesWithCountQueryHandler.cs b/src/Modules/Catalogs/Application/Handlers/Queries/ServiceCategory/GetServiceCategoriesWithCountQueryHandler.cs
deleted file mode 100644
index f4955012b..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Queries/ServiceCategory/GetServiceCategoriesWithCountQueryHandler.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Modules.Catalogs.Application.Queries.ServiceCategory;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Queries.ServiceCategory;
-
-public sealed class GetServiceCategoriesWithCountQueryHandler(
- IServiceCategoryRepository categoryRepository,
- IServiceRepository serviceRepository)
- : IQueryHandler>>
-{
- public async Task>> HandleAsync(
- GetServiceCategoriesWithCountQuery request,
- CancellationToken cancellationToken = default)
- {
- var categories = await categoryRepository.GetAllAsync(request.ActiveOnly, cancellationToken);
-
- var dtos = new List();
-
- // NOTA: Isso executa 2 * N consultas de contagem (uma para total, uma para ativo por categoria).
- // Para catálogos pequenos a médios isso é aceitável. Se isso se tornar um gargalo de performance
- // com muitas categorias, considere otimizar com uma consulta em lote ou agrupamento no repositório.
- foreach (var category in categories)
- {
- var totalCount = await serviceRepository.CountByCategoryAsync(
- category.Id,
- activeOnly: false,
- cancellationToken);
-
- var activeCount = await serviceRepository.CountByCategoryAsync(
- category.Id,
- activeOnly: true,
- cancellationToken);
-
- dtos.Add(new ServiceCategoryWithCountDto(
- category.Id.Value,
- category.Name,
- category.Description,
- category.IsActive,
- category.DisplayOrder,
- activeCount,
- totalCount
- ));
- }
-
- return Result>.Success(dtos);
- }
-}
diff --git a/src/Modules/Catalogs/Application/Handlers/Queries/ServiceCategory/GetServiceCategoryByIdQueryHandler.cs b/src/Modules/Catalogs/Application/Handlers/Queries/ServiceCategory/GetServiceCategoryByIdQueryHandler.cs
deleted file mode 100644
index 67f4ad931..000000000
--- a/src/Modules/Catalogs/Application/Handlers/Queries/ServiceCategory/GetServiceCategoryByIdQueryHandler.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Modules.Catalogs.Application.Queries.ServiceCategory;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Handlers.Queries.ServiceCategory;
-
-public sealed class GetServiceCategoryByIdQueryHandler(IServiceCategoryRepository repository)
- : IQueryHandler>
-{
- public async Task> HandleAsync(
- GetServiceCategoryByIdQuery request,
- CancellationToken cancellationToken = default)
- {
- if (request.Id == Guid.Empty)
- return Result.Success(null);
-
- var categoryId = ServiceCategoryId.From(request.Id);
- var category = await repository.GetByIdAsync(categoryId, cancellationToken);
-
- if (category is null)
- return Result.Success(null);
-
- var dto = new ServiceCategoryDto(
- category.Id.Value,
- category.Name,
- category.Description,
- category.IsActive,
- category.DisplayOrder,
- category.CreatedAt,
- category.UpdatedAt
- );
-
- return Result.Success(dto);
- }
-}
diff --git a/src/Modules/Catalogs/Application/MeAjudaAi.Modules.Catalogs.Application.csproj b/src/Modules/Catalogs/Application/MeAjudaAi.Modules.Catalogs.Application.csproj
deleted file mode 100644
index c51804f97..000000000
--- a/src/Modules/Catalogs/Application/MeAjudaAi.Modules.Catalogs.Application.csproj
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- net10.0
- enable
- enable
-
-
-
-
- <_Parameter1>MeAjudaAi.Modules.Catalogs.Tests
-
-
-
-
-
-
-
-
-
diff --git a/src/Modules/Catalogs/Application/ModuleApi/CatalogsModuleApi.cs b/src/Modules/Catalogs/Application/ModuleApi/CatalogsModuleApi.cs
deleted file mode 100644
index 22d6a9cd3..000000000
--- a/src/Modules/Catalogs/Application/ModuleApi/CatalogsModuleApi.cs
+++ /dev/null
@@ -1,304 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.Queries.Service;
-using MeAjudaAi.Modules.Catalogs.Application.Queries.ServiceCategory;
-using MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Constants;
-using MeAjudaAi.Shared.Contracts.Modules;
-using MeAjudaAi.Shared.Contracts.Modules.Catalogs;
-using MeAjudaAi.Shared.Contracts.Modules.Catalogs.DTOs;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Diagnostics.HealthChecks;
-using Microsoft.Extensions.Logging;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.ModuleApi;
-
-///
-/// Implementação da API pública para o módulo Catalogs.
-///
-[ModuleApi(ModuleMetadata.Name, ModuleMetadata.Version)]
-public sealed class CatalogsModuleApi(
- IServiceCategoryRepository categoryRepository,
- IServiceRepository serviceRepository,
- ILogger logger) : ICatalogsModuleApi
-{
- private static class ModuleMetadata
- {
- public const string Name = "Catalogs";
- public const string Version = "1.0";
- }
-
- public string ModuleName => ModuleMetadata.Name;
- public string ApiVersion => ModuleMetadata.Version;
-
- public async Task IsAvailableAsync(CancellationToken cancellationToken = default)
- {
- try
- {
- logger.LogDebug("Checking Catalogs module availability");
-
- // Simple database connectivity test
- var categories = await categoryRepository.GetAllAsync(activeOnly: true, cancellationToken);
-
- logger.LogDebug("Catalogs module is available and healthy");
- return true;
- }
- catch (OperationCanceledException)
- {
- logger.LogDebug("Catalogs module availability check was cancelled");
- throw;
- }
- catch (Exception ex)
- {
- logger.LogError(ex, "Error checking Catalogs module availability");
- return false;
- }
- }
-
- public async Task> GetServiceCategoryByIdAsync(
- Guid categoryId,
- CancellationToken cancellationToken = default)
- {
- try
- {
- if (categoryId == Guid.Empty)
- return Result.Failure("Category id must be provided");
-
- var id = ServiceCategoryId.From(categoryId);
- var category = await categoryRepository.GetByIdAsync(id, cancellationToken);
-
- if (category is null)
- return Result.Success(null);
-
- var dto = new ModuleServiceCategoryDto(
- category.Id.Value,
- category.Name,
- category.Description,
- category.IsActive,
- category.DisplayOrder
- );
-
- return Result.Success(dto);
- }
- catch (Exception ex)
- {
- logger.LogError(ex, "Error retrieving service category {CategoryId}", categoryId);
- return Result.Failure($"Error retrieving service category: {ex.Message}");
- }
- }
-
- public async Task>> GetAllServiceCategoriesAsync(
- bool activeOnly = true,
- CancellationToken cancellationToken = default)
- {
- try
- {
- var categories = await categoryRepository.GetAllAsync(activeOnly, cancellationToken);
-
- var dtos = categories.Select(c => new ModuleServiceCategoryDto(
- c.Id.Value,
- c.Name,
- c.Description,
- c.IsActive,
- c.DisplayOrder
- )).ToList();
-
- return Result>.Success(dtos);
- }
- catch (Exception ex)
- {
- logger.LogError(ex, "Error retrieving service categories");
- return Result>.Failure($"Error retrieving service categories: {ex.Message}");
- }
- }
-
- public async Task> GetServiceByIdAsync(
- Guid serviceId,
- CancellationToken cancellationToken = default)
- {
- try
- {
- if (serviceId == Guid.Empty)
- return Result.Failure("Service id must be provided");
-
- var id = ServiceId.From(serviceId);
- var service = await serviceRepository.GetByIdAsync(id, cancellationToken);
-
- if (service is null)
- return Result.Success(null);
-
- var categoryName = service.Category?.Name ?? ValidationMessages.Catalogs.UnknownCategoryName;
-
- var dto = new ModuleServiceDto(
- service.Id.Value,
- service.CategoryId.Value,
- categoryName,
- service.Name,
- service.Description,
- service.IsActive
- );
-
- return Result.Success(dto);
- }
- catch (Exception ex)
- {
- logger.LogError(ex, "Error retrieving service {ServiceId}", serviceId);
- return Result.Failure($"Error retrieving service: {ex.Message}");
- }
- }
-
- public async Task>> GetAllServicesAsync(
- bool activeOnly = true,
- CancellationToken cancellationToken = default)
- {
- try
- {
- var services = await serviceRepository.GetAllAsync(activeOnly, cancellationToken);
-
- var dtos = services.Select(s => new ModuleServiceListDto(
- s.Id.Value,
- s.CategoryId.Value,
- s.Name,
- s.IsActive
- )).ToList();
-
- return Result>.Success(dtos);
- }
- catch (Exception ex)
- {
- logger.LogError(ex, "Error retrieving services");
- return Result>.Failure($"Error retrieving services: {ex.Message}");
- }
- }
-
- public async Task>> GetServicesByCategoryAsync(
- Guid categoryId,
- bool activeOnly = true,
- CancellationToken cancellationToken = default)
- {
- try
- {
- if (categoryId == Guid.Empty)
- return Result>.Failure("Category id must be provided");
-
- var id = ServiceCategoryId.From(categoryId);
- var services = await serviceRepository.GetByCategoryAsync(id, activeOnly, cancellationToken);
-
- var dtos = services.Select(s => new ModuleServiceDto(
- s.Id.Value,
- s.CategoryId.Value,
- s.Category?.Name ?? ValidationMessages.Catalogs.UnknownCategoryName,
- s.Name,
- s.Description,
- s.IsActive
- )).ToList();
-
- return Result>.Success(dtos);
- }
- catch (Exception ex)
- {
- logger.LogError(ex, "Error retrieving services for category {CategoryId}", categoryId);
- return Result>.Failure($"Error retrieving services: {ex.Message}");
- }
- }
-
- public async Task> IsServiceActiveAsync(
- Guid serviceId,
- CancellationToken cancellationToken = default)
- {
- try
- {
- if (serviceId == Guid.Empty)
- return Result.Failure("Service id must be provided");
-
- var serviceIdValue = ServiceId.From(serviceId);
- var service = await serviceRepository.GetByIdAsync(serviceIdValue, cancellationToken);
-
- // Return false for not-found to align with query semantics (vs Failure)
- if (service is null)
- return Result.Success(false);
-
- return Result.Success(service.IsActive);
- }
- catch (Exception ex)
- {
- logger.LogError(ex, "Error checking if service {ServiceId} is active", serviceId);
- return Result.Failure($"Error checking service status: {ex.Message}");
- }
- }
-
- public async Task> ValidateServicesAsync(
- IReadOnlyCollection serviceIds,
- CancellationToken cancellationToken = default)
- {
- try
- {
- if (serviceIds is null)
- return Result.Failure("Service IDs collection cannot be null");
-
- // Short-circuit for empty collection
- if (serviceIds.Count == 0)
- {
- return Result.Success(
- new ModuleServiceValidationResultDto(true, [], []));
- }
-
- var invalidIds = new List();
- var inactiveIds = new List();
-
- // Deduplicate input IDs and separate empty GUIDs
- var distinctIds = serviceIds.Distinct().ToList();
- var validGuids = new List();
-
- foreach (var id in distinctIds)
- {
- if (id == Guid.Empty)
- {
- invalidIds.Add(id);
- }
- else
- {
- validGuids.Add(id);
- }
- }
-
- // Only convert non-empty GUIDs to ServiceId value objects
- if (validGuids.Count > 0)
- {
- var serviceIdValues = validGuids.Select(ServiceId.From).ToList();
-
- // Batch query to avoid N+1 problem
- var services = await serviceRepository.GetByIdsAsync(serviceIdValues, cancellationToken);
- var serviceLookup = services.ToDictionary(s => s.Id.Value);
-
- foreach (var serviceId in validGuids)
- {
- if (!serviceLookup.TryGetValue(serviceId, out var service))
- {
- invalidIds.Add(serviceId);
- }
- else if (!service.IsActive)
- {
- inactiveIds.Add(serviceId);
- }
- }
- }
-
- var allValid = invalidIds.Count == 0 && inactiveIds.Count == 0;
-
- var result = new ModuleServiceValidationResultDto(
- allValid,
- [.. invalidIds],
- [.. inactiveIds]
- );
-
- return Result.Success(result);
- }
- catch (Exception ex)
- {
- logger.LogError(ex, "Error validating services");
- return Result.Failure($"Error validating services: {ex.Message}");
- }
- }
-}
diff --git a/src/Modules/Catalogs/Application/Queries/Service/GetAllServicesQuery.cs b/src/Modules/Catalogs/Application/Queries/Service/GetAllServicesQuery.cs
deleted file mode 100644
index 36e3d4f66..000000000
--- a/src/Modules/Catalogs/Application/Queries/Service/GetAllServicesQuery.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Queries.Service;
-
-public sealed record GetAllServicesQuery(bool ActiveOnly = false)
- : Query>>;
diff --git a/src/Modules/Catalogs/Application/Queries/Service/GetServiceByIdQuery.cs b/src/Modules/Catalogs/Application/Queries/Service/GetServiceByIdQuery.cs
deleted file mode 100644
index 03ee75926..000000000
--- a/src/Modules/Catalogs/Application/Queries/Service/GetServiceByIdQuery.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Queries.Service;
-
-public sealed record GetServiceByIdQuery(Guid Id)
- : Query>;
diff --git a/src/Modules/Catalogs/Application/Queries/Service/GetServicesByCategoryQuery.cs b/src/Modules/Catalogs/Application/Queries/Service/GetServicesByCategoryQuery.cs
deleted file mode 100644
index a6fa553c6..000000000
--- a/src/Modules/Catalogs/Application/Queries/Service/GetServicesByCategoryQuery.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Queries.Service;
-
-public sealed record GetServicesByCategoryQuery(Guid CategoryId, bool ActiveOnly = false)
- : Query>>;
diff --git a/src/Modules/Catalogs/Application/Queries/ServiceCategory/GetAllServiceCategoriesQuery.cs b/src/Modules/Catalogs/Application/Queries/ServiceCategory/GetAllServiceCategoriesQuery.cs
deleted file mode 100644
index 458d28418..000000000
--- a/src/Modules/Catalogs/Application/Queries/ServiceCategory/GetAllServiceCategoriesQuery.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Queries.ServiceCategory;
-
-public sealed record GetAllServiceCategoriesQuery(bool ActiveOnly = false)
- : Query>>;
diff --git a/src/Modules/Catalogs/Application/Queries/ServiceCategory/GetServiceCategoriesWithCountQuery.cs b/src/Modules/Catalogs/Application/Queries/ServiceCategory/GetServiceCategoriesWithCountQuery.cs
deleted file mode 100644
index 8cdbb5b69..000000000
--- a/src/Modules/Catalogs/Application/Queries/ServiceCategory/GetServiceCategoriesWithCountQuery.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Queries.ServiceCategory;
-
-public sealed record GetServiceCategoriesWithCountQuery(bool ActiveOnly = false)
- : Query>>;
diff --git a/src/Modules/Catalogs/Application/Queries/ServiceCategory/GetServiceCategoryByIdQuery.cs b/src/Modules/Catalogs/Application/Queries/ServiceCategory/GetServiceCategoryByIdQuery.cs
deleted file mode 100644
index fd6a22170..000000000
--- a/src/Modules/Catalogs/Application/Queries/ServiceCategory/GetServiceCategoryByIdQuery.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Application.DTOs;
-using MeAjudaAi.Shared.Functional;
-using MeAjudaAi.Shared.Queries;
-
-namespace MeAjudaAi.Modules.Catalogs.Application.Queries.ServiceCategory;
-
-public sealed record GetServiceCategoryByIdQuery(Guid Id)
- : Query>;
diff --git a/src/Modules/Catalogs/Domain/Entities/Service.cs b/src/Modules/Catalogs/Domain/Entities/Service.cs
deleted file mode 100644
index 522b3d200..000000000
--- a/src/Modules/Catalogs/Domain/Entities/Service.cs
+++ /dev/null
@@ -1,159 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Domain.Events.Service;
-using MeAjudaAi.Modules.Catalogs.Domain.Exceptions;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Constants;
-using MeAjudaAi.Shared.Domain;
-
-namespace MeAjudaAi.Modules.Catalogs.Domain.Entities;
-
-///
-/// Representa um serviço específico que provedores podem oferecer (ex: "Limpeza de Apartamento", "Conserto de Torneira").
-/// Serviços pertencem a uma categoria e podem ser ativados/desativados por administradores.
-///
-public sealed class Service : AggregateRoot
-{
- ///
- /// ID da categoria à qual este serviço pertence.
- ///
- public ServiceCategoryId CategoryId { get; private set; } = null!;
-
- ///
- /// Nome do serviço.
- ///
- public string Name { get; private set; } = string.Empty;
-
- ///
- /// Descrição opcional explicando o que este serviço inclui.
- ///
- public string? Description { get; private set; }
-
- ///
- /// Indica se este serviço está atualmente ativo e disponível para provedores oferecerem.
- /// Serviços desativados são ocultados do catálogo.
- ///
- public bool IsActive { get; private set; }
-
- ///
- /// Ordem de exibição opcional dentro da categoria para ordenação na UI.
- ///
- public int DisplayOrder { get; private set; }
-
- // Navigation property (loaded explicitly when needed)
- public ServiceCategory? Category { get; private set; }
-
- // EF Core constructor
- private Service() { }
-
- ///
- /// Cria um novo serviço dentro de uma categoria.
- ///
- /// ID da categoria pai
- /// Nome do serviço (obrigatório, 1-150 caracteres)
- /// Descrição opcional do serviço (máx 1000 caracteres)
- /// Ordem de exibição para ordenação (padrão: 0)
- /// Lançada quando a validação falha
- public static Service Create(ServiceCategoryId categoryId, string name, string? description = null, int displayOrder = 0)
- {
- if (categoryId is null)
- throw new CatalogDomainException("Category ID is required.");
-
- ValidateName(name);
- ValidateDescription(description);
- ValidateDisplayOrder(displayOrder);
-
- var service = new Service
- {
- Id = ServiceId.New(),
- CategoryId = categoryId,
- Name = name.Trim(),
- Description = description?.Trim(),
- IsActive = true,
- DisplayOrder = displayOrder
- };
-
- service.AddDomainEvent(new ServiceCreatedDomainEvent(service.Id, categoryId));
- return service;
- }
-
- ///
- /// Atualiza as informações do serviço.
- ///
- public void Update(string name, string? description = null, int displayOrder = 0)
- {
- ValidateName(name);
- ValidateDescription(description);
- ValidateDisplayOrder(displayOrder);
-
- Name = name.Trim();
- Description = description?.Trim();
- DisplayOrder = displayOrder;
- MarkAsUpdated();
-
- AddDomainEvent(new ServiceUpdatedDomainEvent(Id));
- }
-
- ///
- /// Altera a categoria deste serviço.
- ///
- public void ChangeCategory(ServiceCategoryId newCategoryId)
- {
- if (newCategoryId is null)
- throw new CatalogDomainException("Category ID is required.");
-
- if (CategoryId.Value == newCategoryId.Value)
- return;
-
- var oldCategoryId = CategoryId;
- CategoryId = newCategoryId;
- Category = null; // Invalidar navegação para forçar recarga quando necessário
- MarkAsUpdated();
-
- AddDomainEvent(new ServiceCategoryChangedDomainEvent(Id, oldCategoryId, newCategoryId));
- }
-
- ///
- /// Ativa o serviço, tornando-o disponível no catálogo.
- ///
- public void Activate()
- {
- if (IsActive) return;
-
- IsActive = true;
- MarkAsUpdated();
- AddDomainEvent(new ServiceActivatedDomainEvent(Id));
- }
-
- ///
- /// Desativa o serviço, removendo-o do catálogo.
- /// Provedores que atualmente oferecem este serviço o mantêm, mas novas atribuições são impedidas.
- ///
- public void Deactivate()
- {
- if (!IsActive) return;
-
- IsActive = false;
- MarkAsUpdated();
- AddDomainEvent(new ServiceDeactivatedDomainEvent(Id));
- }
-
- private static void ValidateName(string name)
- {
- if (string.IsNullOrWhiteSpace(name))
- throw new CatalogDomainException("Service name is required.");
-
- if (name.Trim().Length > ValidationConstants.CatalogLimits.ServiceNameMaxLength)
- throw new CatalogDomainException($"Service name cannot exceed {ValidationConstants.CatalogLimits.ServiceNameMaxLength} characters.");
- }
-
- private static void ValidateDescription(string? description)
- {
- if (description is not null && description.Trim().Length > ValidationConstants.CatalogLimits.ServiceDescriptionMaxLength)
- throw new CatalogDomainException($"Service description cannot exceed {ValidationConstants.CatalogLimits.ServiceDescriptionMaxLength} characters.");
- }
-
- private static void ValidateDisplayOrder(int displayOrder)
- {
- if (displayOrder < 0)
- throw new CatalogDomainException("Display order cannot be negative.");
- }
-}
diff --git a/src/Modules/Catalogs/Domain/Entities/ServiceCategory.cs b/src/Modules/Catalogs/Domain/Entities/ServiceCategory.cs
deleted file mode 100644
index 3ba8b1dcc..000000000
--- a/src/Modules/Catalogs/Domain/Entities/ServiceCategory.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Domain.Events.ServiceCategory;
-using MeAjudaAi.Modules.Catalogs.Domain.Exceptions;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Constants;
-using MeAjudaAi.Shared.Domain;
-
-namespace MeAjudaAi.Modules.Catalogs.Domain.Entities;
-
-///
-/// Representa uma categoria de serviço no catálogo (ex: "Limpeza", "Reparos").
-/// Categorias organizam serviços em grupos lógicos para facilitar a descoberta.
-///
-public sealed class ServiceCategory : AggregateRoot
-{
- ///
- /// Nome da categoria.
- ///
- public string Name { get; private set; } = string.Empty;
-
- ///
- /// Descrição opcional explicando quais serviços pertencem a esta categoria.
- ///
- public string? Description { get; private set; }
-
- ///
- /// Indica se esta categoria está atualmente ativa e disponível para uso.
- /// Categorias desativadas não podem ser atribuídas a novos serviços.
- ///
- public bool IsActive { get; private set; }
-
- ///
- /// Ordem de exibição opcional para ordenação na UI.
- ///
- public int DisplayOrder { get; private set; }
-
- // EF Core constructor
- private ServiceCategory() { }
-
- ///
- /// Cria uma nova categoria de serviço.
- ///
- /// Nome da categoria (obrigatório, 1-100 caracteres)
- /// Descrição opcional da categoria (máx 500 caracteres)
- /// Ordem de exibição para ordenação (padrão: 0)
- /// Lançada quando a validação falha
- public static ServiceCategory Create(string name, string? description = null, int displayOrder = 0)
- {
- ValidateName(name);
- ValidateDescription(description);
- ValidateDisplayOrder(displayOrder);
-
- var category = new ServiceCategory
- {
- Id = ServiceCategoryId.New(),
- Name = name.Trim(),
- Description = description?.Trim(),
- IsActive = true,
- DisplayOrder = displayOrder
- };
-
- category.AddDomainEvent(new ServiceCategoryCreatedDomainEvent(category.Id));
- return category;
- }
-
- ///
- /// Atualiza as informações da categoria.
- ///
- public void Update(string name, string? description = null, int displayOrder = 0)
- {
- ValidateName(name);
- ValidateDescription(description);
- ValidateDisplayOrder(displayOrder);
-
- Name = name.Trim();
- Description = description?.Trim();
- DisplayOrder = displayOrder;
- MarkAsUpdated();
-
- AddDomainEvent(new ServiceCategoryUpdatedDomainEvent(Id));
- }
-
- ///
- /// Ativa a categoria, tornando-a disponível para uso.
- ///
- public void Activate()
- {
- if (IsActive) return;
-
- IsActive = true;
- MarkAsUpdated();
- AddDomainEvent(new ServiceCategoryActivatedDomainEvent(Id));
- }
-
- ///
- /// Desativa a categoria, impedindo que seja atribuída a novos serviços.
- /// Serviços existentes mantêm sua atribuição de categoria.
- ///
- public void Deactivate()
- {
- if (!IsActive) return;
-
- IsActive = false;
- MarkAsUpdated();
- AddDomainEvent(new ServiceCategoryDeactivatedDomainEvent(Id));
- }
-
- private static void ValidateName(string name)
- {
- if (string.IsNullOrWhiteSpace(name))
- throw new CatalogDomainException("Category name is required.");
-
- if (name.Trim().Length > ValidationConstants.CatalogLimits.ServiceCategoryNameMaxLength)
- throw new CatalogDomainException($"Category name cannot exceed {ValidationConstants.CatalogLimits.ServiceCategoryNameMaxLength} characters.");
- }
-
- private static void ValidateDescription(string? description)
- {
- if (description is not null && description.Trim().Length > ValidationConstants.CatalogLimits.ServiceCategoryDescriptionMaxLength)
- throw new CatalogDomainException($"Category description cannot exceed {ValidationConstants.CatalogLimits.ServiceCategoryDescriptionMaxLength} characters.");
- }
-
- private static void ValidateDisplayOrder(int displayOrder)
- {
- if (displayOrder < 0)
- throw new CatalogDomainException("Display order cannot be negative.");
- }
-}
diff --git a/src/Modules/Catalogs/Domain/Events/Service/ServiceActivatedDomainEvent.cs b/src/Modules/Catalogs/Domain/Events/Service/ServiceActivatedDomainEvent.cs
deleted file mode 100644
index 17366188c..000000000
--- a/src/Modules/Catalogs/Domain/Events/Service/ServiceActivatedDomainEvent.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Events;
-
-namespace MeAjudaAi.Modules.Catalogs.Domain.Events.Service;
-
-public sealed record ServiceActivatedDomainEvent(ServiceId ServiceId)
- : DomainEvent(ServiceId.Value, Version: 1);
diff --git a/src/Modules/Catalogs/Domain/Events/Service/ServiceCategoryChangedDomainEvent.cs b/src/Modules/Catalogs/Domain/Events/Service/ServiceCategoryChangedDomainEvent.cs
deleted file mode 100644
index e892f445d..000000000
--- a/src/Modules/Catalogs/Domain/Events/Service/ServiceCategoryChangedDomainEvent.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Events;
-
-namespace MeAjudaAi.Modules.Catalogs.Domain.Events.Service;
-
-public sealed record ServiceCategoryChangedDomainEvent(
- ServiceId ServiceId,
- ServiceCategoryId OldCategoryId,
- ServiceCategoryId NewCategoryId)
- : DomainEvent(ServiceId.Value, Version: 1);
diff --git a/src/Modules/Catalogs/Domain/Events/Service/ServiceCreatedDomainEvent.cs b/src/Modules/Catalogs/Domain/Events/Service/ServiceCreatedDomainEvent.cs
deleted file mode 100644
index 12a975a9e..000000000
--- a/src/Modules/Catalogs/Domain/Events/Service/ServiceCreatedDomainEvent.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Events;
-
-namespace MeAjudaAi.Modules.Catalogs.Domain.Events.Service;
-
-public sealed record ServiceCreatedDomainEvent(ServiceId ServiceId, ServiceCategoryId CategoryId)
- : DomainEvent(ServiceId.Value, Version: 1);
diff --git a/src/Modules/Catalogs/Domain/Events/Service/ServiceDeactivatedDomainEvent.cs b/src/Modules/Catalogs/Domain/Events/Service/ServiceDeactivatedDomainEvent.cs
deleted file mode 100644
index 8478b712c..000000000
--- a/src/Modules/Catalogs/Domain/Events/Service/ServiceDeactivatedDomainEvent.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Events;
-
-namespace MeAjudaAi.Modules.Catalogs.Domain.Events.Service;
-
-public sealed record ServiceDeactivatedDomainEvent(ServiceId ServiceId)
- : DomainEvent(ServiceId.Value, Version: 1);
diff --git a/src/Modules/Catalogs/Domain/Events/Service/ServiceUpdatedDomainEvent.cs b/src/Modules/Catalogs/Domain/Events/Service/ServiceUpdatedDomainEvent.cs
deleted file mode 100644
index 5e88dde98..000000000
--- a/src/Modules/Catalogs/Domain/Events/Service/ServiceUpdatedDomainEvent.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Events;
-
-namespace MeAjudaAi.Modules.Catalogs.Domain.Events.Service;
-
-public sealed record ServiceUpdatedDomainEvent(ServiceId ServiceId)
- : DomainEvent(ServiceId.Value, Version: 1);
diff --git a/src/Modules/Catalogs/Domain/Events/ServiceCategory/ServiceCategoryActivatedDomainEvent.cs b/src/Modules/Catalogs/Domain/Events/ServiceCategory/ServiceCategoryActivatedDomainEvent.cs
deleted file mode 100644
index b3b6f4f4e..000000000
--- a/src/Modules/Catalogs/Domain/Events/ServiceCategory/ServiceCategoryActivatedDomainEvent.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Events;
-
-namespace MeAjudaAi.Modules.Catalogs.Domain.Events.ServiceCategory;
-
-public sealed record ServiceCategoryActivatedDomainEvent(ServiceCategoryId CategoryId)
- : DomainEvent(CategoryId.Value, Version: 1);
diff --git a/src/Modules/Catalogs/Domain/Events/ServiceCategory/ServiceCategoryCreatedDomainEvent.cs b/src/Modules/Catalogs/Domain/Events/ServiceCategory/ServiceCategoryCreatedDomainEvent.cs
deleted file mode 100644
index fe35ecd91..000000000
--- a/src/Modules/Catalogs/Domain/Events/ServiceCategory/ServiceCategoryCreatedDomainEvent.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Events;
-
-namespace MeAjudaAi.Modules.Catalogs.Domain.Events.ServiceCategory;
-
-public sealed record ServiceCategoryCreatedDomainEvent(ServiceCategoryId CategoryId)
- : DomainEvent(CategoryId.Value, Version: 1);
diff --git a/src/Modules/Catalogs/Domain/Events/ServiceCategory/ServiceCategoryDeactivatedDomainEvent.cs b/src/Modules/Catalogs/Domain/Events/ServiceCategory/ServiceCategoryDeactivatedDomainEvent.cs
deleted file mode 100644
index 562486e0d..000000000
--- a/src/Modules/Catalogs/Domain/Events/ServiceCategory/ServiceCategoryDeactivatedDomainEvent.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Events;
-
-namespace MeAjudaAi.Modules.Catalogs.Domain.Events.ServiceCategory;
-
-public sealed record ServiceCategoryDeactivatedDomainEvent(ServiceCategoryId CategoryId)
- : DomainEvent(CategoryId.Value, Version: 1);
diff --git a/src/Modules/Catalogs/Domain/Events/ServiceCategory/ServiceCategoryUpdatedDomainEvent.cs b/src/Modules/Catalogs/Domain/Events/ServiceCategory/ServiceCategoryUpdatedDomainEvent.cs
deleted file mode 100644
index 8d06ff3c6..000000000
--- a/src/Modules/Catalogs/Domain/Events/ServiceCategory/ServiceCategoryUpdatedDomainEvent.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-using MeAjudaAi.Shared.Events;
-
-namespace MeAjudaAi.Modules.Catalogs.Domain.Events.ServiceCategory;
-
-public sealed record ServiceCategoryUpdatedDomainEvent(ServiceCategoryId CategoryId)
- : DomainEvent(CategoryId.Value, Version: 1);
diff --git a/src/Modules/Catalogs/Domain/Exceptions/CatalogDomainException.cs b/src/Modules/Catalogs/Domain/Exceptions/CatalogDomainException.cs
deleted file mode 100644
index 33b59c364..000000000
--- a/src/Modules/Catalogs/Domain/Exceptions/CatalogDomainException.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace MeAjudaAi.Modules.Catalogs.Domain.Exceptions;
-
-///
-/// Exceção lançada quando uma regra de domínio é violada no módulo Catalogs.
-///
-public sealed class CatalogDomainException : Exception
-{
- public CatalogDomainException(string message) : base(message) { }
-
- public CatalogDomainException(string message, Exception innerException)
- : base(message, innerException) { }
-}
diff --git a/src/Modules/Catalogs/Domain/MeAjudaAi.Modules.Catalogs.Domain.csproj b/src/Modules/Catalogs/Domain/MeAjudaAi.Modules.Catalogs.Domain.csproj
deleted file mode 100644
index a281d675b..000000000
--- a/src/Modules/Catalogs/Domain/MeAjudaAi.Modules.Catalogs.Domain.csproj
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
- net10.0
- enable
- enable
-
-
-
-
- <_Parameter1>MeAjudaAi.Modules.Catalogs.Tests
-
-
-
-
-
-
-
-
diff --git a/src/Modules/Catalogs/Domain/Repositories/IServiceCategoryRepository.cs b/src/Modules/Catalogs/Domain/Repositories/IServiceCategoryRepository.cs
deleted file mode 100644
index 8c9518787..000000000
--- a/src/Modules/Catalogs/Domain/Repositories/IServiceCategoryRepository.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Domain.Entities;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-
-namespace MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-
-///
-/// Contrato de repositório para o agregado ServiceCategory.
-///
-public interface IServiceCategoryRepository
-{
- ///
- /// Recupera uma categoria de serviço por seu ID.
- ///
- /// ID da categoria de serviço
- /// Token de cancelamento para operações assíncronas
- Task GetByIdAsync(ServiceCategoryId id, CancellationToken cancellationToken = default);
-
- ///
- /// Recupera uma categoria de serviço por seu nome.
- ///
- /// Nome da categoria de serviço
- /// Token de cancelamento para operações assíncronas
- Task GetByNameAsync(string name, CancellationToken cancellationToken = default);
-
- ///
- /// Recupera todas as categorias de serviço.
- ///
- /// Se verdadeiro, retorna apenas categorias ativas
- /// Token de cancelamento para operações assíncronas
- Task> GetAllAsync(bool activeOnly = false, CancellationToken cancellationToken = default);
-
- ///
- /// Verifica se já existe uma categoria com o nome fornecido.
- ///
- /// Nome da categoria a verificar
- /// ID opcional da categoria a excluir da verificação
- /// Token de cancelamento para operações assíncronas
- Task ExistsWithNameAsync(string name, ServiceCategoryId? excludeId = null, CancellationToken cancellationToken = default);
-
- ///
- /// Adiciona uma nova categoria de serviço.
- ///
- /// Categoria de serviço a ser adicionada
- /// Token de cancelamento para operações assíncronas
- Task AddAsync(ServiceCategory category, CancellationToken cancellationToken = default);
-
- ///
- /// Atualiza uma categoria de serviço existente.
- ///
- /// Categoria de serviço a ser atualizada
- /// Token de cancelamento para operações assíncronas
- Task UpdateAsync(ServiceCategory category, CancellationToken cancellationToken = default);
-
- ///
- /// Deleta uma categoria de serviço por seu ID (exclusão física - usar com cautela).
- ///
- /// ID da categoria de serviço a ser deletada
- /// Token de cancelamento para operações assíncronas
- Task DeleteAsync(ServiceCategoryId id, CancellationToken cancellationToken = default);
-}
diff --git a/src/Modules/Catalogs/Domain/Repositories/IServiceRepository.cs b/src/Modules/Catalogs/Domain/Repositories/IServiceRepository.cs
deleted file mode 100644
index 47aed884b..000000000
--- a/src/Modules/Catalogs/Domain/Repositories/IServiceRepository.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-using MeAjudaAi.Modules.Catalogs.Domain.Entities;
-using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-
-namespace MeAjudaAi.Modules.Catalogs.Domain.Repositories;
-
-///
-/// Contrato de repositório para o agregado Service.
-///
-public interface IServiceRepository
-{
- ///
- /// Recupera um serviço por seu ID.
- ///
- /// ID do serviço
- /// Token de cancelamento para operações assíncronas
- Task GetByIdAsync(ServiceId id, CancellationToken cancellationToken = default);
-
- ///
- /// Recupera múltiplos serviços por seus IDs (consulta em lote).
- ///
- /// Coleção de IDs de serviços
- /// Token de cancelamento para operações assíncronas
- Task> GetByIdsAsync(IEnumerable ids, CancellationToken cancellationToken = default);
-
- ///
- /// Recupera um serviço por seu nome.
- ///
- /// Nome do serviço
- /// Token de cancelamento para operações assíncronas
- Task GetByNameAsync(string name, CancellationToken cancellationToken = default);
-
- ///
- /// Recupera todos os serviços.
- ///
- /// Se verdadeiro, retorna apenas serviços ativos
- /// Token de cancelamento para operações assíncronas
- Task> GetAllAsync(bool activeOnly = false, CancellationToken cancellationToken = default);
-
- ///
- /// Recupera todos os serviços de uma categoria específica.
- ///
- /// ID da categoria
- /// Se verdadeiro, retorna apenas serviços ativos
- /// Token de cancelamento para operações assíncronas
- Task> GetByCategoryAsync(ServiceCategoryId categoryId, bool activeOnly = false, CancellationToken cancellationToken = default);
-
- ///
- /// Verifica se já existe um serviço com o nome fornecido.
- ///
- /// O nome do serviço a verificar
- /// ID opcional do serviço a excluir da verificação
- /// ID opcional da categoria para restringir a verificação a uma categoria específica
- /// Token de cancelamento para operações assíncronas
- Task ExistsWithNameAsync(string name, ServiceId? excludeId = null, ServiceCategoryId? categoryId = null, CancellationToken cancellationToken = default);
-
- ///
- /// Conta quantos serviços existem em uma categoria.
- ///
- /// ID da categoria
- /// Se verdadeiro, conta apenas serviços ativos
- /// Token de cancelamento para operações assíncronas
- Task CountByCategoryAsync(ServiceCategoryId categoryId, bool activeOnly = false, CancellationToken cancellationToken = default);
-
- ///
- /// Adiciona um novo serviço.
- ///
- /// Serviço a ser adicionado
- /// Token de cancelamento para operações assíncronas
- Task AddAsync(Service service, CancellationToken cancellationToken = default);
-
- ///
- /// Atualiza um serviço existente.
- ///
- /// Serviço a ser atualizado
- /// Token de cancelamento para operações assíncronas
- Task UpdateAsync(Service service, CancellationToken cancellationToken = default);
-
- ///
- /// Deleta um serviço por seu ID (exclusão física - usar com cautela).
- ///
- /// ID do serviço a ser deletado
- /// Token de cancelamento para operações assíncronas
- Task DeleteAsync(ServiceId id, CancellationToken cancellationToken = default);
-}
diff --git a/src/Modules/Catalogs/Domain/ValueObjects/ServiceCategoryId.cs b/src/Modules/Catalogs/Domain/ValueObjects/ServiceCategoryId.cs
deleted file mode 100644
index a4bf29c3d..000000000
--- a/src/Modules/Catalogs/Domain/ValueObjects/ServiceCategoryId.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using MeAjudaAi.Shared.Domain;
-using MeAjudaAi.Shared.Time;
-
-namespace MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
-
-///
-/// Identificador fortemente tipado para o agregado ServiceCategory.
-///
-public class ServiceCategoryId : ValueObject
-{
- public Guid Value { get; }
-
- public ServiceCategoryId(Guid value)
- {
- if (value == Guid.Empty)
- throw new ArgumentException("ServiceCategoryId cannot be empty");
- Value = value;
- }
-
- public static ServiceCategoryId New() => new(UuidGenerator.NewId());
- public static ServiceCategoryId From(Guid value) => new(value);
-
- protected override IEnumerable