Skip to content

Commit

Permalink
fix(FSADT1-1141): updating username that is saved
Browse files Browse the repository at this point in the history
  • Loading branch information
paulushcgcj committed Jan 16, 2024
1 parent ff65fdd commit c078853
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public final class ApplicationConstant {
public static final String POSTGRES_ATTRIBUTE_SCHEMA = "nrfc";

public static final String USERID_HEADER = "x-user-id";
public static final String BUSINESSID_HEADER = "x-user-businessid";
public static final String USERMAIL_HEADER = "x-user-email";
public static final String USERNAME_HEADER = "x-user-name";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import ca.bc.gov.app.validator.client.ClientSubmitRequestValidator;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.server.reactive.ServerHttpResponse;
Expand Down Expand Up @@ -77,6 +78,7 @@ public Flux<ClientListSubmissionDto> listSubmissions(
public Mono<Void> submit(
@RequestBody ClientSubmissionDto request,
@RequestHeader(ApplicationConstant.USERID_HEADER) String userId,
@RequestHeader(name = ApplicationConstant.BUSINESSID_HEADER, defaultValue = StringUtils.EMPTY) String businessId,
@RequestHeader(ApplicationConstant.USERMAIL_HEADER) String userEmail,
@RequestHeader(ApplicationConstant.USERNAME_HEADER) String userName,
ServerHttpResponse serverResponse) {
Expand All @@ -85,7 +87,7 @@ public Mono<Void> submit(
Mono.error(new InvalidRequestObjectException("no request body was provided"))
)
.doOnNext(this::validate)
.flatMap(submissionDto -> clientService.submit(submissionDto, userId, userEmail, userName))
.flatMap(submissionDto -> clientService.submit(submissionDto, userId, userEmail, userName,businessId))
.doOnNext(submissionId ->
serverResponse
.getHeaders()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ public Mono<Integer> submit(
ClientSubmissionDto clientSubmissionDto,
String userId,
String userEmail,
String userName
String userName,
String businessId
) {

return
Expand All @@ -140,7 +141,7 @@ public Mono<Integer> submit(
.submissionType(SubmissionTypeCodeEnum.SPP)
.submissionDate(LocalDateTime.now())
.createdBy(userId)
.updatedBy(userId)
.updatedBy(userName)
.build()
)
//Save submission to begin with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void shouldListAndSearch(
.jsonPath("$.[0].requestType").isEqualTo("Submission pending processing")
.jsonPath("$.[0].status").isEqualTo("New")
.jsonPath("$.[0].clientType").isEqualTo("Registered sole proprietorship")
.jsonPath("$.[0].user").isEqualTo("testUserId");
.jsonPath("$.[0].user").isEqualTo("Test User");
}
}

Expand All @@ -229,7 +229,7 @@ void shouldGetSubmissionDetails() {
.expectStatus().isOk()
.expectBody()
.jsonPath("$.submissionId").isEqualTo(1)
.jsonPath("$.updateUser").isEqualTo("testUserId")
.jsonPath("$.updateUser").isEqualTo("Test User")
.jsonPath("$.submissionType").isEqualTo("Submission pending processing");
}

Expand Down

0 comments on commit c078853

Please sign in to comment.