SystemInfoController.java

  1. package edu.ucsb.cs156.example.controllers;

  2. import edu.ucsb.cs156.example.models.SystemInfo;
  3. import edu.ucsb.cs156.example.services.SystemInfoService;
  4. import io.swagger.v3.oas.annotations.Operation;
  5. import io.swagger.v3.oas.annotations.tags.Tag;

  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.security.access.prepost.PreAuthorize;
  8. import org.springframework.web.bind.annotation.GetMapping;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RestController;

  11. /**
  12.  * This is a REST controller for getting information about the system.
  13.  *
  14.  * It allows frontend access to some of the global values set in the
  15.  * backend of the application, some of which are set by environment
  16.  * variables.
  17.  *
  18.  * For more information see the SystemInfoService and SystemInfo classes.
  19.  *
  20.  * @see edu.ucsb.cs156.example.services.SystemInfoService
  21.  * @see edu.ucsb.cs156.example.models.SystemInfo
  22.  */

  23. @Tag(name = "System Information")
  24. @RequestMapping("/api/systemInfo")
  25. @RestController
  26. public class SystemInfoController extends ApiController {

  27.     @Autowired
  28.     private SystemInfoService systemInfoService;

  29.     /**
  30.      * This method returns the system information.
  31.      * @return the system information
  32.      */

  33.     @Operation(summary = "Get global information about the application")
  34.     @GetMapping("")
  35.     public SystemInfo getSystemInfo() {
  36.         return systemInfoService.getSystemInfo();
  37.     }

  38. }