panel uzytkownika
This commit is contained in:
@@ -63,6 +63,13 @@ public class NotificationController {
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
// Wyczyszczenie calego centrum powiadomien ("Usun wszystkie"). Zakres bierzemy z tokenu.
|
||||
@DeleteMapping("/all")
|
||||
public ResponseEntity<Void> deleteAll(Authentication authentication) {
|
||||
notificationService.deleteAll(authentication.getName());
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
// Zdarzenia liczone po stronie klienta (alerty cenowe, spotkania, ulubione, weryfikacja telefonu,
|
||||
// dopasowane oferty). Powiadomienie zawsze trafia do zalogowanego uzytkownika (serwer ustawia odbiorce).
|
||||
@PostMapping
|
||||
|
||||
@@ -24,4 +24,9 @@ public interface NotificationRepository extends JpaRepository<Notification, Long
|
||||
@Query("delete from Notification n where lower(n.userEmail) = lower(:email) "
|
||||
+ "and n.dedupeKey is not null and n.dedupeKey like :pattern escape '\\'")
|
||||
int deleteByDedupeKeyPattern(@Param("email") String email, @Param("pattern") String pattern);
|
||||
|
||||
// Wyczyszczenie calego centrum powiadomien uzytkownika ("Usun wszystkie").
|
||||
@Modifying
|
||||
@Query("delete from Notification n where lower(n.userEmail) = lower(:email)")
|
||||
int deleteAllForUser(@Param("email") String email);
|
||||
}
|
||||
|
||||
@@ -99,6 +99,15 @@ public class NotificationService {
|
||||
repository.markAllRead(email);
|
||||
}
|
||||
|
||||
/** Usuwa wszystkie powiadomienia uzytkownika ("Usun wszystkie" w centrum powiadomien). */
|
||||
@Transactional
|
||||
public int deleteAll(String email) {
|
||||
if (email == null || email.isBlank()) {
|
||||
return 0;
|
||||
}
|
||||
return repository.deleteAllForUser(email);
|
||||
}
|
||||
|
||||
// --- SSE ---
|
||||
|
||||
public SseEmitter subscribe(String email) {
|
||||
|
||||
Reference in New Issue
Block a user