Class InstitutionController
- java.lang.Object
-
- cz.zcu.students.cacha.bp_server.controllers.InstitutionController
-
@RestController @RequestMapping("/institutions") public class InstitutionController extends Object
Class represents rest controller which is responsible for institution operations
-
-
Constructor Summary
Constructors Constructor Description InstitutionController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GenericResponse
addInstitutionManager(@Valid EmailVM emailVM, User user)
Adds new institution manager by sending credentials of a new manager account to given emailGenericResponse
addLanguage(Long languageId, User user)
Adds language to logged in user's institutionGenericResponse
deleteMyInstitution(User user)
Deletes institution of logged in userAllowedLanguagesVM
getAllowedLanguages(User user)
Gets the chosen and possible languages of logged in user's institutionList<InstitutionVM>
getInstitutions()
Gets all registered institutionsList<InstitutionVM>
getInstitutionsOrdered(@Valid CoordinatesVM coordinates)
Gets all institutions ordered relative to given coordinatesInstitutionVM
getMyInstitution(User user)
Gets an institution of current userGenericResponse
saveInstitution(@Valid Institution institution, User user)
Saves new institution with logged in user as a managerGenericResponse
updateImage(@Valid ImageVM imageVM, User user)
Updates institution imageGenericResponse
updateInstitution(@Valid UpdateInstitutionVM updateInstitutionVM, User user)
Updates institution information
-
-
-
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 institutionuser
- 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 adduser
- 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 imageuser
- 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 institutionuser
- 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 manageruser
- 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
-
-