Skip to content

Commit

Permalink
fix: missing validators in passenger and bookings
Browse files Browse the repository at this point in the history
  • Loading branch information
kirinnee committed Jul 13, 2024
1 parent ec402d9 commit c2f83d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions App/Modules/Bookings/API/V1/BookingValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public BookingPassengerReqValidator()
{
this.RuleFor(x => x.FullName)
.NotNull()
.MaximumLength(512);
.MaximumLength(512)
.Matches("^[a-zA-Z @./',\\-`*]+$");
this.RuleFor(x => x.Gender)
.NotNull()
.GenderValid();
Expand All @@ -19,7 +20,8 @@ public BookingPassengerReqValidator()
.DateValid();
this.RuleFor(x => x.PassportNumber)
.NotNull()
.MaximumLength(64);
.MaximumLength(20)
.Matches("^([a-zA-Z0-9]+)$");
}
}

Expand Down
9 changes: 6 additions & 3 deletions App/Modules/Passengers/API/V1/PassengerValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public CreatePassengerReqValidator()
.Matches("^[a-zA-Z @./',\\-`*]+$");
this.RuleFor(x => x.PassportNumber)
.NotNull()
.MaximumLength(64)
.MaximumLength(20)
.Matches("^([a-zA-Z0-9]+)$");
this.RuleFor(x => x.PassportExpiry)
.NotNull()
Expand All @@ -30,9 +30,12 @@ public UpdatePassengerReqValidator()
{
this.RuleFor(x => x.FullName)
.NotNull()
.Matches("^[a-zA-Z @./',-`*]+$");
.MaximumLength(512)
.Matches("^[a-zA-Z @./',\\-`*]+$");
this.RuleFor(x => x.PassportNumber)
.NotNull();
.NotNull()
.MaximumLength(20)
.Matches("^([a-zA-Z0-9]+)$");
this.RuleFor(x => x.PassportExpiry)
.NotNull()
.DateValid();
Expand Down

0 comments on commit c2f83d2

Please sign in to comment.