source: src/main/java/com/example/moviezone/service/Impl/EventServiceImpl.java@ 4173acf

Last change on this file since 4173acf was ef84238, checked in by DenicaKj <dkorvezir@…>, 21 months ago

Interested in event

  • Property mode set to 100644
File size: 1.4 KB
Line 
1package com.example.moviezone.service.Impl;
2
3import com.example.moviezone.model.Event;
4import com.example.moviezone.repository.EventRepository;
5import com.example.moviezone.service.EventService;
6import org.springframework.stereotype.Service;
7
8import java.time.LocalDate;
9import java.util.Collections;
10import java.util.List;
11import java.util.Optional;
12
13@Service
14public class EventServiceImpl implements EventService {
15 private final EventRepository eventRepository;
16
17 public EventServiceImpl(EventRepository eventRepository) {
18 this.eventRepository = eventRepository;
19 }
20
21 @Override
22 public List<Event> findAllEvents() {
23 return eventRepository.findAll();
24 }
25
26 @Override
27 public Event save(LocalDate start_date, String theme, String duration, String repeating,String img_url) {
28 return eventRepository.save(new Event(theme,duration,repeating,start_date,img_url));
29 }
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 }
45
46 @Override
47 public List<Event> getEventsForCustomer(int id) {
48 return eventRepository.getEventsForCustomer(id);
49 }
50}
Note: See TracBrowser for help on using the repository browser.