-
Notifications
You must be signed in to change notification settings - Fork 0
Authentication done backend complete scan the file qodana and i will proceed to frontend #2
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -11,7 +11,7 @@ public class RegisterRequest { | |||||
| @NotBlank(message ="Email is required") | ||||||
| @Email(message ="Invalid email format") | ||||||
| private String email; | ||||||
|
|
||||||
| private String KeycloakId; | ||||||
| @NotBlank(message="Passsword is required") | ||||||
|
||||||
| @NotBlank(message="Passsword is required") | |
| @NotBlank(message="Password is required") |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,19 +1,19 @@ | ||||||
| package com.fitness.beastxfit.dto; | ||||||
|
|
||||||
| import com.fitness.beastxfit.model.UserRole; | ||||||
| import jakarta.persistence.Column; | ||||||
| import jakarta.persistence.EnumType; | ||||||
| import jakarta.persistence.Enumerated; | ||||||
| import lombok.Data; | ||||||
| import org.hibernate.annotations.CreationTimestamp; | ||||||
| import org.hibernate.annotations.UpdateTimestamp; | ||||||
|
|
||||||
| import java.time.LocalDateTime; | ||||||
|
|
||||||
| @Data | ||||||
| public class UserResponse { | ||||||
| private String id; | ||||||
|
|
||||||
| private String keyCloakId; | ||||||
|
||||||
| private String keyCloakId; | |
| private String keycloakId; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,10 +1,16 @@ | ||||||
| package com.fitness.beastxfit.repository; | ||||||
|
|
||||||
| import com.fitness.beastxfit.model.User; | ||||||
| import jakarta.validation.constraints.Email; | ||||||
| import jakarta.validation.constraints.NotBlank; | ||||||
|
Comment on lines
+4
to
+5
|
||||||
| import jakarta.validation.constraints.Email; | |
| import jakarta.validation.constraints.NotBlank; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -15,19 +15,30 @@ | |||||
| private final UserRepository repository; | ||||||
| public UserResponse register(RegisterRequest request) { | ||||||
| if (repository.existsByEmail(request.getEmail())){ | ||||||
| throw new RuntimeException(" Email already exist"); | ||||||
| User existingUser =repository.findByEmail(request.getEmail()); | ||||||
| UserResponse userResponse = new UserResponse(); | ||||||
| userResponse.setId(existingUser.getId()); | ||||||
| userResponse.setPassword(existingUser.getPassword()); | ||||||
|
||||||
| userResponse.setFirstName(existingUser.getFirstName()); | ||||||
| userResponse.setLastName(existingUser.getLastName()); | ||||||
| userResponse.setEmail(existingUser.getEmail()); | ||||||
| userResponse.setCreatedAt(existingUser.getCreatedAt()); | ||||||
| userResponse.setUpdatedAt(existingUser.getUpdatedAt()); | ||||||
| return userResponse; | ||||||
|
Comment on lines
17
to
+27
|
||||||
| } | ||||||
|
|
||||||
| User user=new User(); | ||||||
| user.setEmail(request.getEmail()); | ||||||
| user.setKeycloakId(request.getKeycloakId()); | ||||||
|
||||||
| user.setFirstName(request.getFirstName()); | ||||||
| user.setLastName(request.getLastName()); | ||||||
| user.setPassword((request.getPassword())); | ||||||
|
|
||||||
| User savedUser =repository.save(user); | ||||||
| UserResponse userResponse = new UserResponse(); | ||||||
| userResponse.setId(savedUser.getId()); | ||||||
| userResponse.setPassword(savedUser.getPassword()); | ||||||
|
||||||
| userResponse.setKeyCloakId(savedUser.getKeycloakId()); | ||||||
|
||||||
| userResponse.setKeyCloakId(savedUser.getKeycloakId()); | |
| userResponse.setKeycloakId(savedUser.getKeycloakId()); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| eureka: | ||
| client: | ||
| serviceUrl: | ||
| defaultZone: http://localhost:8761/eureka/ | ||
|
|
||
| spring: | ||
| application: | ||
| name: gateway-service | ||
| security: | ||
| oauth2: | ||
| resourceserver: | ||
| jwt: | ||
| jwk-set-uri: http://localhost:8181/realms/fitness/protocol/openid-connect/certs | ||
|
|
||
| cloud: | ||
| gateway: | ||
| routes: | ||
| - id: beastxfit | ||
| uri: lb://BEASTXFIT | ||
| predicates: | ||
| - Path=/api/users/** | ||
|
|
||
| - id: activity-service | ||
| uri: lb://ACTIVITY-SERVICE | ||
| predicates: | ||
| - Path=/api/activities/** | ||
|
|
||
| - id: ai-service | ||
| uri: lb://AI-SERVICE | ||
| predicates: | ||
| - Path=/api/recommendations/** | ||
|
|
||
| server: | ||
| port: 8080 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| /mvnw text eol=lf | ||
| *.cmd text eol=crlf |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| HELP.md | ||
| target/ | ||
| .mvn/wrapper/maven-wrapper.jar | ||
| !**/src/main/**/target/ | ||
| !**/src/test/**/target/ | ||
|
|
||
| ### STS ### | ||
| .apt_generated | ||
| .classpath | ||
| .factorypath | ||
| .project | ||
| .settings | ||
| .springBeans | ||
| .sts4-cache | ||
|
|
||
| ### IntelliJ IDEA ### | ||
| .idea | ||
| *.iws | ||
| *.iml | ||
| *.ipr | ||
|
|
||
| ### NetBeans ### | ||
| /nbproject/private/ | ||
| /nbbuild/ | ||
| /dist/ | ||
| /nbdist/ | ||
| /.nb-gradle/ | ||
| build/ | ||
| !**/src/main/**/build/ | ||
| !**/src/test/**/build/ | ||
|
|
||
| ### VS Code ### | ||
| .vscode/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| wrapperVersion=3.3.4 | ||
| distributionType=only-script | ||
| distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field name uses inconsistent casing. It's defined as "KeycloakId" with a capital 'K', which violates Java naming conventions where field names should start with a lowercase letter. Change this to "keycloakId" to follow standard Java conventions and maintain consistency with the User entity field naming.