How unaluz/tp-integrador-back works
The project is a Kotlin-based backend application built with Spring Boot, designed as a base template for Algo3 course assignments. It leverages Gradle (with a Kotlin DSL build script) for dependency management and builds, and includes essential integrations such as JUnit 5 for testing, JaCoCo for code coverage, and Swagger for API documentation. The project follows a layered architecture pattern, clearly segmented into controllers, services, data access (repositories), and domain models.
Main Components
• Backend Server: Represented by the main application class (ProyectoApplication.kt) that initializes the Spring Boot server (running on port 9000).
• Controllers: Folder (src/main/kotlin/ar/edu/unsam/algo3/controller) containing REST controllers such as GenericController.kt. These handle incoming HTTP requests.
• Services: Folder (src/main/kotlin/ar/edu/unsam/algo3/service) containing service classes (e.g., ContenidoService.kt, DescargaService.kt, EncuestaService.kt) that implement the business logic.
• Data Access Layer/Repositories: Folder (src/main/kotlin/ar/edu/unsam/algo3/dao) with repository interfaces (e.g., ContenidoRepository.kt, DescargaRepository.kt, etc.), which are used to interact with the underlying database.
• Domain Models: Folder (src/main/kotlin/ar/edu/unsam/algo3/domain) with classes (e.g., Contenido.kt, Descarga.kt, Encuesta.kt, Usuario.kt) encapsulating business entities.
• Database Connection/Configuration: The file DBConnection.kt in the data package and configuration files under src/main/resources (application.yml) that hold DB and server settings.
• Utilities: For example, Logger.kt in the utils package.
• Testing Components: The structure in src/test mirrors the main package, providing integration and unit tests to ensure correctness.
Relationships and Interactions
• Controllers call corresponding Services to process the request.
• Services interact with Repositories (Data Access Objects) to perform CRUD operations, possibly leveraging DBConnection.
• The Domain models serve as data carriers between the layers.
• The configuration (application.yml) under resources is loaded at startup, tying components such as the database connection to the repositories.
• Swagger adds an additional layer for API documentation, which is integrated into the web layer.
Architectural Patterns and Design Principles
• Layered Architecture: Separate web (controller), service (business logic), data access, and domain layers.
• Dependency Injection (via Spring Boot): Components are injected into each other, ensuring loose coupling and easier testing.
• Integration of external tools: Swagger for endpoint documentation and JaCoCo for code coverage.
• Testing: Presence of integration and controller tests ensures a robust test-driven architecture.
Capturing Essential Architectural Elements
• That controllers are annotated for Swagger documentation.
• Unit and integration test flows (from the tests directory) as validation mechanisms for the main components.
• Mention Gradle and build configuration elements that ensure dependencies like Spring Boot, JUnit 5, etc.