Skip to content

Commit

Permalink
Improve validation
Browse files Browse the repository at this point in the history
Signed-off-by: Niels Thykier <[email protected]>
  • Loading branch information
nt-gt committed Jul 7, 2023
1 parent 75b4efc commit 285e485
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.RequiredArgsConstructor;
import org.dcsa.issuance.domain.persistence.entity.enums.IssuanceRequestState;
Expand All @@ -14,6 +15,7 @@
record ChangeStateTO(
@NotNull
@Size(max = 20)
@Pattern(regexp = "^\\S+(\\s+\\S+)*$")
String transportDocumentReference,

@NotNull
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.dcsa.issuance.controller.unofficial;

import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.RequiredArgsConstructor;
import org.dcsa.issuance.service.IssueRequestResponseService;
Expand All @@ -11,6 +12,7 @@
record PendingIssuanceRequestResponseTO(
@NotNull
@Size(max = 20)
@Pattern(regexp = "^\\S+(\\s+\\S+)*$")
String transportDocumentReference
) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class IssueParty {
@Column(name = "location_of_registration", length = 2)
private String locationOfRegistration;


@Column(name = "tax_reference", length = 100)
private String taxReference;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package org.dcsa.issuance.transferobjects;

import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Builder;
import org.dcsa.issuance.transferobjects.enums.IssuanceResponseCodeTO;

public record IssuanceRequestResponseTO(
@NotNull
@Size(max = 20)
@Pattern(regexp = "^\\S+(\\s+\\S+)*$")
String transportDocumentReference,
@NotNull
IssuanceResponseCodeTO issuanceResponseCode,
@Size(max = 255)
@Pattern(regexp = "^\\S+(\\s+\\S+)*$")
String reason

) {
Expand Down

0 comments on commit 285e485

Please sign in to comment.