Make description param optional on create roles

This commit is contained in:
Konstantinos Triantafyllou 2021-07-20 16:25:30 +03:00
parent c5331d5934
commit 8d5e21f3a2
2 changed files with 2 additions and 2 deletions

View File

@ -39,7 +39,7 @@ public class CuratorController {
* Create a new Curator role (only for admins)
*/
@RequestMapping(value = "/{type}/create", method = RequestMethod.POST)
public ResponseEntity<Response> createRole(@PathVariable("type") String type, @RequestParam("description") String description) {
public ResponseEntity<Response> createRole(@PathVariable("type") String type, @RequestParam(value = "description", required = false) String description) {
if (registryService.getCouId(AuthoritiesUtils.curatorRole(type).toLowerCase()) == null) {
if (registryService.createRole(AuthoritiesUtils.curatorRole(type), description != null ? description : "") != null) {
return ResponseEntity.ok(new Response("Role has been created successfully"));

View File

@ -40,7 +40,7 @@ public class MemberController {
*/
@RequestMapping(value = "/{type}/{id}/create", method = RequestMethod.POST)
public ResponseEntity<Response> createGroup(@PathVariable("type") String type, @PathVariable("id") String id,
@RequestParam("description") String description) {
@RequestParam(value = "description", required = false) String description) {
if (registryService.getCouId(AuthoritiesUtils.memberRole(type, id)) == null) {
if (registryService.createRole(AuthoritiesUtils.memberRole(type, id), description != null ? description : "") != null) {
return ResponseEntity.ok(new Response("Role has been created successfully"));