Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AYS-661 | Refactor email validation limits #431

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public class AdminRegistrationApplicationCompleteRequest {

@EmailAddress
@NotBlank
@Size(min = 2, max = 255)
private String emailAddress;

@NotBlank
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public class AysPasswordForgotRequest {

@EmailAddress
@NotBlank
@Size(min = 2, max = 255)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size kontrolu buradan kaldirilmis ancak @EmailAddress anotasyonu icerisine eklenmemis, o eklemeyi yapabilir miyiz?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size kontrolünü'de @agitrubard isteği üzerine kaldırdım. Kontrol saten EmailAddress içinde yapılıyormuş. Ekstra bir şey eklememe gerek var mı yine de?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Onceki commitinde hem burada @Size anotasyonu eklenmis hem de @EmailAddress anotasyonunun icerisine size kontrolu eklenmisti. Dolayisiyla @Size anotasyonunu kaldirmak yeterli olacakti ancak sonraki committe ikisi birden kaldirilmis. @EmailAddress anotasyonunun icerisine tekrar ekleme yapabilir misin?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tamamdır gözümden kaçmış affola.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hic onemli degil, yardimci olabildiysem ne mutlu bana 🙌

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emailaddress interface sınıfına hiç dokunmamıştım. Eğer commit mesajımla alakalı bahsetmişseniz ben orada emailAddress attribute'unun üstündeki anatasyon olarak belirtmek istedim. Eğer yanlışım varsa düzeltin çünkü commitlerimin hepsine baktım ama hiç ellememişim interface sınıfını.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EmailAddressValidator sınıfındaki bu değişiklikleri kastetmiştim
IMG-20250117-WA0016.jpg

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kusuruma bakmayın gözümden kaçmış şimdi düzelttim commit ettim.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rica ederim eline saglik 🙌🏼

Copy link
Contributor

@egehanasal egehanasal Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bu kisim tekrar kaldirilmis gorunuyor
image

private String emailAddress;

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public class AysUserCreateRequest {

@EmailAddress
@NotBlank
@Size(min = 2, max = 255)
private String emailAddress;

@Valid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public class AysUserUpdateRequest {

@EmailAddress
@NotBlank
@Size(min = 2, max = 255)
private String emailAddress;

@Valid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class EmailAddressValidator implements ConstraintValidator<EmailAddress, String>
* <li>u@[email protected]</li>
* <li>[email protected]</li>
* <li>user</li>
* <li>[email protected]</li>
* </ul>
*
* @param email object to validate
Expand All @@ -42,6 +43,10 @@ public boolean isValid(String email, ConstraintValidatorContext constraintValida
return true;
}

if (email.length() <= 6 || email.length() >= 254) {
return this.buildViolation(constraintValidatorContext, "length must be between 6 and 254 characters");
}

if (email.startsWith(" ") || email.endsWith(" ")) {
return this.buildViolation(constraintValidatorContext, "email must not start or end with whitespace");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ public class EmergencyEvacuationApplication extends BaseDomainModel {
private Boolean isInPerson;
private Boolean hasObstaclePersonExist;
private String notes;

agitrubard marked this conversation as resolved.
Show resolved Hide resolved
private Institution institution;


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Burayi eski haline cevirebiliriz

/**
* Checks if the application does not have an associated institution.
*
Expand All @@ -62,7 +60,6 @@ public boolean isInstitutionOwner(final String institutionId) {
return this.institution.getId().equals(institutionId);
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Burayi eski haline cevirebiliriz

/**
* Marks the emergency evacuation application as pending.
* Generates a reference number and updates the status to pending.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ public class EmergencyEvacuationApplicationEntity extends BaseEntity {
@Column(name = "NOTES")
private String notes;


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Burayi eski haline cevirebiliriz

@OneToOne
@JoinColumn(name = "INSTITUTION_ID", insertable = false, updatable = false)
private InstitutionEntity institution;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.ays.common.util.validation.Name;
import org.hibernate.validator.constraints.Range;


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Burayi eski haline cevirebiliriz

/**
* Represents a request to complete emergency evacuation request. The request includes fields for the required user
* information, such as the user's phone number, as well as their first and last name.
Expand Down Expand Up @@ -64,7 +63,6 @@ public class EmergencyEvacuationApplicationRequest {
@Size(min = 2, max = 100)
private String targetDistrict;


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Burayi eski haline cevirebiliriz

@Name
@Size(min = 2, max = 100)
private String applicantFirstName;
Expand All @@ -86,7 +84,6 @@ private boolean isAllApplicantFieldsFilled() {
return true;
}


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@egehanasal 'ın söylediklerine ek olarak burayı da eski hâline alabiliriz.

return !StringUtils.isBlank(this.applicantFirstName) && !StringUtils.isBlank(this.applicantLastName)
&&
this.applicantPhoneNumber != null
Expand Down Expand Up @@ -115,11 +112,11 @@ private boolean isPhoneNumberMustNotBeSameOne() {
@SuppressWarnings("This method is unused by the application directly but Spring is using it in the background.")
private boolean isSourceCityAndDistrictDifferentFromTargetCityAndDistrict() {

if (this.sourceCity == null || this.sourceDistrict == null || this.targetCity == null || this.targetDistrict == null) {
if (this.sourceCity == null || this.sourceDistrict == null || this.targetCity == null || this.targetDistrict == null) {
return true;
}
}

if (!this.sourceCity.equalsIgnoreCase(this.targetCity)){
if (!this.sourceCity.equalsIgnoreCase(this.targetCity)) {
return true;
}

Expand Down
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bu dosyayı geri alabilir miyiz? Formatı bozulmuş görünüyor.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bu dosya hâlâ eski hâline alınmamış gibi duruyor

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pr actiktan veya yeni bir commit attiktan sonra sag ustten degisiklik yapilan satir sayisina goz atmak, istemedigimiz degisiklikler yapip yapmadigimiz konusunda bir fikir verip boyle durumlara karsi uyarabilir 🙌

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bu kisim hala ayni sekilde gorunuyor

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public EmergencyEvacuationRequestBuilder withValidValues() {
.withApplicantPhoneNumber(new AysPhoneNumberRequestBuilder().withValidValues().build())
.withAddress("Lorem Ipsum is simply dummy text of the printing and typesetting industry.");
}

agitrubard marked this conversation as resolved.
Show resolved Hide resolved
public EmergencyEvacuationRequestBuilder withFirstName(String firstName) {
data.setFirstName(firstName);
return this;
Expand Down Expand Up @@ -85,4 +84,4 @@ public EmergencyEvacuationRequestBuilder withoutApplicant() {
return this;
}

}
}
agitrubard marked this conversation as resolved.
Show resolved Hide resolved
Loading