implemented deletion of notice

This commit is contained in:
2025-04-14 10:08:26 +02:00
parent b0f47b475a
commit f17b97eaf9
2 changed files with 21 additions and 0 deletions

View File

@@ -93,4 +93,14 @@ public NoticeDTO updateNotice(Long id, NoticeDTO dto) {
return toDTO(noticeRepository.save(existingNotice));
}
public void deleteNotice(Long id) {
if (noticeExists(id)) {
noticeRepository.deleteById(id);
} else {
throw new EntityNotFoundException("Nie znaleziono ogłoszenia o ID: " + id);
}
}
}