Skip to content

Commit

Permalink
Merge branch 'main' into fix/FSADT1-1042
Browse files Browse the repository at this point in the history
  • Loading branch information
paulushcgcj authored Dec 11, 2023
2 parents d1ade48 + 1b89bbb commit ccf1732
Show file tree
Hide file tree
Showing 15 changed files with 1,450 additions and 203 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: bcgov-nr/[email protected].0
- uses: bcgov-nr/[email protected].1
name: Build (${{ matrix.package }})
with:
package: ${{ matrix.package }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ jobs:
uses: actions/checkout@v4

- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@0.15.0
uses: aquasecurity/trivy-action@0.16.0
with:
scan-type: "fs"
format: "sarif"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package ca.bc.gov.app.converters;


import ca.bc.gov.app.entity.client.EmailLogEntity;
import ca.bc.gov.app.entity.client.SubmissionMatchDetailEntity;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.r2dbc.postgresql.codec.Json;
Expand All @@ -12,7 +10,6 @@
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.reactivestreams.Publisher;
import org.springframework.data.r2dbc.mapping.event.AfterConvertCallback;
import org.springframework.data.r2dbc.mapping.event.BeforeConvertCallback;
Expand Down Expand Up @@ -62,6 +59,7 @@ private Json convertTo(EmailLogEntity entity) {

}

@SuppressWarnings("unchecked")
private Map<String, Object> convertFrom(EmailLogEntity entity) {
return
Optional
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package ca.bc.gov.app.converters;


import ca.bc.gov.app.entity.client.SubmissionMatchDetailEntity;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.r2dbc.postgresql.codec.Json;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.reactivestreams.Publisher;
import org.springframework.data.r2dbc.mapping.event.AfterConvertCallback;
import org.springframework.data.r2dbc.mapping.event.BeforeConvertCallback;
Expand Down Expand Up @@ -60,12 +59,12 @@ private Json convertTo(SubmissionMatchDetailEntity entity) {

}

@SuppressWarnings("unchecked")
private Map<String, Object> convertFrom(SubmissionMatchDetailEntity entity) {
return
Optional
return Optional
.ofNullable(entity.getMatchingField())
.map(Json::asString)
.map(value -> StringUtils.defaultString(value, "{}"))
.map(value -> Objects.toString(value, "{}"))
.map(value -> {
try {
return mapper.readValue(value, Map.class);
Expand All @@ -77,4 +76,5 @@ private Map<String, Object> convertFrom(SubmissionMatchDetailEntity entity) {
.map(value -> (Map<String, Object>) value)
.orElse(Map.of());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

import ca.bc.gov.app.repository.client.EmailLogRepository;
import ca.bc.gov.app.service.ches.ChesService;
import java.util.concurrent.Executors;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

Expand All @@ -24,14 +22,14 @@ public void startResendJob() {
.doOnNext(emailLogEntity ->
log.info("Resending failed email with ID: " + emailLogEntity.getEmailLogId())
)
.flatMap(emailLogEntity -> chesService.sendEmail(emailLogEntity.getTemplateName(),
emailLogEntity.getEmailAddress(),
emailLogEntity.getEmailSubject(),
emailLogEntity.getVariables(),
emailLogEntity.getEmailLogId()
.flatMap(emailLogEntity -> chesService.sendEmail(
emailLogEntity.getTemplateName(),
emailLogEntity.getEmailAddress(),
emailLogEntity.getEmailSubject(),
emailLogEntity.getVariables(),
emailLogEntity.getEmailLogId()
)
).subscribe();
}


}
14 changes: 11 additions & 3 deletions backend/src/main/resources/db/migration/V1__initializing_data.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- DROPPING TABLES AND SEQUENCES IF EXIST AS THIS IS THE INIT FILE TO CREATE THE DB
-- DROPPING TABLES AND SEQUENCES IF EXIST AS THIS is THE INIT FILE TO CREATE THE DB
--
drop table if exists nrfc.submission_detail;
drop table if exists nrfc.submission_matching_detail;
Expand Down Expand Up @@ -335,9 +335,17 @@ create table if not exists nrfc.email_log (
constraint email_log_id_pk primary key (email_log_id)
);

comment on table nrfc.email_log is 'TODO';
comment on table nrfc.email_log is 'Stores email log information';
comment on column nrfc.email_log.email_log_id is 'Incremental id generated for a submission email log.';
-- TODO: Complete comments
comment on column nrfc.email_log.email_id is 'Identifier for the associated email assigned by CHES (if applicable).';
comment on column nrfc.email_log.email_sent_ind is 'Indicator for whether the email has been sent (''Y'' for Yes, ''N'' for No).';
comment on column nrfc.email_log.exception_message is 'Textual message describing any exceptions that occurred during email processing.';
comment on column nrfc.email_log.template_name is 'Name of the email template used for sending the email.';
comment on column nrfc.email_log.email_address is 'Email address to which the email is sent.';
comment on column nrfc.email_log.email_subject is 'Subject of the email.';
comment on column nrfc.email_log.email_variables is 'JSONB field to store variables related to the email content.';
comment on column nrfc.email_log.create_timestamp is 'Timestamp indicating when the email log entry was created.';
comment on column nrfc.email_log.update_timestamp is 'Timestamp indicating when the email log entry was last updated.';

--
-- SEQUENCES
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ services:

backend:
container_name: backend
image: maven:3.9.5-eclipse-temurin-17
image: maven:3.9.6-eclipse-temurin-17
entrypoint: sh -c "cd /app && mvn -ntp spring-boot:run -Dspring-boot.run.jvmArguments='-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n'"
environment:
POSTGRESQL_HOST: *POSTGRES_HOST
Expand Down
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN npm ci && \
npm run build

# Caddy
FROM caddy:2.7.5-alpine
FROM caddy:2.7.6-alpine

# Copy static files and config
COPY --from=build /app/dist /srv
Expand Down
Loading

0 comments on commit ccf1732

Please sign in to comment.