feat(notifications): TODO 7 — draft decision toast + email + bell badge
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
package cloud.nstart.terravault.ordinis.app.config;
|
||||
|
||||
import cloud.nstart.terravault.ordinis.notifications.dispatcher.UserDisplayPort;
|
||||
import cloud.nstart.terravault.ordinis.restapi.service.UserDisplayService;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Wires {@link UserDisplayService} (ordinis-rest-api) into the notifications module's
|
||||
* {@link UserDisplayPort} interface (ordinis-notifications).
|
||||
*
|
||||
* <p>Lives in ordinis-app because that module has compile-time visibility over
|
||||
* both ordinis-rest-api and ordinis-notifications. This avoids a circular dependency
|
||||
* (notifications → rest-api → notifications).
|
||||
*
|
||||
* <p>Gated on {@code ordinis.notifications.enabled} — no unnecessary bean creation
|
||||
* when notifications module is dormant.
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnProperty(name = "ordinis.notifications.enabled", havingValue = "true", matchIfMissing = false)
|
||||
public class NotificationsUserDisplayBridge {
|
||||
|
||||
@Bean
|
||||
public UserDisplayPort userDisplayPort(UserDisplayService userDisplayService) {
|
||||
return userId -> userDisplayService.find(userId)
|
||||
.map(info -> new UserDisplayPort.DisplayInfo(info.sub(), info.email(), info.name()));
|
||||
}
|
||||
}
|
||||
@@ -224,3 +224,18 @@ ordinis:
|
||||
realm: ${ORDINIS_KEYCLOAK_ADMIN_REALM:nstart}
|
||||
client-id: ${ORDINIS_KEYCLOAK_ADMIN_CLIENT_ID:}
|
||||
client-secret: ${ORDINIS_KEYCLOAK_ADMIN_CLIENT_SECRET:}
|
||||
|
||||
# Notifications module — push email for draft lifecycle events.
|
||||
# Activated via ordinis.notifications.enabled=true (writer pod only).
|
||||
# SMTP creds: spring.mail.* (standard Spring Boot mail properties).
|
||||
# See ordinis-notifications module + migration 0021/0024.
|
||||
notifications:
|
||||
enabled: ${ORDINIS_NOTIFICATIONS_ENABLED:true}
|
||||
poll-interval-ms: ${ORDINIS_NOTIFICATIONS_POLL_INTERVAL_MS:30000}
|
||||
batch-size: ${ORDINIS_NOTIFICATIONS_BATCH_SIZE:50}
|
||||
# Reviewer pool email — receives RecordDraftSubmitted / RecordDraftWithdrawn pings.
|
||||
# Leave blank to disable reviewer-pool notifications (maker-only notifications still work).
|
||||
reviewer-pool-email: ${ORDINIS_NOTIFICATIONS_REVIEWER_POOL_EMAIL:}
|
||||
email:
|
||||
from-address: ${ORDINIS_NOTIFICATIONS_FROM:}
|
||||
base-url: ${ORDINIS_NOTIFICATIONS_BASE_URL:}
|
||||
|
||||
Reference in New Issue
Block a user