Skip to content

XufanLU/TUTUM-Module-Service

Repository files navigation

Module Service

This service offers a REST API designed to support the functionality of a module portal, where 'module' is referred to as 'course' in the user interface. By querying the API endpoint, users can retrieve comprehensive details about courses, including descriptions, prerequisites, and user comments.

Users have the ability to:

  • Search for modules using criteria such as module name, semester, and the range of ratings.
  • Post and modify comments on individual modules.
  • Rate modules based on their experience.
  • Suggest prerequisites for any given module

File Structure

  • src
    • main
      • java
        • de.tutum.moduleservice
          • configuration
            • Constants.java
            • GrpcConfiguration.java
          • controller
            • CommentController.java
            • ModuleController.java
            • RatingController.java
          • dto
            • filter
              • ModuleFilter.java
              • Specification.java
            • CommentDTO.java
            • ModuleInfoDTO.java
          • model
            • CommentEntity.java
            • ModuleEntity.java
            • PrerequisiteEntity.java
            • RatingEntity.java
            • UpDownEntity.java
          • repository
            • CommentRepository.java
            • ModuleRepository.java
            • PrerequisiteRepository.java
            • RatingRepository.java
            • UpDownRepository.java
          • service
            • AuthService.java
            • AuthServiceImpl.java
            • AuthServiceNoopImpl.java
            • CommentService.java
            • CommentServiceImpl.java
            • ModuleService.java
            • ModuleServiceImpl.java
            • RatingService.java
            • RatingServiceImpl.java
          • ModuleServiceApplication.java
      • resources
        • db.migration
          • V1__init.sql
        • application.yaml
        • application-test.yml -test
        • de.tutum.moduleservice.controller
          • CommentControllerTest
          • ModuleControllerTest
          • RatingControllerTest
        • resources
          • data.sql

Explanation for selected folders:

  • configuration folder:
    • Constants: A file that provides dummy values and constants used for testing module service and for interacting with auth services.
    • GrpcConfiguration: A Java configuration class that sets up a gRPC client for role management service.
  • controller folder :REST controllers, managing CRUD operations for modules and comments.
  • dto :
    • filter: A file that provides the specification needed to get modules based on the user's requirements(e.g. rating range, semester).
    • CommentDTO: A class that defines information from comments that would be transferred between services.
    • ModuleDTO: A class that defines information from modules that would be transferred between services.
  • model: Entities defined for module service.
  • repository: JpaRepository is used in data access layer implementation.
  • service:Implementation details of the business logic.
  • db.migration:
    • V1__init.sql: A file that defines the database Schema

Key points

  • Java + Gradle
  • Spring Boot 3.X
  • Flyway Migration
  • Exposes HTTP Endpoints (offers/ratings)
  • gRPC Client (communication with AuthSerice)

Permissions

This service uses the AuthSerice in order to manage permissions for the authorization by an external tool (can be deactivated via environmental variable AUTHSERVICE_ENABLE=false).

Warning

These endpoints are not secured against unauthorized usage by default!

Setup

The docker-compose.yaml includes a minimal setup For an extensive local setup check out the Deployment repository and execute setup-k3d.sh

API Doc

The api-docs.yaml file contains OpenAPI Doc.

GitLab integration

On commit to main a new version will be build and pushed to the internal container repository.

Versioning

  • default: the latest tag will be used
  • tagged commit: if a commit is tagged, the tag will be used as version in addition to the default behaviour

Template

The GitLab CI templates used are located in the CICD.Templates repository.

About

This service offers a REST API designed to support the functionality of a module portal. By querying the API endpoint, users can retrieve comprehensive details about courses, including descriptions, prerequisites, and user comments.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors