Class PassportValidationController

java.lang.Object
com.markvarga21.studentmanager.controller.PassportValidationController

@RestController @RequestMapping("/api/v1/validations") @CrossOrigin public class PassportValidationController extends Object
A controller which is used to access validation (face and form) data.
  • Constructor Details

    • PassportValidationController

      public PassportValidationController()
  • Method Details

    • getAllPassportValidationData

      @GetMapping @PreAuthorize("hasRole(\'ROLE_ADMIN\')") public org.springframework.data.domain.Page<PassportValidationData> getAllPassportValidationData(@RequestParam(defaultValue="0") Integer page, @RequestParam(defaultValue="10") Integer size)
      Retrieves all the passport validation data.
      Parameters:
      page - The page number.
      size - The number of elements in a single page.
      Returns:
      A page containing passport validations.
    • deletePassportValidationData

      @DeleteMapping("/{passportNumber}") @PreAuthorize("hasRole(\'ROLE_ADMIN\')") public org.springframework.http.ResponseEntity<String> deletePassportValidationData(@PathVariable("passportNumber") String passportNumber)
      Deletes a passport validation data with the given ID.
      Parameters:
      passportNumber - The passport number of the student.
      Returns:
      A ResponseEntity object containing some feedback.
    • validatePassport

      @PostMapping("/validate") @PreAuthorize("hasRole(\'ROLE_ADMIN\')") public org.springframework.http.ResponseEntity<PassportValidationResponse> validatePassport(@RequestParam String studentJson, @RequestParam("passport") org.springframework.web.multipart.MultipartFile passport)
      Validates the data entered by the user against the data which can be found on the passport.
      Parameters:
      studentJson - The student itself.
      passport - The photo of the passport.
      Returns:
      A PassportValidationResponse object.
    • validatePassportManually

      @PostMapping("/validateManually") @PreAuthorize("hasRole(\'ROLE_ADMIN\')") public org.springframework.http.ResponseEntity<String> validatePassportManually(@RequestParam("studentId") Long studentId)
      Validates the passport manually.
      Parameters:
      studentId - The id of the student.
      Returns:
      A ResponseEntity containing some feedback.
    • isUserValid

      @GetMapping("/isUserValid/{passportNumber}") @PreAuthorize("hasRole(\'ROLE_USER\')") public org.springframework.http.ResponseEntity<Boolean> isUserValid(@PathVariable("passportNumber") String passportNumber)
      Checks whether the user is valid or not.
      Parameters:
      passportNumber - The passport number.
      Returns:
      A ResponseEntity containing some feedback.
    • createPassportValidationData

      @PostMapping @PreAuthorize("hasRole(\'ROLE_USER\')") public org.springframework.http.ResponseEntity<PassportValidationData> createPassportValidationData(@RequestBody PassportValidationData passportValidationData)
      Creates a new passport validation data.
      Parameters:
      passportValidationData - The passport validation data itself.
      Returns:
      The recently created passport validation data.
    • getPassportValidationByPassportNumber

      @GetMapping("/{passportNumber}") @PreAuthorize("hasRole(\'ROLE_ADMIN\')") public org.springframework.http.ResponseEntity<StudentDto> getPassportValidationByPassportNumber(@PathVariable("passportNumber") String passportNumber)
      Retrieves the StudentDto object from the validation data identified by the passport number.
      Parameters:
      passportNumber - The passport number of the student.
      Returns:
      The StudentDto object.