Ignore:
Timestamp:
02/09/23 14:06:45 (23 months ago)
Author:
DenicaKj <dkorvezir@…>
Branches:
master
Children:
6a9006d, a9ffccd
Parents:
0ba5d1a
Message:

Reservation Implemented

Location:
src/main/java/com/example/moviezone/service
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/service/CategoryService.java

    r0ba5d1a r00fa72f  
    44
    55import java.util.List;
     6import java.util.Optional;
    67
    78public interface CategoryService {
    89    List<Category> findAllCategories();
     10    Optional<Category> getCategoryById(int id);
    911}
  • src/main/java/com/example/moviezone/service/CustomerService.java

    r0ba5d1a r00fa72f  
    55
    66import java.util.List;
     7import java.util.Optional;
     8
    79@Repository
    810public interface CustomerService {
    911    List<Customer> findAllCustomers();
     12    Optional<Customer> getCustomerById(int id);
    1013}
  • src/main/java/com/example/moviezone/service/Impl/CategoryServiceImpl.java

    r0ba5d1a r00fa72f  
    77
    88import java.util.List;
     9import java.util.Optional;
    910
    1011@Service
     
    2021        return categoryRepository.findAll();
    2122    }
     23
     24    @Override
     25    public Optional<Category> getCategoryById(int id) {
     26        return categoryRepository.getByIdcategory(id);
     27    }
    2228}
  • src/main/java/com/example/moviezone/service/Impl/CustomerServiceImpl.java

    r0ba5d1a r00fa72f  
    77
    88import java.util.List;
     9import java.util.Optional;
    910
    1011@Service
     
    2021        return customerRepository.findAll();
    2122    }
     23
     24    @Override
     25    public Optional<Customer> getCustomerById(int id) {
     26        return customerRepository.findById(id);
     27    }
    2228}
  • src/main/java/com/example/moviezone/service/Impl/Projection_RoomServiceImpl.java

    r0ba5d1a r00fa72f  
    2020        return projectionRoomRepository.findAll();
    2121    }
     22
     23    @Override
     24    public List<Projection_Room> getRoomByProjection(int id) {
     25        return projectionRoomRepository.getRoomsForProjection(id);
     26    }
    2227}
  • src/main/java/com/example/moviezone/service/Impl/SeatServiceImpl.java

    r0ba5d1a r00fa72f  
    11package com.example.moviezone.service.Impl;
    22
     3import com.example.moviezone.model.Category;
    34import com.example.moviezone.model.Projection_Room;
    45import com.example.moviezone.model.Seat;
     
    89
    910import java.util.List;
     11import java.util.Optional;
    1012
    1113@Service
    1214public class SeatServiceImpl implements SeatService {
     15
     16
    1317    private final SeatRepository seatRepository;
    1418
     
    2630        return seatRepository.findAllByProjection(projection_room);
    2731    }
     32
     33    @Override
     34    public List<Seat> findAllByRoomAndCategory(Projection_Room projectionRoom, Category category) {
     35        return seatRepository.findAllByCategoryAndProjection(category,projectionRoom);
     36    }
     37
     38    @Override
     39    public Optional<Seat> getSeatById(int id) {
     40        return Optional.of(seatRepository.getById(id));
     41    }
    2842}
  • src/main/java/com/example/moviezone/service/Impl/TicketServiceImpl.java

    r0ba5d1a r00fa72f  
    11package com.example.moviezone.service.Impl;
    22
    3 import com.example.moviezone.model.Customer;
    4 import com.example.moviezone.model.Ticket;
     3import com.example.moviezone.model.*;
    54import com.example.moviezone.repository.TicketRepository;
    65import com.example.moviezone.service.TicketService;
    76import org.springframework.stereotype.Service;
    87
     8import java.time.LocalDate;
    99import java.util.List;
    1010
     
    2828
    2929    @Override
     30    public Ticket saveWithDiscount(LocalDate date, Customer customer, Projection projection, Discount discount, Seat seat) {
     31        Ticket t=new Ticket(date,customer,projection,discount,seat);
     32        return ticketRepository.save(t);
     33    }
     34
     35    @Override
     36    public Ticket saveWithout(LocalDate date, Customer customer, Projection projection, Seat seat) {
     37        Ticket t=new Ticket(date,customer,projection,seat);
     38        return ticketRepository.save(t);
     39    }
     40
     41    @Override
    3042    public Ticket save(long price, Customer customer) {
    3143        return ticketRepository.save(new Ticket(price,customer));
    3244    }
     45
     46    @Override
     47    public Integer priceForTicket(int id) {
     48        return ticketRepository.getPriceForTicket(id);
     49    }
    3350}
  • src/main/java/com/example/moviezone/service/Projection_RoomService.java

    r0ba5d1a r00fa72f  
    22
    33import com.example.moviezone.model.Projection_Room;
     4import org.springframework.data.jpa.repository.query.Procedure;
    45
    56import java.util.List;
     
    78public interface Projection_RoomService {
    89    List<Projection_Room> findAllProjectionRooms();
     10
     11    List<Projection_Room> getRoomByProjection(int id);
    912}
  • src/main/java/com/example/moviezone/service/SeatService.java

    r0ba5d1a r00fa72f  
    11package com.example.moviezone.service;
    22
     3import com.example.moviezone.model.Category;
    34import com.example.moviezone.model.Projection_Room;
    45import com.example.moviezone.model.Seat;
    56
    67import java.util.List;
     8import java.util.Optional;
    79
    810public interface SeatService {
    911    List<Seat> findAllSeats();
    1012    List<Seat> findAllByProjection_Room(Projection_Room projection_room);
     13    List<Seat> findAllByRoomAndCategory(Projection_Room projectionRoom, Category category);
     14    Optional<Seat> getSeatById(int id);
    1115}
  • src/main/java/com/example/moviezone/service/TicketService.java

    r0ba5d1a r00fa72f  
    11package com.example.moviezone.service;
    22
    3 import com.example.moviezone.model.Customer;
    4 import com.example.moviezone.model.Ticket;
     3import com.example.moviezone.model.*;
    54
     5import java.time.LocalDate;
    66import java.util.List;
    77
     
    99    List<Ticket> findAllTickets();
    1010    List<Ticket> findAllByCustomer(Customer customer);
    11 
     11    Ticket saveWithDiscount(LocalDate date, Customer customer, Projection projection, Discount discount, Seat seat);
     12    Ticket saveWithout(LocalDate date,Customer customer,Projection projection,Seat seat);
    1213    Ticket save(long price,Customer customer);
     14    Integer priceForTicket(int id);
    1315}
Note: See TracChangeset for help on using the changeset viewer.