fix notification

This commit is contained in:
Efstratios Giannopoulos 2024-05-14 14:36:45 +03:00
parent ee611ed7e0
commit bd06df58c5
5 changed files with 19 additions and 20 deletions

2
.gitignore vendored
View File

@ -56,3 +56,5 @@ backend/target/classes/
backend/core/target/maven-archiver/ backend/core/target/maven-archiver/
backend/node_modules/.yarn-integrity backend/node_modules/.yarn-integrity
dmp-frontend/.nx/ dmp-frontend/.nx/
notification-service/notification-web/src/main/resources/config/app.env
backend/web/src/main/resources/config/app.env

View File

@ -46,10 +46,6 @@
<appender-ref ref="TROUBLESHOOTING"/> <appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/> <appender-ref ref="STDOUT"/>
</logger> </logger>
<logger name="org.springframework.data.elasticsearch.client.WIRE" level="TRACE" additivity="false">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="audit" level="INFO" additivity="false"> <logger name="audit" level="INFO" additivity="false">
<appender-ref ref="AUDITING"/> <appender-ref ref="AUDITING"/>
<appender-ref ref="STDOUT"/> <appender-ref ref="STDOUT"/>

View File

@ -486,5 +486,5 @@ notification:
priority-key: null priority-key: null
cipher-fields: [ ] cipher-fields: [ ]
template-cache: template-cache:
prefix: ${CACHE_DISAMBIGUATION:} prefix: ${CACHE_DISAMBIGUATION}
key-pattern: "{prefix}:Notification_Message_InApp_Template:{key}:v0" key-pattern: "{prefix}:Notification_Message_InApp_Template:{key}:v0"

View File

@ -46,10 +46,6 @@
<appender-ref ref="TROUBLESHOOTING"/> <appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/> <appender-ref ref="STDOUT"/>
</logger> </logger>
<logger name="org.springframework.data.elasticsearch.client.WIRE" level="TRACE" additivity="false">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="audit" level="INFO" additivity="false"> <logger name="audit" level="INFO" additivity="false">
<appender-ref ref="AUDITING"/> <appender-ref ref="AUDITING"/>
<appender-ref ref="STDOUT"/> <appender-ref ref="STDOUT"/>

View File

@ -108,20 +108,25 @@ public class MessageBuilderServiceImpl implements MessageInfoBuilderService {
if (messageInfo.getTimeZone() == null || messageInfo.getTimeZone().isBlank()) messageInfo.setTimeZone(this.localeService.timezoneName()); if (messageInfo.getTimeZone() == null || messageInfo.getTimeZone().isBlank()) messageInfo.setTimeZone(this.localeService.timezoneName());
if (this.scope.isMultitenant()) { if (this.scope.isMultitenant()) {
TenantEntity tenantInfo = this.queryFactory.query(TenantQuery.class) if (this.scope.isDefaultTenant()) {
.isActive(IsActive.Active).firstAs(new BaseFieldSet(TenantEntity._id, TenantEntity._code)); TenantEntity tenantInfo = this.queryFactory.query(TenantQuery.class)
.isActive(IsActive.Active).firstAs(new BaseFieldSet(TenantEntity._id, TenantEntity._code));
if (tenantInfo == null) { if (tenantInfo == null) {
try { try {
logger.error("Could not retrieve tenant info for notification {} in tenant {}", notification.getId(), scope.getTenant()); logger.error("Could not retrieve tenant info for notification {} in tenant {}", notification.getId(), scope.getTenant());
} catch (InvalidApplicationException e) { } catch (InvalidApplicationException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
}
throw new MyForbiddenException(this.errors.getMissingTenant().getCode(), this.errors.getMissingTenant().getMessage());
} }
throw new MyForbiddenException(this.errors.getMissingTenant().getCode(), this.errors.getMissingTenant().getMessage());
}
messageInfo.setTenantId(tenantInfo.getId()); messageInfo.setTenantId(tenantInfo.getId());
messageInfo.setTenantCode(tenantInfo.getCode()); messageInfo.setTenantCode(tenantInfo.getCode());
} else {
messageInfo.setTenantId(null);
messageInfo.setTenantCode(this.scope.getDefaultTenantCode());
}
} }
return messageInfo; return messageInfo;