CRON job voor het schonen van de logging

This commit is contained in:
2025-01-20 22:29:30 +01:00
parent 4a786e506c
commit 9f24b94aaa

View File

@@ -1,7 +1,9 @@
package nl.veenm.jobfindr.util;
import io.quarkus.scheduler.Scheduled;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.transaction.Transactional;
import nl.veenm.jobfindr.domain.Event;
import nl.veenm.jobfindr.repository.EventRepository;
@@ -57,7 +59,16 @@ public class EventService {
saveEvent(event);
}
@Transactional
private void saveEvent(Event event) {
eventRepository.persist(event);
}
@Scheduled(cron = "0 00 00 ? * 1#1")
@Transactional
private void cleanEvents() {
eventRepository.deleteAll();
}
}