Ignore:
Timestamp:
05/02/25 00:37:10 (2 weeks ago)
Author:
Aleksandar Panovski <apano77@…>
Branches:
main
Children:
c44c5ed
Parents:
e15e8d9
Message:

Added menu tag

succesfull testing and implemnation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/rezevirajmasa/demo/web/rest/testController.java

    re15e8d9 r2518b3a  
    181181
    182182    @PostMapping("/api/reservations")
    183     public ResponseEntity<?> createReservation(@RequestBody ReservationDTO reservation) {
    184         User user = userService.findByMail(reservation.getUserEmail());
    185         Reservation savedReservation = reservationService.makeReservationRest(reservation, user);
     183    public ResponseEntity<?> createReservation(@RequestBody ReservationDTO reservation){
     184    User user = userService.findByMail(reservation.getUserEmail());
     185    Restaurant restaurant = restaurantService.findByIdRestaurant(reservation.getRestaurantId());
     186        Reservation savedReservation = reservationService.makeReservationRest(reservation, user, restaurant);
    186187
    187188        return new ResponseEntity<>(savedReservation, HttpStatus.CREATED);
     
    227228                                                       @PathVariable String email) {
    228229        User user = userService.findByMail(email);
    229 
     230        Restaurant restaurant = restaurantService.findByIdRestaurant(reservationDTO.getRestaurantId());
    230231        if (!reservationDTO.getReservationID().equals(reservationId)) {
    231232            return ResponseEntity.badRequest().build();
Note: See TracChangeset for help on using the changeset viewer.