Skip to content

Commit 1f3fd2f

Browse files
committed
(TP-123) feat: add securityRequirement for getReservations()
1 parent 431ae05 commit 1f3fd2f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

rentplace/src/main/java/kattsyn/dev/rentplace/controllers/ReservationController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public class ReservationController {
3939
@ApiResponse(responseCode = "200", description = "Успешно", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ReservationDTO[].class))),
4040
@ApiResponse(responseCode = "500", description = "Непредвиденная ошибка со стороны сервера", content = @Content)
4141
})
42+
@PreAuthorize("hasAuthority('ROLE_ADMIN')" )
43+
@SecurityRequirement(name = "JWT")
4244
@GetMapping("/")
4345
public ResponseEntity<List<ReservationDTO>> getReservations() {
4446
List<ReservationDTO> reservationDTOS = reservationService.findAllReservations();
@@ -72,7 +74,7 @@ public ResponseEntity<List<ReservationDTO>> getUserReservations(Authentication a
7274
@ApiResponse(responseCode = "422", description = "Ошибка валидации", content = @Content),
7375
@ApiResponse(responseCode = "500", description = "Непредвиденная ошибка со стороны сервера", content = @Content)
7476
})
75-
@PreAuthorize("hasAuthority('ROLE_ADMIN') or hasAuthority('ROLE_USER')" )
77+
@PreAuthorize("hasAuthority('ROLE_ADMIN')")
7678
@SecurityRequirement(name = "JWT")
7779
@GetMapping("/{id}")
7880
public ResponseEntity<ReservationDTO> getReservation(@PathVariable
@@ -114,7 +116,6 @@ public ResponseEntity<ReservationDTO> createReservation(@Valid @ModelAttribute R
114116
})
115117
@PreAuthorize("hasAuthority('ROLE_ADMIN') or hasAuthority('ROLE_USER')" )
116118
@SecurityRequirement(name = "JWT")
117-
@SecurityRequirement(name = "JWT")
118119
@PatchMapping(path = "/{id}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
119120
public ResponseEntity<ReservationDTO> updateReservation(@PathVariable @Parameter(description = "id бронирования для изменения") long id,
120121
@Valid @ModelAttribute ReservationCreateEditDTO reservationCreateEditDTO) {
@@ -133,7 +134,6 @@ public ResponseEntity<ReservationDTO> updateReservation(@PathVariable @Parameter
133134
})
134135
@PreAuthorize("hasAuthority('ROLE_ADMIN') or hasAuthority('ROLE_USER')" )
135136
@SecurityRequirement(name = "JWT")
136-
@SecurityRequirement(name = "JWT")
137137
public ResponseEntity<ReservationDTO> deleteReservation(
138138
@PathVariable
139139
@Valid @Parameter(description = "id бронирования", example = "1") long id,

0 commit comments

Comments
 (0)