-
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.
fix(FE): validation message and form submission (#425)
* fix: fixing validation on the backend * fix(FE): validation message parsing adding a failsafe mechanism to avoid parsing wrong returned data. * feat(FE): adding form submission and validation - added form submission using composition api - changed the name of the fields on the validation to match the name of the property on the object - created a ContactComponent to aggregate the contact information - added submission check example code
- Loading branch information
Paulo Gomes da Cruz Junior
authored
Mar 30, 2023
1 parent
01a226a
commit 5ac42f7
Showing
19 changed files
with
345 additions
and
244 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
53 changes: 0 additions & 53 deletions
53
backend/src/main/java/ca/bc/gov/app/dto/bcregistry/ClientAddressDataDto.java
This file was deleted.
Oops, something went wrong.
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,5 +1,6 @@ | ||
package ca.bc.gov.app.dto.bcregistry; | ||
|
||
import ca.bc.gov.app.dto.client.ClientAddressDto; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.List; | ||
import lombok.With; | ||
|
@@ -28,7 +29,14 @@ | |
"province": {"value": "QC", text": "Quebec"}, | ||
"city": "Montreal", | ||
"postalCode": "H3B1A7", | ||
"index": 1 | ||
"index": 1, | ||
"contacts":{ | ||
"type": "person", | ||
"firstName": "JAMES", | ||
"lastName": "BAXTER", | ||
"phoneNumber": "123456789" | ||
"email": "[email protected]", | ||
} | ||
} | ||
] | ||
}""" | ||
|
@@ -63,6 +71,6 @@ public record ClientDetailsDto( | |
"index": 1 | ||
} | ||
]""") | ||
List<ClientAddressDataDto> addresses | ||
List<ClientAddressDto> addresses | ||
) { | ||
} |
54 changes: 54 additions & 0 deletions
54
backend/src/main/java/ca/bc/gov/app/dto/client/ClientAddressDto.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,13 +1,67 @@ | ||
package ca.bc.gov.app.dto.client; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.List; | ||
import lombok.With; | ||
|
||
@Schema( | ||
description = "An address information", | ||
title = "ClientAddressData", | ||
example = """ | ||
{ | ||
"streetAddress": "123 Main St", | ||
"country": { | ||
"value": "CA", | ||
"text": "Canada" | ||
}, | ||
"province": { | ||
"value": "ON", | ||
"text": "Ontario" | ||
}, | ||
"city": "Toronto", | ||
"postalCode": "M5V2L7", | ||
"index": 1, | ||
"contacts":{ | ||
"type": "person", | ||
"firstName": "JAMES", | ||
"lastName": "BAXTER", | ||
"phoneNumber": "123456789" | ||
"email": "[email protected]", | ||
} | ||
}""" | ||
) | ||
@With | ||
public record ClientAddressDto( | ||
@Schema(description = "The street address", example = "123 Main St") | ||
String streetAddress, | ||
@Schema(description = "The country for this address", example = """ | ||
{ | ||
"value": "CA", | ||
"text": "Canada" | ||
}""") | ||
ClientValueTextDto country, | ||
@Schema(description = "The province or state for this address", example = """ | ||
{ | ||
"value": "ON", | ||
"text": "Ontario" | ||
}""") | ||
ClientValueTextDto province, | ||
@Schema(description = "The city for this address", example = "Toronto") | ||
String city, | ||
@Schema(description = "The postal code or zip code for this address", example = "M5V2L7") | ||
String postalCode, | ||
@Schema(description = "The index for this address. It is used to order the addresses", | ||
example = "3") | ||
int index, | ||
|
||
@Schema(description = "A list of contacts for this address",example = """ | ||
{ | ||
"type": "person", | ||
"firstName": "JAMES", | ||
"lastName": "BAXTER", | ||
"phoneNumber": "123456789" | ||
"email": "[email protected]", | ||
}""") | ||
List<ClientContactDto> contacts | ||
) { | ||
} |
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 |
---|---|---|
|
@@ -7,7 +7,10 @@ | |
title = "ClientContact", | ||
example = """ | ||
{ | ||
"type": "person", | ||
"contactType": { | ||
"value": "person", | ||
"text": "Person" | ||
}, | ||
"firstName": "JAMES", | ||
"lastName": "BAXTER", | ||
"phoneNumber": "123456789" | ||
|
@@ -17,7 +20,7 @@ | |
public record ClientContactDto( | ||
@Schema(description = "The type of contact", | ||
example = "person") | ||
String type, | ||
ClientValueTextDto contactType, | ||
|
||
@Schema(description = "The first name of the contact", | ||
example = "JAMES") | ||
|
@@ -34,6 +37,8 @@ public record ClientContactDto( | |
example = "[email protected]") | ||
String email, | ||
|
||
@Schema(description = "The index for this address. It is used to order the addresses", | ||
example = "3") | ||
int index | ||
) { | ||
} |
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
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.