proper data flow

This commit is contained in:
2025-04-18 09:55:59 +02:00
parent 8fc8473962
commit b25bd3dbe9
4 changed files with 21 additions and 10 deletions

View File

@@ -22,7 +22,7 @@ public class NoticeService {
this.clientRepository = clientRepository;
}
public Notice fromDTO(NoticeDTO dto) {
private Notice fromDTO(NoticeDTO dto) {
Notice notice = new Notice();
notice.setTitle(dto.getTitle());
notice.setDescription(dto.getDescription());
@@ -40,8 +40,7 @@ public class NoticeService {
return notice;
}
// Metoda do konwersji Notice na DTO
public NoticeDTO toDTO(Notice notice) {
private NoticeDTO toDTO(Notice notice) {
NoticeDTO dto = new NoticeDTO();
dto.setNoticeId(notice.getIdNotice());
dto.setTitle(notice.getTitle());
@@ -71,8 +70,8 @@ public class NoticeService {
return toDTO(notice);
}
public void addNotice(Notice notice) {
noticeRepository.save(notice);
public void addNotice(NoticeDTO dto) {
noticeRepository.save(fromDTO(dto));
}
public boolean noticeExists(Long id) {