Ignore:
Timestamp:
02/08/23 14:40:10 (22 months ago)
Author:
DenicaKj <dkorvezir@…>
Branches:
master
Children:
5867520, 632e3d8
Parents:
61fed7c
Message:

Events and Event

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

Legend:

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

    r61fed7c r90317ea  
    55import java.time.LocalDate;
    66import java.util.List;
     7import java.util.Optional;
    78
    89public interface EventService {
    910    List<Event> findAllEvents();
    1011    Event save(LocalDate start_date,String theme,String duration,String repeating,String url);
     12    List<Event> getEventsNow();
     13    List<Event> getEventsFromCinema(int id);
     14    Optional<Event> getEventById(Long id);
    1115}
  • src/main/java/com/example/moviezone/service/FilmService.java

    r61fed7c r90317ea  
    1414    Optional<Film> getFilmById(Long id);
    1515    List<Film> getFilmsFromCinema(int id);
     16    List<Film> getFilmsFromCinemaNow(int id);
     17    List<Film> getFilmsNow();
    1618}
  • src/main/java/com/example/moviezone/service/Impl/EventServiceImpl.java

    r61fed7c r90317ea  
    77
    88import java.time.LocalDate;
     9import java.util.Collections;
    910import java.util.List;
     11import java.util.Optional;
    1012
    1113@Service
     
    2628        return eventRepository.save(new Event(theme,duration,repeating,start_date,img_url));
    2729    }
     30
     31    @Override
     32    public List<Event> getEventsNow() {
     33        return eventRepository.getFilmsFromCinemaNow();
     34    }
     35
     36    @Override
     37    public List<Event> getEventsFromCinema(int id) {
     38        return eventRepository.getFilmsFromCinema(id);
     39    }
     40
     41    @Override
     42    public Optional<Event> getEventById(Long id) {
     43        return eventRepository.findAllById(Collections.singleton(id.intValue())).stream().findFirst();
     44    }
    2845}
  • src/main/java/com/example/moviezone/service/Impl/FilmServiceImpl.java

    r61fed7c r90317ea  
    4040    }
    4141
     42    @Override
     43    public List<Film> getFilmsFromCinemaNow(int id) {
     44        return filmRepository.getFilmsFromCinemaNow(id);
     45    }
     46
     47    @Override
     48    public List<Film> getFilmsNow() {
     49        return filmRepository.getFilmsNow();
     50    }
     51
    4252}
Note: See TracChangeset for help on using the changeset viewer.