package com.example.nto.controller; import com.example.nto.dto.EmployeeInfoResponse; import com.example.nto.service.BookingService; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * TODO: ДОРАБОТАТЬ в рамках задания * ================================= * МОЖНО: Добавлять методы, аннотации, зависимости * НЕЛЬЗЯ: Изменять название класса и пакета */ @RestController @RequestMapping("/api") @RequiredArgsConstructor public class EmployeeController { private final BookingService bookingService; @GetMapping("/{code}/auth") public ResponseEntity auth(@PathVariable String code) { if (bookingService.isCodeValid(code)) { return ResponseEntity.ok().build(); } return ResponseEntity.status(401).build(); } @GetMapping("/{code}/info") public EmployeeInfoResponse getInfo(@PathVariable String code) { return bookingService.getEmployeeInfo(code); } }