Class InstitutionController


  • @RestController
    @RequestMapping("/institutions")
    public class InstitutionController
    extends Object
    Class represents rest controller which is responsible for institution operations
    • Constructor Detail

      • InstitutionController

        public InstitutionController()
    • Method Detail

      • getInstitutions

        @GetMapping
        public List<InstitutionVM> getInstitutions()
        Gets all registered institutions
        Returns:
        all institutions
      • getInstitutionsOrdered

        @GetMapping("/ordered")
        public List<InstitutionVM> getInstitutionsOrdered​(@Valid @RequestBody
                                                          @Valid CoordinatesVM coordinates)
        Gets all institutions ordered relative to given coordinates
        Parameters:
        coordinates - coordinates
        Returns:
        ordered institutions
      • saveInstitution

        @PostMapping("/myInstitution")
        @ResponseStatus(CREATED)
        public GenericResponse saveInstitution​(@Valid @RequestBody
                                               @Valid Institution institution,
                                               User user)
        Saves new institution with logged in user as a manager
        Parameters:
        institution - new institution
        user - logged in user
        Returns:
        message containing whether operation was processed
      • getAllowedLanguages

        @GetMapping("/myInstitution/languages")
        public AllowedLanguagesVM getAllowedLanguages​(User user)
        Gets the chosen and possible languages of logged in user's institution
        Parameters:
        user - logged in user
        Returns:
        chosen and possible languages
      • addLanguage

        @PostMapping("/myInstitution/languages/{languageId}")
        public GenericResponse addLanguage​(@PathVariable
                                           Long languageId,
                                           User user)
        Adds language to logged in user's institution
        Parameters:
        languageId - id of language to add
        user - logged in user
        Returns:
        message containing whether operation was processed
      • updateImage

        @PutMapping("/myInstitution/updateImage")
        public GenericResponse updateImage​(@Valid @RequestBody
                                           @Valid ImageVM imageVM,
                                           User user)
        Updates institution image
        Parameters:
        imageVM - Encoded image
        user - logged in user
        Returns:
        new image name
      • updateInstitution

        @PutMapping("/myInstitution")
        public GenericResponse updateInstitution​(@Valid @RequestBody
                                                 @Valid UpdateInstitutionVM updateInstitutionVM,
                                                 User user)
        Updates institution information
        Parameters:
        updateInstitutionVM - updated institution
        user - logged in user
        Returns:
        message containing whether operation was processed
      • getMyInstitution

        @GetMapping("/myInstitution")
        public InstitutionVM getMyInstitution​(User user)
        Gets an institution of current user
        Parameters:
        user - logged in user
        Returns:
        user's institution
      • addInstitutionManager

        @PostMapping("/myInstitution/addManager")
        public GenericResponse addInstitutionManager​(@Valid @RequestBody
                                                     @Valid EmailVM emailVM,
                                                     User user)
        Adds new institution manager by sending credentials of a new manager account to given email
        Parameters:
        emailVM - email of a new manager
        user - logged in user
        Returns:
        message containing whether operation was processed
      • deleteMyInstitution

        @DeleteMapping("/myInstitution")
        public GenericResponse deleteMyInstitution​(User user)
        Deletes institution of logged in user
        Parameters:
        user - logged in user
        Returns:
        message containing whether operation was processed