feat: 开放设备预约和我的预约相关接口给团队负责人和设备管理员

This commit is contained in:
BenjaminNH 2025-07-31 11:34:20 +08:00
parent 9a64513ec2
commit 2befbac54a
2 changed files with 4 additions and 4 deletions

View File

@ -30,7 +30,7 @@ public class DeviceController {
private final ReservationService reservationService; private final ReservationService reservationService;
@PreAuthorize("hasRole('USER')") @PreAuthorize("hasAnyRole('USER', 'LEADER', 'DEVICE_ADMIN')")
@GetMapping @GetMapping
public ResponseResult<Page<DeviceUserVO>> getUserDevices(@RequestParam(defaultValue = "1") Integer page, public ResponseResult<Page<DeviceUserVO>> getUserDevices(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size, @RequestParam(defaultValue = "10") Integer size,
@ -40,7 +40,7 @@ public class DeviceController {
return ResponseResult.success(res); return ResponseResult.success(res);
} }
@PreAuthorize("hasRole('USER')") @PreAuthorize("hasAnyRole('USER', 'LEADER', 'DEVICE_ADMIN')")
@GetMapping("/unavailable-times/{id}") @GetMapping("/unavailable-times/{id}")
public ResponseResult<List<TimeRangeVO>> getUnavailableTimes(@PathVariable Long id) { public ResponseResult<List<TimeRangeVO>> getUnavailableTimes(@PathVariable Long id) {
List<TimeRangeVO> res = reservationService.getUnavailableTimes(id); List<TimeRangeVO> res = reservationService.getUnavailableTimes(id);

View File

@ -29,14 +29,14 @@ public class ReservationController {
private final ReservationService reservationService; private final ReservationService reservationService;
@PreAuthorize("hasRole('USER')") @PreAuthorize("hasAnyRole('USER', 'LEADER', 'DEVICE_ADMIN')")
@PostMapping @PostMapping
public ResponseResult<?> addReservation(@RequestBody Reservation reservation) { public ResponseResult<?> addReservation(@RequestBody Reservation reservation) {
reservationService.addReservation(reservation); reservationService.addReservation(reservation);
return ResponseResult.success(); return ResponseResult.success();
} }
@PreAuthorize("hasRole('USER')") @PreAuthorize("hasAnyRole('USER', 'LEADER', 'DEVICE_ADMIN')")
@GetMapping("/{userId}") @GetMapping("/{userId}")
public ResponseResult<Page<UserReservationVO>> getUserReservation(@PathVariable("userId") Long userId, public ResponseResult<Page<UserReservationVO>> getUserReservation(@PathVariable("userId") Long userId,
@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "1") Integer page,