forked from Olympic/NTO-2025-Backend-TeamTask
124
This commit is contained in:
@@ -52,8 +52,8 @@ public class BookingController {
|
|||||||
@PostMapping("/{code}/book")
|
@PostMapping("/{code}/book")
|
||||||
public ResponseEntity<?> createBooking(
|
public ResponseEntity<?> createBooking(
|
||||||
@PathVariable String code,
|
@PathVariable String code,
|
||||||
@RequestParam Long placeId,
|
@RequestBody Long placeId,
|
||||||
@RequestParam String date
|
@RequestBody String date
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
if (placeId == null || date == null || date.isEmpty()) {
|
if (placeId == null || date == null || date.isEmpty()) {
|
||||||
|
|||||||
@@ -23,14 +23,14 @@ public class EmployeeController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private EmployeeService employeeService;
|
private EmployeeService employeeService;
|
||||||
@GetMapping("/{code}/auth")
|
@GetMapping("/{code}/auth")
|
||||||
public ResponseEntity<Void> checkAuth(
|
public ResponseEntity<String> checkAuth(
|
||||||
@PathVariable String code) {
|
@PathVariable String code) {
|
||||||
if (code==null){
|
if (code==null){
|
||||||
throw new IllegalArgumentException("Employee code is required");
|
throw new IllegalArgumentException("Employee code is required");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
employeeService.getEmployeeByCode(code);
|
employeeService.getEmployeeByCode(code);
|
||||||
return ResponseEntity.ok().build();
|
return ResponseEntity.ok("Authorized Employee");
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();
|
||||||
} catch (EmployeeNotFoundException e) {
|
} catch (EmployeeNotFoundException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user