Changeset 73f0dbc for src/main/java/com/example/moviezone
- Timestamp:
- 02/10/23 01:18:53 (21 months ago)
- Branches:
- master
- Children:
- 7926d68
- Parents:
- 01a1ca6
- Location:
- src/main/java/com/example/moviezone
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/config/WebSecurityConfig.java
r01a1ca6 r73f0dbc 32 32 http.csrf().disable() 33 33 .authorizeRequests() 34 .antMatchers("/","/films","/home/projections","/home/events","/home/getProjections/**","/home/films","/ getFilm/**","/getEvent/**","/login","/events","/projections" ,"/home", "/assets/**", "/register", "/api/**").permitAll()35 .antMatchers("/home/getSeats/**","/myTickets","/ getProjection/**","/home/makeReservation").hasRole("USER")34 .antMatchers("/","/films","/home/projections","/home/events","/home/getProjections/**","/home/films","/home/getFilm/**","/getFilm/**","/home/getEvent/**","/getEvent/**","/login","/events","/projections" ,"/home", "/assets/**", "/register", "/api/**").permitAll() 35 .antMatchers("/home/getSeats/**","/myTickets","/home/addRating/**","/addRating/**","/getProjection/**","/home/makeReservation").hasRole("USER") 36 36 .antMatchers("/**").hasRole("ADMIN") 37 37 .anyRequest() -
src/main/java/com/example/moviezone/model/manytomany/CustomerRatesFilm.java
r01a1ca6 r73f0dbc 30 30 Integer id_film; 31 31 32 double rating; 33 34 public CustomerRatesFilm(Integer id_customer, Integer id_film, double rating) { 35 this.id_customer = id_customer; 36 this.id_film = id_film; 37 this.rating = rating; 38 } 32 39 } -
src/main/java/com/example/moviezone/repository/CustomerRatesFilmRepository.java
r01a1ca6 r73f0dbc 12 12 @Procedure("project.avg_rating1") 13 13 double avg_rating(int id); 14 14 CustomerRatesFilm save(CustomerRatesFilm customerRatesFilm); 15 15 } -
src/main/java/com/example/moviezone/service/CustomerRatesFilmService.java
r01a1ca6 r73f0dbc 1 1 package com.example.moviezone.service; 2 3 import com.example.moviezone.model.Customer; 4 import com.example.moviezone.model.manytomany.CustomerRatesFilm; 2 5 3 6 public interface CustomerRatesFilmService { 4 7 double avg_rating(int id); 8 CustomerRatesFilm addRating(Integer id_customer, Integer id_film, double rating); 9 5 10 } -
src/main/java/com/example/moviezone/service/Impl/CustomerRatesFilmImpl.java
r01a1ca6 r73f0dbc 1 1 package com.example.moviezone.service.Impl; 2 2 3 import com.example.moviezone.model.manytomany.CustomerRatesFilm; 3 4 import com.example.moviezone.repository.CustomerRatesFilmRepository; 4 5 import com.example.moviezone.service.CustomerRatesFilmService; … … 17 18 return customerRatesFilmRepository.avg_rating(id); 18 19 } 20 21 @Override 22 public CustomerRatesFilm addRating(Integer id_customer, Integer id_film, double rating) { 23 CustomerRatesFilm customerRatesFilm=new CustomerRatesFilm(id_customer,id_film,rating); 24 return customerRatesFilmRepository.save(customerRatesFilm); 25 } 19 26 } -
src/main/java/com/example/moviezone/web/HomeController.java
r01a1ca6 r73f0dbc 395 395 return "redirect:/myTickets"; 396 396 } 397 @PostMapping("/addRating/{id}") 398 public String addRating(@RequestParam Long rate,@PathVariable Long id,HttpServletRequest request, HttpServletResponse respons) 399 { 400 Customer customer=customerService.findByUsername(request.getRemoteUser()); 401 System.out.println(customer.getFirst_name()); 402 customerRatesFilmService.addRating(customer.getId_user(),Integer.valueOf(id.intValue()),Integer.valueOf(rate.intValue())); 403 return "redirect:/home/getFilm/"+id; 404 } 397 405 398 406 }
Note:
See TracChangeset
for help on using the changeset viewer.