-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FSADT1-712] feat: add client submit validation (#423)
* [FSADT1-712] feat: add client submit validation * resolve conflict * Fix docs * Fixes * Fixes
- Loading branch information
1 parent
b58020e
commit 01a226a
Showing
28 changed files
with
871 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
backend/src/main/java/ca/bc/gov/app/dto/ValidationError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package ca.bc.gov.app.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.With; | ||
|
||
@Data | ||
@With | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class ValidationError { | ||
private String fieldId; | ||
private String errorMsg; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
backend/src/main/java/ca/bc/gov/app/dto/client/ClientBusinessTypeDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package ca.bc.gov.app.dto.client; | ||
|
||
public record ClientBusinessTypeDto(ClientTypeDto clientType) { | ||
public record ClientBusinessTypeDto(ClientValueTextDto clientType) { | ||
} |
28 changes: 14 additions & 14 deletions
28
backend/src/main/java/ca/bc/gov/app/dto/client/ClientContactDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
package ca.bc.gov.app.dto.client; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.With; | ||
|
||
@Schema( | ||
description = "Client information contact", | ||
title = "ClientContact", | ||
example = """ | ||
{ | ||
"email": "[email protected]", | ||
"firstName": "JAMES", | ||
"index": 0, | ||
"lastName": "BAXTER", | ||
"middleInitial": "GRAHAM", | ||
"contactType": "person" | ||
}""" | ||
{ | ||
"type": "person", | ||
"firstName": "JAMES", | ||
"lastName": "BAXTER", | ||
"phoneNumber": "123456789" | ||
"email": "[email protected]", | ||
}""" | ||
) | ||
@With | ||
public record ClientContactDto( | ||
@Schema(description = "The type of contact", | ||
example = "person") | ||
String contactType, | ||
String type, | ||
|
||
@Schema(description = "The first name of the contact", | ||
example = "JAMES") | ||
String firstName, | ||
|
||
@Schema(description = "Last name of the contact", | ||
example = "BAXTER") | ||
String lastName, | ||
@Schema(description = "Contact phone number", example = "555 555 5555") | ||
|
||
@Schema(description = "Contact phone number", example = "123456789") | ||
String phoneNumber, | ||
|
||
@Schema(description = "Email address to get in touch with contact", | ||
example = "[email protected]") | ||
String email, | ||
@Schema(description = "The index for this address. It is used to order the addresses", | ||
example = "3") | ||
|
||
int index | ||
) { | ||
} |
14 changes: 14 additions & 0 deletions
14
backend/src/main/java/ca/bc/gov/app/dto/client/ClientDetailsAddressDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package ca.bc.gov.app.dto.client; | ||
|
||
import lombok.With; | ||
|
||
@With | ||
public record ClientDetailsAddressDto( | ||
String streetAddress, | ||
ClientValueTextDto country, | ||
ClientValueTextDto province, | ||
String city, | ||
String postalCode, | ||
int index | ||
) { | ||
} |
4 changes: 0 additions & 4 deletions
4
backend/src/main/java/ca/bc/gov/app/dto/client/ClientTypeDto.java
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
backend/src/main/java/ca/bc/gov/app/exception/ValidationException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package ca.bc.gov.app.exception; | ||
|
||
import ca.bc.gov.app.dto.ValidationError; | ||
import java.util.List; | ||
import lombok.Getter; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
import org.springframework.web.server.ResponseStatusException; | ||
|
||
@Getter | ||
@ResponseStatus(value = HttpStatus.BAD_REQUEST) | ||
public class ValidationException extends ResponseStatusException { | ||
private final List<ValidationError> errors; | ||
|
||
public ValidationException(List<ValidationError> errors) { | ||
super(HttpStatus.BAD_REQUEST, "Validation failed"); | ||
this.errors = errors; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.