Files
sumoc-backend/src/main/java/SuMoC/backend/notification/config/NotificationProperties.java
T
neuhauss fb41f80061
LocationBasedServices/sumoc-backend/pipeline/head This commit looks good
add NotificationLimiter to avoid sending too many notifications per hour
2026-02-05 11:56:24 +01:00

30 lines
971 B
Java

package SuMoC.backend.notification.config;
import SuMoC.backend.notification.enums.NotificationType;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@Data
@Component
@ConfigurationProperties(prefix = "sumoc.notification")
public class NotificationProperties {
/**
* Maximum number of failed send attempts before giving up on a notification.
*/
private int maxFailedSendAttempts = 3;
/**
* Maximum number of notifications to send to a user per hour per notification type.
*/
private Map<NotificationType, Integer> maxNotificationsPerHourPerType = new HashMap<>(Map.of(
NotificationType.TREND, 1,
NotificationType.ADHOC_ALTERNATIVE, 1,
NotificationType.REGULAR_TRIP_ALTERNATIVE, 1,
NotificationType.FRIENDSHIP_REQUEST_RECEIVED, 3
));
}