-
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.
refactor(backend):align with google java standards
- Loading branch information
1 parent
a3e0ce5
commit 76bd186
Showing
6 changed files
with
52 additions
and
19 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
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
5 changes: 5 additions & 0 deletions
5
backend/src/main/java/com/greenfoxacademy/backend/dtos/RegisterResponseDto.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
16 changes: 10 additions & 6 deletions
16
backend/src/main/java/com/greenfoxacademy/backend/models/User.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,30 +1,34 @@ | ||
package com.greenfoxacademy.backend.models; | ||
|
||
import jakarta.persistence.*; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* Represents a user entity in the system. This class is a data model | ||
* that maps to the user table in the database | ||
* that maps to the user table in the database. | ||
*/ | ||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Entity | ||
@Table (name = "_user") | ||
@Table(name = "_user") | ||
public class User { | ||
|
||
@Id | ||
@GeneratedValue | ||
private Integer id; | ||
private String firstName; | ||
private String lastName; | ||
@Column (unique = true) | ||
@Column(unique = true) | ||
private String email; | ||
private String password; | ||
|
||
} |
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
29 changes: 21 additions & 8 deletions
29
backend/src/main/java/com/greenfoxacademy/backend/services/ValidPassword.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,26 +1,39 @@ | ||
package com.greenfoxacademy.backend.services; | ||
|
||
|
||
import static java.lang.annotation.ElementType.ANNOTATION_TYPE; | ||
import static java.lang.annotation.ElementType.FIELD; | ||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
import jakarta.validation.Constraint; | ||
import jakarta.validation.Payload; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.*; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
/** | ||
* ValidPassword annotation to mark a field as a password which should be validated. | ||
*/ | ||
@Documented | ||
@Constraint (validatedBy = PasswordConstraintValidator.class) | ||
@Target ({TYPE, FIELD, ANNOTATION_TYPE}) | ||
@Retention (RUNTIME) | ||
@Retention(RUNTIME) | ||
public @interface ValidPassword { | ||
|
||
|
||
/** | ||
* Message to be displayed when the password is invalid. | ||
*/ | ||
String message() default "Invalid Password"; | ||
|
||
|
||
/** | ||
* Groups. | ||
*/ | ||
Class<?>[] groups() default {}; | ||
|
||
|
||
/** | ||
* Payload. | ||
*/ | ||
Class<? extends Payload>[] payload() default {}; | ||
|
||
} |