From ab72e6568172e4b2942e44e601a0485dc716f363 Mon Sep 17 00:00:00 2001 From: Fiorella Date: Sun, 26 Mar 2023 18:25:36 +0200 Subject: [PATCH 1/2] Update .DS_Store Update --- .DS_Store | Bin 6148 -> 6148 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/.DS_Store b/.DS_Store index 802b73a98f1a8dbd119ea894e60797ff377cc6b8..9f092fd59265503f6ff23334234c457122aa4eb1 100644 GIT binary patch delta 82 zcmZoMXfc=|#>CJ*u~2NHo}wrd0|Nsi1A_nqgC9dMgR5swesWUI#6tDS1|lq*tC)LP mHh*A#&9s@FgP#MaY4bzo@640=MGP4kCfo2xZ;laJ!3+Rdjuq+v delta 465 zcmZoMXfc=|#>B)qu~2NHo}w^20|Nsi1A_nqgMnvGesWSye$vK|D;euS;;amA42cZI z45U}muGhB?iqFo;&CBlwIu8gKfq?`DyigiO^#B=&fHEu#F3QWv&r1i2f^;Bc zj8FrHQ5GnR95Cz*J`A1=&J3;$ehk438|T)uY-Z=+=K#jk#*g2bC-aLK3V;l30Ae5w LcFpDhkuA&sb-{Er From d93ac92e98b93e9da6179dd376d089f7aad0a2a6 Mon Sep 17 00:00:00 2001 From: Fiorella Date: Sun, 26 Mar 2023 18:57:27 +0200 Subject: [PATCH 2/2] Add documentation --- .../restController/AssoRestController.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/AplicacionWEB/backend/asociationPlatform/src/main/java/com/urjc/asociationPlatform/controller/restController/AssoRestController.java b/AplicacionWEB/backend/asociationPlatform/src/main/java/com/urjc/asociationPlatform/controller/restController/AssoRestController.java index 38cbbf1..490e660 100644 --- a/AplicacionWEB/backend/asociationPlatform/src/main/java/com/urjc/asociationPlatform/controller/restController/AssoRestController.java +++ b/AplicacionWEB/backend/asociationPlatform/src/main/java/com/urjc/asociationPlatform/controller/restController/AssoRestController.java @@ -18,6 +18,13 @@ import com.urjc.asociationPlatform.model.User; import com.urjc.asociationPlatform.service.AsociationService; import com.urjc.asociationPlatform.service.UserService; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; + import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -47,6 +54,14 @@ private User getUser(HttpServletRequest request) { return null; } + + @Operation(summary = "Get personal Association") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Association obtained sucessfully",content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Asociation.class))}), + @ApiResponse(responseCode = "404", description = "comment not found", content = @Content) + + }) @GetMapping("/miAsociacion") public ResponseEntity getMyAsso(HttpServletRequest request) { User currentUser = checkAdminOrAsso("ASO", request); @@ -61,6 +76,13 @@ public ResponseEntity getMyAsso(HttpServletRequest request) { return new ResponseEntity<>(asso.get(), HttpStatus.OK); } + @Operation(summary = "Get Association by id") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Association obtained sucessfully",content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Asociation.class))}), + @ApiResponse(responseCode = "404", description = "Association not found", content = @Content) + + }) @GetMapping("/{id}") public ResponseEntity getById(@PathVariable long id) { Optional asso = assoService.findById(id); @@ -70,21 +92,53 @@ public ResponseEntity getById(@PathVariable long id) { return new ResponseEntity<>(asso.get(), HttpStatus.OK); } + @Operation(summary = "Get Association list") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Association list obtained sucessfully",content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Asociation.class))}) + + }) @GetMapping("/asociationsList") public ResponseEntity> ListAsso() { return new ResponseEntity<>(assoService.findAll(), HttpStatus.OK); } + @Operation(summary = "Edit personal association") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Association edited sucessfully",content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Asociation.class))}), + @ApiResponse(responseCode = "401", description = "current user doesn´t have the required permissions", content = @Content), + @ApiResponse(responseCode = "403", description = "these changes can´t be made", content = @Content), + @ApiResponse(responseCode = "404", description = "Asociation not found", content = @Content) + + }) @PutMapping("/miAsociacion") public ResponseEntity editMyAsso(@RequestBody Asociation asso, HttpServletRequest request) { return edditAssoAux("ASO", request, asso, null); } + @Operation(summary = "Edit association") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Association edited sucessfully",content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Asociation.class))}), + @ApiResponse(responseCode = "401", description = "current user doesn´t have the required permissions", content = @Content), + @ApiResponse(responseCode = "403", description = "these changes can´t be made", content = @Content), + @ApiResponse(responseCode = "404", description = "Asociation not found", content = @Content) + + }) @PutMapping("/{id}") public ResponseEntity editAsso(@RequestBody Asociation asso,@PathVariable long id, HttpServletRequest request) { return edditAssoAux("ADMIN", request, asso, id); } + @Operation(summary = "Delete Association") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Association deleted sucessfully",content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Asociation.class))}), + @ApiResponse(responseCode = "401", description = "current user doesn´t have the required permissions", content = @Content), + @ApiResponse(responseCode = "404", description = "Association not found", content = @Content) + + }) @DeleteMapping("/{id}") public ResponseEntity deleteAsso(@PathVariable long id, HttpServletRequest request) { if (checkAdminOrAsso("ADMIN", request) == null)