How jhousefsilva1/st_ms_persons works
Project type and purpose
• This is a Spring-Boot-based, monolithic backend microservice named SmartTolls_PersonsService.
• Its responsibilities are:
• User authentication/authorization (JWT-based)
• CRUD operations for Persons, PersonTypes, and Genders
• Integration with an external Country-City lookup service
File structure
• src/main/java/com/smart/tolls/…/Auth: all classes related to security (controllers, filters, JWT logic, token repository).
• src/main/java/com/smart/tolls/…/Controller: REST endpoints for domain resources.
• src/main/java/com/smart/tolls/…/Service: business logic.
• src/main/java/com/smart/tolls/…/Repository: Spring Data JPA interfaces.
• src/main/java/com/smart/tolls/…/Entity & Dto: persistence models vs. data-transfer objects
• src/main/java/com/smart/tolls/…/Client: CountryCityClient for external API calls
• src/main/resources/application.yml: configuration (DB, JWT secrets, external-service URL)
Key architectural patterns
• Layered (Controller → Service → Repository → Database)
• Spring Security filter chain with JwtAuthenticationFilter
• External API integration via a typed HTTP client
• Separation of concerns: Auth module vs. Domain module
Main components & relationships
[External User or System]
│ (1) HTTP(S) Request
▼
[JwtAuthenticationFilter] ── if authenticated ──►
│
▼
[Controller Layer]
• AuthController
• StPersonController
• StGenderController
• StPersonTypeController
│
▼
[Service Layer]
• AuthService & JwtService
• StPersonService
• StGenderService
• StPersonTypeService
│
├─ calls ──► [Repository Layer]
│ • StPersonRepository
│ • StGenderRepository
│ • StPersonTypeRepository
│ • TokenRepository
│
└─ invokes ──► [CountryCityClient] ──► [External Country/City API]
│
▼
[Database] (e.g., PostgreSQL, MySQL)