source: src/main/java/com/example/task/service/ReminderService.java

Last change on this file was fdfbdde, checked in by Stojilkova Sara <sara.stojilkova.students.finki.ukim.mk>, 9 months ago

Initial commit

  • Property mode set to 100644
File size: 877 bytes
Line 
1package com.example.task.service;
2
3import com.example.task.entity.event.CalendarEvent;
4import com.example.task.entity.reminder.ReminderEntity;
5import com.example.task.repository.ReminderRepository;
6import com.example.task.repository.event.CalendarEventRepository;
7import lombok.AllArgsConstructor;
8import org.springframework.stereotype.Service;
9
10@Service
11@AllArgsConstructor
12public class ReminderService {
13
14 private final CalendarEventRepository calendarEventRepository;
15 private final ReminderRepository reminderRepository;
16
17 public void addReminder(Integer id, Integer minutes, boolean repeat) throws Exception {
18 CalendarEvent calendarEvent = calendarEventRepository.findById(id).orElseThrow(Exception::new);
19 ReminderEntity reminderEntity = new ReminderEntity(calendarEvent, minutes, repeat);
20 reminderRepository.save(reminderEntity);
21 }
22}
Note: See TracBrowser for help on using the repository browser.