Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7d4c7fb
feat: implement Catalogs module with complete CRUD operations
Nov 18, 2025
d56dbab
Merge master into catalogs_module_implementation
Nov 18, 2025
3266102
remove arquivo desnecessario
Nov 18, 2025
1498f4f
fix: correct test data for Catalogs module requests
Nov 18, 2025
914fc23
fix(catalogs): correct authorization and API response format
Nov 18, 2025
859bbe3
refactor(catalogs): improve API consistency and service name validation
Nov 18, 2025
2cef125
refactor(catalogs): code quality improvements and test infrastructure…
Nov 18, 2025
c163a94
refactor(catalogs): apply code review suggestions for test quality
Nov 18, 2025
9632cbc
refactor(catalogs): apply comprehensive code review suggestions
Nov 18, 2025
7bf80df
docs: remove redundant README_TESTS.md from Catalogs module
Nov 18, 2025
7d2a9b4
fix(catalogs): improve test assertions and repository name normalization
Nov 18, 2025
db3ee27
refactor(catalogs): apply code review round 6 - consistency and robus…
Nov 18, 2025
73658d7
refactor(catalogs): apply code review round 7 - validation, diagnosti…
Nov 18, 2025
89bd2a8
refactor(catalogs): add input validation guards and batch query optim…
Nov 18, 2025
87f6d1f
test(catalogs): improve domain test coverage and robustness
Nov 18, 2025
ff80800
refactor(catalogs): fix validation, routing, and E2E test DTOs
Nov 18, 2025
bdf8248
chore: ignore launchSettings.json and fix empty GUID validation
Nov 18, 2025
840219d
refactor: improve code structure and standardization
Nov 18, 2025
af69fab
refactor: reorganize Catalogs handlers to match Users module structure
Nov 18, 2025
91d7803
docs: atualizar documentação dos módulos Catalogs e Location
Nov 18, 2025
bff62bd
style: aplicar dotnet format e corrigir imports dos Commands
Nov 19, 2025
60f3532
fix: adicionar validações Guid.Empty e corrigir documentação/testes
Nov 19, 2025
3fb3473
mais review
Nov 19, 2025
704c688
niitpicksom
Nov 19, 2025
2c26120
refactor: improve repository consistency and builder pattern
Nov 19, 2025
e51cb44
refactor: improve markdown formatting and test assertions
Nov 19, 2025
ccc633a
refactor: use nullable int for ServiceBuilder._displayOrder
Nov 19, 2025
943cfc0
refactor: add defensive length limits and improve test coverage
Nov 19, 2025
8cc6d40
style: fix whitespace formatting issues
Nov 19, 2025
231c608
test: strengthen E2E test assertions and improve determinism
Nov 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 94 additions & 1 deletion MeAjudaAi.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18
VisualStudioVersion = 18.0.11205.157 d18.0
VisualStudioVersion = 18.0.11205.157
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
EndProject
Expand Down Expand Up @@ -145,6 +145,28 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{4726175B
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeAjudaAi.Modules.Search.Tests", "src\Modules\Search\Tests\MeAjudaAi.Modules.Search.Tests.csproj", "{C7F6B6F4-4F9C-C844-500C-87E3802A6C4B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Catalogs", "Catalogs", "{8B551008-B254-EBAF-1B6D-AB7C420234EA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Domain", "Domain", "{B346CC0B-427A-E442-6F5D-8AAE1AB081D6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeAjudaAi.Modules.Catalogs.Domain", "src\Modules\Catalogs\Domain\MeAjudaAi.Modules.Catalogs.Domain.csproj", "{DC1D1ACD-A21E-4BA0-A22D-77450234BD2A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Application", "Application", "{1510B873-F5F8-8A20-05CA-B70BA1F93C8F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeAjudaAi.Modules.Catalogs.Application", "src\Modules\Catalogs\Application\MeAjudaAi.Modules.Catalogs.Application.csproj", "{44577491-2FC0-4F52-AF5C-2BC9B323CDB7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{8D23D6D3-2B2E-7F09-866F-FA51CC0FC081}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeAjudaAi.Modules.Catalogs.Infrastructure", "src\Modules\Catalogs\Infrastructure\MeAjudaAi.Modules.Catalogs.Infrastructure.csproj", "{3B6D6C13-1E04-47B9-B44E-36D25DF913C7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "API", "API", "{A63FE417-CEAA-2A64-637A-6EABC61CE16D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeAjudaAi.Modules.Catalogs.API", "src\Modules\Catalogs\API\MeAjudaAi.Modules.Catalogs.API.csproj", "{30A2D3C4-AF98-40A1-AA90-ED7C5FE090F8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{BDD25844-1435-F5BA-1F9B-EFB3B12C916F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeAjudaAi.Modules.Catalogs.Tests", "src\Modules\Catalogs\Tests\MeAjudaAi.Modules.Catalogs.Tests.csproj", "{2C85E336-66A2-4B4F-845A-DBA2A6520162}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -551,6 +573,66 @@ Global
{C7F6B6F4-4F9C-C844-500C-87E3802A6C4B}.Release|x64.Build.0 = Release|Any CPU
{C7F6B6F4-4F9C-C844-500C-87E3802A6C4B}.Release|x86.ActiveCfg = Release|Any CPU
{C7F6B6F4-4F9C-C844-500C-87E3802A6C4B}.Release|x86.Build.0 = Release|Any CPU
{DC1D1ACD-A21E-4BA0-A22D-77450234BD2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC1D1ACD-A21E-4BA0-A22D-77450234BD2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC1D1ACD-A21E-4BA0-A22D-77450234BD2A}.Debug|x64.ActiveCfg = Debug|Any CPU
{DC1D1ACD-A21E-4BA0-A22D-77450234BD2A}.Debug|x64.Build.0 = Debug|Any CPU
{DC1D1ACD-A21E-4BA0-A22D-77450234BD2A}.Debug|x86.ActiveCfg = Debug|Any CPU
{DC1D1ACD-A21E-4BA0-A22D-77450234BD2A}.Debug|x86.Build.0 = Debug|Any CPU
{DC1D1ACD-A21E-4BA0-A22D-77450234BD2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC1D1ACD-A21E-4BA0-A22D-77450234BD2A}.Release|Any CPU.Build.0 = Release|Any CPU
{DC1D1ACD-A21E-4BA0-A22D-77450234BD2A}.Release|x64.ActiveCfg = Release|Any CPU
{DC1D1ACD-A21E-4BA0-A22D-77450234BD2A}.Release|x64.Build.0 = Release|Any CPU
{DC1D1ACD-A21E-4BA0-A22D-77450234BD2A}.Release|x86.ActiveCfg = Release|Any CPU
{DC1D1ACD-A21E-4BA0-A22D-77450234BD2A}.Release|x86.Build.0 = Release|Any CPU
{44577491-2FC0-4F52-AF5C-2BC9B323CDB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{44577491-2FC0-4F52-AF5C-2BC9B323CDB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{44577491-2FC0-4F52-AF5C-2BC9B323CDB7}.Debug|x64.ActiveCfg = Debug|Any CPU
{44577491-2FC0-4F52-AF5C-2BC9B323CDB7}.Debug|x64.Build.0 = Debug|Any CPU
{44577491-2FC0-4F52-AF5C-2BC9B323CDB7}.Debug|x86.ActiveCfg = Debug|Any CPU
{44577491-2FC0-4F52-AF5C-2BC9B323CDB7}.Debug|x86.Build.0 = Debug|Any CPU
{44577491-2FC0-4F52-AF5C-2BC9B323CDB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44577491-2FC0-4F52-AF5C-2BC9B323CDB7}.Release|Any CPU.Build.0 = Release|Any CPU
{44577491-2FC0-4F52-AF5C-2BC9B323CDB7}.Release|x64.ActiveCfg = Release|Any CPU
{44577491-2FC0-4F52-AF5C-2BC9B323CDB7}.Release|x64.Build.0 = Release|Any CPU
{44577491-2FC0-4F52-AF5C-2BC9B323CDB7}.Release|x86.ActiveCfg = Release|Any CPU
{44577491-2FC0-4F52-AF5C-2BC9B323CDB7}.Release|x86.Build.0 = Release|Any CPU
{3B6D6C13-1E04-47B9-B44E-36D25DF913C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B6D6C13-1E04-47B9-B44E-36D25DF913C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B6D6C13-1E04-47B9-B44E-36D25DF913C7}.Debug|x64.ActiveCfg = Debug|Any CPU
{3B6D6C13-1E04-47B9-B44E-36D25DF913C7}.Debug|x64.Build.0 = Debug|Any CPU
{3B6D6C13-1E04-47B9-B44E-36D25DF913C7}.Debug|x86.ActiveCfg = Debug|Any CPU
{3B6D6C13-1E04-47B9-B44E-36D25DF913C7}.Debug|x86.Build.0 = Debug|Any CPU
{3B6D6C13-1E04-47B9-B44E-36D25DF913C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B6D6C13-1E04-47B9-B44E-36D25DF913C7}.Release|Any CPU.Build.0 = Release|Any CPU
{3B6D6C13-1E04-47B9-B44E-36D25DF913C7}.Release|x64.ActiveCfg = Release|Any CPU
{3B6D6C13-1E04-47B9-B44E-36D25DF913C7}.Release|x64.Build.0 = Release|Any CPU
{3B6D6C13-1E04-47B9-B44E-36D25DF913C7}.Release|x86.ActiveCfg = Release|Any CPU
{3B6D6C13-1E04-47B9-B44E-36D25DF913C7}.Release|x86.Build.0 = Release|Any CPU
{30A2D3C4-AF98-40A1-AA90-ED7C5FE090F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30A2D3C4-AF98-40A1-AA90-ED7C5FE090F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30A2D3C4-AF98-40A1-AA90-ED7C5FE090F8}.Debug|x64.ActiveCfg = Debug|Any CPU
{30A2D3C4-AF98-40A1-AA90-ED7C5FE090F8}.Debug|x64.Build.0 = Debug|Any CPU
{30A2D3C4-AF98-40A1-AA90-ED7C5FE090F8}.Debug|x86.ActiveCfg = Debug|Any CPU
{30A2D3C4-AF98-40A1-AA90-ED7C5FE090F8}.Debug|x86.Build.0 = Debug|Any CPU
{30A2D3C4-AF98-40A1-AA90-ED7C5FE090F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30A2D3C4-AF98-40A1-AA90-ED7C5FE090F8}.Release|Any CPU.Build.0 = Release|Any CPU
{30A2D3C4-AF98-40A1-AA90-ED7C5FE090F8}.Release|x64.ActiveCfg = Release|Any CPU
{30A2D3C4-AF98-40A1-AA90-ED7C5FE090F8}.Release|x64.Build.0 = Release|Any CPU
{30A2D3C4-AF98-40A1-AA90-ED7C5FE090F8}.Release|x86.ActiveCfg = Release|Any CPU
{30A2D3C4-AF98-40A1-AA90-ED7C5FE090F8}.Release|x86.Build.0 = Release|Any CPU
{2C85E336-66A2-4B4F-845A-DBA2A6520162}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2C85E336-66A2-4B4F-845A-DBA2A6520162}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C85E336-66A2-4B4F-845A-DBA2A6520162}.Debug|x64.ActiveCfg = Debug|Any CPU
{2C85E336-66A2-4B4F-845A-DBA2A6520162}.Debug|x64.Build.0 = Debug|Any CPU
{2C85E336-66A2-4B4F-845A-DBA2A6520162}.Debug|x86.ActiveCfg = Debug|Any CPU
{2C85E336-66A2-4B4F-845A-DBA2A6520162}.Debug|x86.Build.0 = Debug|Any CPU
{2C85E336-66A2-4B4F-845A-DBA2A6520162}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C85E336-66A2-4B4F-845A-DBA2A6520162}.Release|Any CPU.Build.0 = Release|Any CPU
{2C85E336-66A2-4B4F-845A-DBA2A6520162}.Release|x64.ActiveCfg = Release|Any CPU
{2C85E336-66A2-4B4F-845A-DBA2A6520162}.Release|x64.Build.0 = Release|Any CPU
{2C85E336-66A2-4B4F-845A-DBA2A6520162}.Release|x86.ActiveCfg = Release|Any CPU
{2C85E336-66A2-4B4F-845A-DBA2A6520162}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -622,6 +704,17 @@ Global
{0A64D976-2B75-C6F2-9C87-3A780C963FA3} = {9BC7D786-47F5-44BB-88A1-DDEB0022FF23}
{4726175B-331E-49FA-A49A-EE5AC30B495A} = {6FF68FBA-C4AF-48EC-AFE2-E320F2195C79}
{C7F6B6F4-4F9C-C844-500C-87E3802A6C4B} = {4726175B-331E-49FA-A49A-EE5AC30B495A}
{8B551008-B254-EBAF-1B6D-AB7C420234EA} = {D55DFAF4-45A1-4C45-AA54-8CE46F0AFB1F}
{B346CC0B-427A-E442-6F5D-8AAE1AB081D6} = {8B551008-B254-EBAF-1B6D-AB7C420234EA}
{DC1D1ACD-A21E-4BA0-A22D-77450234BD2A} = {B346CC0B-427A-E442-6F5D-8AAE1AB081D6}
{1510B873-F5F8-8A20-05CA-B70BA1F93C8F} = {8B551008-B254-EBAF-1B6D-AB7C420234EA}
{44577491-2FC0-4F52-AF5C-2BC9B323CDB7} = {1510B873-F5F8-8A20-05CA-B70BA1F93C8F}
{8D23D6D3-2B2E-7F09-866F-FA51CC0FC081} = {8B551008-B254-EBAF-1B6D-AB7C420234EA}
{3B6D6C13-1E04-47B9-B44E-36D25DF913C7} = {8D23D6D3-2B2E-7F09-866F-FA51CC0FC081}
{A63FE417-CEAA-2A64-637A-6EABC61CE16D} = {8B551008-B254-EBAF-1B6D-AB7C420234EA}
{30A2D3C4-AF98-40A1-AA90-ED7C5FE090F8} = {A63FE417-CEAA-2A64-637A-6EABC61CE16D}
{BDD25844-1435-F5BA-1F9B-EFB3B12C916F} = {8B551008-B254-EBAF-1B6D-AB7C420234EA}
{2C85E336-66A2-4B4F-845A-DBA2A6520162} = {BDD25844-1435-F5BA-1F9B-EFB3B12C916F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {391B5342-8EC5-4DF0-BCDA-6D73F87E8751}
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ The test scripts verify:

✅ All module schemas created correctly:
- `users`, `providers`, `documents`
- `search`, `location`
- `search`, `location`, `catalogs`
- `hangfire`, `meajudaai_app`

✅ All database roles created:
Expand Down
4 changes: 4 additions & 0 deletions infrastructure/database/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ database/
│ ├── location/ # Location module (CEP lookup and geocoding)
│ │ ├── 00-roles.sql # Database roles for location module
│ │ └── 01-permissions.sql # Permissions setup for location module
│ └── catalogs/ # Service Catalog module (admin-managed)
│ ├── 00-roles.sql # Database roles for catalogs module
│ └── 01-permissions.sql # Permissions setup for catalogs module
└── views/ # Cross-module database views
└── cross-module-views.sql # Views that span multiple modules (includes document status views)
```
Expand Down Expand Up @@ -70,6 +73,7 @@ The database initialization creates the following schemas:
| `documents` | Documents | Document upload, verification, and storage metadata |
| `search` | Search & Discovery | Geospatial provider search with PostGIS |
| `location` | Location | CEP lookup, address validation, and geocoding |
| `catalogs` | Service Catalog | Admin-managed service categories and services |
| `hangfire` | Background Jobs | Hangfire job queue and execution tracking |
| `meajudaai_app` | Shared | Cross-cutting application objects |

Expand Down
55 changes: 55 additions & 0 deletions infrastructure/database/modules/catalogs/00-roles.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
-- Catalogs Module - Database Roles
-- Create dedicated role for catalogs module (NOLOGIN role for permission grouping)

-- Create catalogs module role if it doesn't exist (NOLOGIN, no password in DDL)
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_catalog.pg_roles WHERE rolname = 'catalogs_role') THEN
CREATE ROLE catalogs_role NOLOGIN INHERIT;
END IF;
END;
$$ LANGUAGE plpgsql;

-- Create catalogs module owner role if it doesn't exist
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_catalog.pg_roles WHERE rolname = 'catalogs_owner') THEN
CREATE ROLE catalogs_owner NOLOGIN INHERIT;
END IF;
END;
$$ LANGUAGE plpgsql;

-- Grant catalogs role to app role for cross-module access (idempotent)
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM pg_auth_members m
JOIN pg_roles r1 ON m.roleid = r1.oid
JOIN pg_roles r2 ON m.member = r2.oid
WHERE r1.rolname = 'catalogs_role' AND r2.rolname = 'meajudaai_app_role'
) THEN
GRANT catalogs_role TO meajudaai_app_role;
END IF;
END;
$$ LANGUAGE plpgsql;

-- Grant catalogs_owner to app_owner (for schema management)
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM pg_auth_members m
JOIN pg_roles r1 ON m.roleid = r1.oid
JOIN pg_roles r2 ON m.member = r2.oid
WHERE r1.rolname = 'catalogs_owner' AND r2.rolname = 'meajudaai_app_owner'
) THEN
GRANT catalogs_owner TO meajudaai_app_owner;
END IF;
END;
$$ LANGUAGE plpgsql;

-- NOTE: Actual LOGIN users with passwords should be created in environment-specific
-- migrations that read passwords from secure session GUCs or configuration, not in versioned DDL.

-- Document roles
COMMENT ON ROLE catalogs_role IS 'Permission grouping role for catalogs schema';
COMMENT ON ROLE catalogs_owner IS 'Owner role for catalogs schema objects';
39 changes: 39 additions & 0 deletions infrastructure/database/modules/catalogs/01-permissions.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
-- Catalogs Module - Permissions
-- Grant permissions for catalogs module (service catalog management)

-- Create catalogs schema if it doesn't exist
CREATE SCHEMA IF NOT EXISTS catalogs;

-- Set explicit schema ownership
ALTER SCHEMA catalogs OWNER TO catalogs_owner;

GRANT USAGE ON SCHEMA catalogs TO catalogs_role;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA catalogs TO catalogs_role;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA catalogs TO catalogs_role;

-- Set default privileges for future tables and sequences created by catalogs_owner
ALTER DEFAULT PRIVILEGES FOR ROLE catalogs_owner IN SCHEMA catalogs GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO catalogs_role;
ALTER DEFAULT PRIVILEGES FOR ROLE catalogs_owner IN SCHEMA catalogs GRANT USAGE, SELECT ON SEQUENCES TO catalogs_role;

-- Set default search path for catalogs_role
ALTER ROLE catalogs_role SET search_path = catalogs, public;

-- Grant cross-schema permissions to app role
GRANT USAGE ON SCHEMA catalogs TO meajudaai_app_role;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA catalogs TO meajudaai_app_role;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA catalogs TO meajudaai_app_role;

-- Set default privileges for app role on objects created by catalogs_owner
ALTER DEFAULT PRIVILEGES FOR ROLE catalogs_owner IN SCHEMA catalogs GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO meajudaai_app_role;
ALTER DEFAULT PRIVILEGES FOR ROLE catalogs_owner IN SCHEMA catalogs GRANT USAGE, SELECT ON SEQUENCES TO meajudaai_app_role;

-- Grant read-only access to providers schema (for future ProviderServices integration)
GRANT USAGE ON SCHEMA providers TO catalogs_role;
GRANT SELECT ON ALL TABLES IN SCHEMA providers TO catalogs_role;

-- Grant read-only access to search schema (for denormalization of services)
GRANT USAGE ON SCHEMA search TO catalogs_role;
GRANT SELECT ON ALL TABLES IN SCHEMA search TO catalogs_role;

-- Document schema purpose
COMMENT ON SCHEMA catalogs IS 'Service Catalog module - Admin-managed service categories and services';
3 changes: 2 additions & 1 deletion infrastructure/test-database-init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ try {

# Test schemas
$hasErrors = $false
$schemas = @("users", "providers", "documents", "search", "location", "hangfire", "meajudaai_app")
$schemas = @("users", "providers", "documents", "search", "location", "catalogs", "hangfire", "meajudaai_app")

foreach ($schema in $schemas) {
$query = "SELECT EXISTS(SELECT 1 FROM information_schema.schemata WHERE schema_name = '$schema');"
Expand All @@ -101,6 +101,7 @@ try {
"documents_role", "documents_owner",
"search_role", "search_owner",
"location_role", "location_owner",
"catalogs_role", "catalogs_owner",
"hangfire_role",
"meajudaai_app_role", "meajudaai_app_owner"
)
Expand Down
3 changes: 2 additions & 1 deletion infrastructure/test-database-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ echo "🔍 Verifying database schemas..."
has_errors=false

# Test schemas
SCHEMAS=("users" "providers" "documents" "search" "location" "hangfire" "meajudaai_app")
SCHEMAS=("users" "providers" "documents" "search" "location" "catalogs" "hangfire" "meajudaai_app")

for schema in "${SCHEMAS[@]}"; do
# Use double-dollar quoting to safely handle identifiers
Expand All @@ -99,6 +99,7 @@ ROLES=(
"documents_role" "documents_owner"
"search_role" "search_owner"
"location_role" "location_owner"
"catalogs_role" "catalogs_owner"
"hangfire_role"
"meajudaai_app_role" "meajudaai_app_owner"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

<ItemGroup>
<ProjectReference Include="..\..\Aspire\MeAjudaAi.ServiceDefaults\MeAjudaAi.ServiceDefaults.csproj" />
<ProjectReference Include="..\..\Modules\Catalogs\API\MeAjudaAi.Modules.Catalogs.API.csproj" />
<ProjectReference Include="..\..\Modules\Documents\API\MeAjudaAi.Modules.Documents.API.csproj" />
<ProjectReference Include="..\..\Modules\Location\Infrastructure\MeAjudaAi.Modules.Location.Infrastructure.csproj" />
<ProjectReference Include="..\..\Modules\Providers\API\MeAjudaAi.Modules.Providers.API.csproj" />
Expand Down
3 changes: 3 additions & 0 deletions src/Bootstrapper/MeAjudaAi.ApiService/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Diagnostics;
using MeAjudaAi.ApiService.Extensions;
using MeAjudaAi.Modules.Catalogs.API;
using MeAjudaAi.Modules.Documents.API;
using MeAjudaAi.Modules.Location.Infrastructure;
using MeAjudaAi.Modules.Providers.API;
Expand Down Expand Up @@ -33,6 +34,7 @@ public static async Task Main(string[] args)
builder.Services.AddDocumentsModule(builder.Configuration);
builder.Services.AddSearchModule(builder.Configuration);
builder.Services.AddLocationModule(builder.Configuration);
builder.Services.AddCatalogsModule(builder.Configuration);

var app = builder.Build();

Expand Down Expand Up @@ -106,6 +108,7 @@ private static async Task ConfigureMiddlewareAsync(WebApplication app)
app.UseDocumentsModule();
app.UseSearchModule();
app.UseLocationModule();
app.UseCatalogsModule();
}

private static void LogStartupComplete(WebApplication app)
Expand Down
42 changes: 42 additions & 0 deletions src/Modules/Catalogs/API/Endpoints/CatalogsModuleEndpoints.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using MeAjudaAi.Shared.Endpoints;
using Microsoft.AspNetCore.Builder;

namespace MeAjudaAi.Modules.Catalogs.API.Endpoints;

/// <summary>
/// Classe responsável pelo mapeamento de todos os endpoints do módulo Catalogs.
/// </summary>
public static class CatalogsModuleEndpoints
{
/// <summary>
/// Mapeia todos os endpoints do módulo Catalogs.
/// </summary>
/// <param name="app">Aplicação web para configuração das rotas</param>
public static void MapCatalogsEndpoints(this WebApplication app)
{
// Service Categories endpoints
var categoriesEndpoints = BaseEndpoint.CreateVersionedGroup(app, "catalogs/categories", "ServiceCategories");

categoriesEndpoints.MapEndpoint<GetAllServiceCategoriesEndpoint>()
.MapEndpoint<GetServiceCategoryByIdEndpoint>()
.MapEndpoint<CreateServiceCategoryEndpoint>()
.MapEndpoint<UpdateServiceCategoryEndpoint>()
.MapEndpoint<ActivateServiceCategoryEndpoint>()
.MapEndpoint<DeactivateServiceCategoryEndpoint>()
.MapEndpoint<DeleteServiceCategoryEndpoint>();

// Services endpoints
var servicesEndpoints = BaseEndpoint.CreateVersionedGroup(app, "catalogs/services", "Services");

servicesEndpoints.MapEndpoint<GetAllServicesEndpoint>()
.MapEndpoint<GetServiceByIdEndpoint>()
.MapEndpoint<GetServicesByCategoryEndpoint>()
.MapEndpoint<CreateServiceEndpoint>()
.MapEndpoint<UpdateServiceEndpoint>()
.MapEndpoint<ChangeServiceCategoryEndpoint>()
.MapEndpoint<ActivateServiceEndpoint>()
.MapEndpoint<DeactivateServiceEndpoint>()
.MapEndpoint<DeleteServiceEndpoint>()
.MapEndpoint<ValidateServicesEndpoint>();
}
}
Loading