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
|
Rev | Line | |
---|
[fdfbdde] | 1 | package com.example.task.service;
|
---|
| 2 |
|
---|
| 3 | import com.example.task.entity.event.CalendarEvent;
|
---|
| 4 | import com.example.task.entity.reminder.ReminderEntity;
|
---|
| 5 | import com.example.task.repository.ReminderRepository;
|
---|
| 6 | import com.example.task.repository.event.CalendarEventRepository;
|
---|
| 7 | import lombok.AllArgsConstructor;
|
---|
| 8 | import org.springframework.stereotype.Service;
|
---|
| 9 |
|
---|
| 10 | @Service
|
---|
| 11 | @AllArgsConstructor
|
---|
| 12 | public 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.