-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
170 additions
and
52 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
11 changes: 10 additions & 1 deletion
11
application/src/main/java/net/furizon/backend/feature/authentication/dto/LoginRequest.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,22 @@ | ||
package net.furizon.backend.feature.authentication.dto; | ||
|
||
import jakarta.validation.constraints.Email; | ||
import jakarta.validation.constraints.NotEmpty; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Size; | ||
import lombok.Data; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import static net.furizon.backend.feature.authentication.Const.EMAIL_REGEX; | ||
|
||
@Data | ||
public class LoginRequest { | ||
@NotNull | ||
@NotEmpty | ||
@Email(regexp = EMAIL_REGEX) | ||
private final String email; | ||
|
||
@NotNull | ||
@NotEmpty | ||
@Size(min = 6) | ||
private final String password; | ||
} |
55 changes: 55 additions & 0 deletions
55
...src/main/java/net/furizon/backend/feature/authentication/dto/PersonalUserInformation.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,55 @@ | ||
package net.furizon.backend.feature.authentication.dto; | ||
|
||
import jakarta.annotation.Nullable; | ||
import jakarta.validation.constraints.NotEmpty; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.PastOrPresent; | ||
import jakarta.validation.constraints.Size; | ||
import lombok.Data; | ||
|
||
import java.time.LocalDate; | ||
|
||
@Data | ||
public class PersonalUserInformation { | ||
@NotNull | ||
@NotEmpty | ||
@Size(min = 2) | ||
private final String firstName; | ||
|
||
@NotNull | ||
@NotEmpty | ||
@Size(min = 2) | ||
private final String lastName; | ||
|
||
@NotNull | ||
@PastOrPresent | ||
private final LocalDate birthday; | ||
|
||
@NotNull | ||
@NotEmpty | ||
@Size(min = 2) | ||
private final String birthCity; | ||
|
||
@NotNull | ||
@NotEmpty | ||
@Size(min = 2) | ||
private final String birthProvince; | ||
|
||
@NotNull | ||
@NotEmpty | ||
@Size(min = 2) | ||
private final String birthCountry; | ||
|
||
@NotNull | ||
@NotEmpty | ||
@Size(min = 2) | ||
private final String currentAddress; | ||
|
||
@NotNull | ||
@NotEmpty | ||
@Size(min = 2) | ||
private final String phoneNumber; | ||
|
||
@Nullable | ||
private final String socialSecurityNumber; | ||
} |
23 changes: 19 additions & 4 deletions
23
...ion/src/main/java/net/furizon/backend/feature/authentication/dto/RegisterUserRequest.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,17 +1,32 @@ | ||
package net.furizon.backend.feature.authentication.dto; | ||
|
||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.Email; | ||
import jakarta.validation.constraints.NotEmpty; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Pattern; | ||
import jakarta.validation.constraints.Size; | ||
import lombok.Data; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import static net.furizon.backend.feature.authentication.Const.EMAIL_REGEX; | ||
|
||
@Data | ||
public class RegisterUserRequest { | ||
@NotNull | ||
@NotEmpty | ||
@Email(regexp = EMAIL_REGEX) | ||
private final String email; | ||
|
||
@NotNull | ||
@NotEmpty | ||
@Size(min = 6) | ||
private final String password; | ||
|
||
@Nullable | ||
private final String fursuitName; | ||
@NotNull | ||
@Pattern(regexp = "^[\\p{L}\\p{N}\\p{M}_\\- ]{3,20}$") | ||
private final String fursonaName; | ||
|
||
@NotNull | ||
@Valid | ||
private final PersonalUserInformation personalUserInformation; | ||
} |
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
18 changes: 0 additions & 18 deletions
18
...n/java/net/furizon/backend/feature/authentication/validation/AuthenticationException.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
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
8 changes: 8 additions & 0 deletions
8
.../furizon/backend/feature/membership/action/addMembershipInfo/AddMembershipInfoAction.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,8 @@ | ||
package net.furizon.backend.feature.membership.action.addMembershipInfo; | ||
|
||
import net.furizon.backend.feature.authentication.dto.PersonalUserInformation; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public interface AddMembershipInfoAction { | ||
void invoke(long userId, @NotNull final PersonalUserInformation personalUserInformation); | ||
} |
44 changes: 44 additions & 0 deletions
44
...izon/backend/feature/membership/action/addMembershipInfo/JooqAddMembershipInfoAction.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,44 @@ | ||
package net.furizon.backend.feature.membership.action.addMembershipInfo; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import net.furizon.backend.feature.authentication.dto.PersonalUserInformation; | ||
import net.furizon.jooq.infrastructure.command.SqlCommand; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jooq.util.postgres.PostgresDSL; | ||
import org.springframework.stereotype.Component; | ||
|
||
import static net.furizon.jooq.generated.Tables.MEMBERSHIP_INFO; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class JooqAddMembershipInfoAction implements AddMembershipInfoAction { | ||
private final SqlCommand sqlCommand; | ||
|
||
@Override | ||
public void invoke(long userId, @NotNull PersonalUserInformation personalUserInformation) { | ||
sqlCommand.execute( | ||
PostgresDSL | ||
.insertInto( | ||
MEMBERSHIP_INFO, | ||
MEMBERSHIP_INFO.INFO_FIRST_NAME, | ||
MEMBERSHIP_INFO.INFO_LAST_NAME, | ||
MEMBERSHIP_INFO.INFO_BIRTH_CITY, | ||
MEMBERSHIP_INFO.INFO_BIRTH_REGION, | ||
MEMBERSHIP_INFO.INFO_BIRTH_COUNTRY, | ||
MEMBERSHIP_INFO.INFO_ADDRESS, | ||
MEMBERSHIP_INFO.INFO_PHONE, | ||
MEMBERSHIP_INFO.USER_ID | ||
) | ||
.values( | ||
personalUserInformation.getFirstName(), | ||
personalUserInformation.getLastName(), | ||
personalUserInformation.getBirthCity(), | ||
personalUserInformation.getBirthProvince(), | ||
personalUserInformation.getBirthCountry(), | ||
personalUserInformation.getCurrentAddress(), | ||
personalUserInformation.getPhoneNumber(), | ||
userId | ||
) | ||
); | ||
} | ||
} |
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