[fc7ec52] | 1 | package com.example.demo.controller.Rest;
|
---|
| 2 |
|
---|
| 3 |
|
---|
| 4 |
|
---|
| 5 |
|
---|
| 6 | import com.example.demo.model.*;
|
---|
| 7 | import com.example.demo.model.Client.Client;
|
---|
| 8 | import com.example.demo.model.Gives.Gives;
|
---|
| 9 | import com.example.demo.model.Gives.GivesKey;
|
---|
| 10 | import com.example.demo.model.IS_.MovieGenreCombination;
|
---|
| 11 | import com.example.demo.model.IS_.MovieGenreKey;
|
---|
| 12 | import com.example.demo.model.Reservation.Reservations;
|
---|
| 13 | import com.example.demo.model.Seat.Seat;
|
---|
| 14 | import com.example.demo.model.Seat.SeatCompositeKey;
|
---|
| 15 | import com.example.demo.repository.*;
|
---|
| 16 | import com.example.demo.service.AuthService;
|
---|
| 17 | import com.example.demo.service.MovieProjectionService;
|
---|
| 18 | import org.springframework.http.ResponseEntity;
|
---|
| 19 | import org.springframework.web.bind.annotation.GetMapping;
|
---|
| 20 | import org.springframework.web.bind.annotation.RequestMapping;
|
---|
| 21 | import org.springframework.web.bind.annotation.RestController;
|
---|
| 22 |
|
---|
| 23 | import java.time.LocalDateTime;
|
---|
| 24 | import java.time.format.DateTimeFormatter;
|
---|
| 25 | import java.util.*;
|
---|
| 26 |
|
---|
| 27 |
|
---|
| 28 | @RestController
|
---|
| 29 | @RequestMapping("/tests")
|
---|
| 30 | public class TESTING {
|
---|
| 31 |
|
---|
| 32 | private final MovieProjectionRepository movieProjectionRepository;
|
---|
| 33 | private final MovieRepository movieRepository;
|
---|
| 34 | private final AuthService authService;
|
---|
| 35 | private final UserRepository userRepository;
|
---|
| 36 | private final SeatRepository seatRepository;
|
---|
| 37 | private final ClientRepository clientRepository;
|
---|
| 38 | private final Works_inRepository worksInRepository;
|
---|
| 39 | private final ReservationsRepository reservationsRepository;
|
---|
| 40 | private final PaymentRepository paymentRepository;
|
---|
| 41 | private final MovieGenreCombinationRepository movieGenreCombinationRepository;
|
---|
| 42 | private final GivesRepository givesRepository;
|
---|
| 43 | private final AuditoriumRepository auditoriumRepository;
|
---|
| 44 | private final PaymentTypeRepository paymentTypeRepository;
|
---|
| 45 | private final MovieProjectionService movieProjectionService;
|
---|
| 46 | private final GenreRepository genreRepository;
|
---|
| 47 |
|
---|
| 48 | public TESTING(MovieProjectionRepository movieProjectionRepository, MovieRepository movieRepository, AuthService authService, UserRepository userRepository, SeatRepository seatRepository, ClientRepository clientRepository, Works_inRepository worksInRepository, ReservationsRepository reservation1Repository, ReservationsRepository reservationsRepository, PaymentRepository paymentRepository, MovieGenreCombinationRepository movieGenreCombinationRepository, GivesRepository givesRepository, AuditoriumRepository auditoriumRepository, PaymentTypeRepository paymentTypeRepository, MovieProjectionService movieProjectionService, GenreRepository genreRepository) {
|
---|
| 49 | this.movieProjectionRepository = movieProjectionRepository;
|
---|
| 50 | this.movieRepository = movieRepository;
|
---|
| 51 | this.authService = authService;
|
---|
| 52 | this.userRepository = userRepository;
|
---|
| 53 | this.seatRepository = seatRepository;
|
---|
| 54 | this.clientRepository = clientRepository;
|
---|
| 55 | this.worksInRepository = worksInRepository;
|
---|
| 56 | this.reservationsRepository = reservationsRepository;
|
---|
| 57 | this.paymentRepository = paymentRepository;
|
---|
| 58 | this.movieGenreCombinationRepository = movieGenreCombinationRepository;
|
---|
| 59 | this.givesRepository = givesRepository;
|
---|
| 60 | this.auditoriumRepository = auditoriumRepository;
|
---|
| 61 | this.paymentTypeRepository = paymentTypeRepository;
|
---|
| 62 | this.movieProjectionService = movieProjectionService;
|
---|
| 63 | this.genreRepository = genreRepository;
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 | @GetMapping
|
---|
| 67 | public ResponseEntity viewQuery() {
|
---|
| 68 |
|
---|
| 69 | /*
|
---|
| 70 | PaymentType paymentType = this.paymentTypeRepository.findById(12365).get();
|
---|
| 71 | User user = this.userRepository.findById(32423).get();
|
---|
| 72 | ClientCompositeKey clientCompositeKey = new ClientCompositeKey();
|
---|
| 73 | clientCompositeKey.setUser(user);
|
---|
| 74 | Client client = this.clientRepository.findById(clientCompositeKey).get();
|
---|
| 75 | SeatCompositeKey seatCompositeKey = new SeatCompositeKey();
|
---|
| 76 | seatCompositeKey.setSeat_id(100);
|
---|
| 77 | Auditorium auditorium = this.auditoriumRepository.findById(1).get();
|
---|
| 78 | seatCompositeKey.setAuditorium(auditorium);
|
---|
| 79 | Seat seat = seatRepository.findById(seatCompositeKey).get();
|
---|
| 80 | MovieProjection movieProjection = movieProjectionService.findById(12732).get();
|
---|
| 81 | Payment payment = paymentRepository.findById(163216).get();
|
---|
| 82 |
|
---|
| 83 |
|
---|
| 84 | */
|
---|
| 85 | //PaymentType paymentType = this.paymentTypeRepository.findAllPayments().get();
|
---|
| 86 | //User user = this.userRepository.findAll().get();
|
---|
| 87 | //
|
---|
| 88 | // Seat seat123123 = new Seat();
|
---|
| 89 | // GivesKey givesKey;
|
---|
| 90 | // Optional<Gives> gives = givesRepository.findAllByProjectionId(12732);
|
---|
| 91 | //
|
---|
| 92 | //
|
---|
| 93 | // MovieProjection projection = movieProjectionRepository.findById(12732).get();
|
---|
| 94 | // Auditorium auditorium = auditoriumRepository.findById(1).get();
|
---|
| 95 | //
|
---|
| 96 | //
|
---|
| 97 | // SeatCompositeKey seatCompositeKey = new SeatCompositeKey();
|
---|
| 98 | // seatCompositeKey.setAuditorium(auditorium);
|
---|
| 99 | // for(int i=0;i<37;i++)
|
---|
| 100 | // seatCompositeKey.setSeat_id(i);
|
---|
| 101 | //
|
---|
| 102 | // Seat seat = new Seat();
|
---|
| 103 | // seat.setSeatCompositeKey(seatCompositeKey);
|
---|
| 104 | //
|
---|
| 105 | // for(int i=0;i<auditorium.getAuditorium_capacity();i++)
|
---|
| 106 | // seat.setSeat_number(i);
|
---|
| 107 | //
|
---|
| 108 | // List<Reservations> reserve = new ArrayList<>();
|
---|
| 109 | // reserve = reservationsRepository.findByProjectionId(12732);
|
---|
| 110 | //
|
---|
| 111 | // List<Seat> seat10 = seatRepository.selectFreeSeatsByProjection(12732);
|
---|
| 112 | //
|
---|
| 113 | // List<Auditorium> auditoriums = auditoriumRepository.SelectAuditoriumsByProjection(12732);
|
---|
| 114 | //
|
---|
| 115 | // List<MovieProjection> projections = movieProjectionRepository.findProjectionsById(12732);
|
---|
| 116 | //
|
---|
| 117 | //
|
---|
| 118 | //
|
---|
| 119 | // LocalDateTime localDateTime = LocalDateTime.now();
|
---|
| 120 | // DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MM-yyyy");
|
---|
| 121 | //
|
---|
| 122 | //
|
---|
| 123 | // List<Reservations> reservationsList = reservationsRepository.findAll();
|
---|
| 124 | //
|
---|
| 125 | //
|
---|
| 126 | // List<Genre> genres1 = genreRepository.SelectTopThree();
|
---|
| 127 | //
|
---|
| 128 | // List<Client> client223=clientRepository.findBestClient(12732);
|
---|
| 129 |
|
---|
| 130 |
|
---|
| 131 | SeatCompositeKey seatCompositeKey = new SeatCompositeKey();
|
---|
| 132 |
|
---|
| 133 | for (int i = 1; i <= 50; i++) {
|
---|
| 134 | seatCompositeKey.setSeat_id(i);
|
---|
| 135 | seatCompositeKey.setAuditorium(this.auditoriumRepository.findById(1).get());
|
---|
| 136 | }
|
---|
| 137 | Seat seat = new Seat();
|
---|
| 138 | seat.setSeatCompositeKey(seatCompositeKey);
|
---|
| 139 | for (int i = 1; i <= 50; i++) {
|
---|
| 140 | seat.setSeat_number(i);
|
---|
| 141 | }
|
---|
| 142 | return ResponseEntity.ok(seat);
|
---|
| 143 | }
|
---|
| 144 |
|
---|
| 145 | }
|
---|