-
Notifications
You must be signed in to change notification settings - Fork 1
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
Bf 17 account page #65
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
ae723fc
BF-84 Initial Profile page design
AbdelrahmanMosly fd93ce4
BF-85 add desired classes
AbdelrahmanMosly 201ee17
BF-86 create requests
AbdelrahmanMosly c73c8aa
BF-86 fix return of the request in front
AbdelrahmanMosly e9e7d37
BF-87 display response
AbdelrahmanMosly 1b985ff
Merge branch 'Milestone3' into BF-17-Account-page
AbdelrahmanMosly dcecf46
BF-88 get data from DB
AbdelrahmanMosly 4c51e11
BF-86 use real data
AbdelrahmanMosly d1c359c
BF-89 add icons for profile page
AbdelrahmanMosly dfe4776
BF-86 edit request mapping
AbdelrahmanMosly b5fa26c
BF-86 edit request mapping
AbdelrahmanMosly 1077d6c
BF-86 add request to security
AbdelrahmanMosly a9e1482
BF-86 edit request mapping
AbdelrahmanMosly 2908b66
BF-90 deisgn with real data and tested
AbdelrahmanMosly 3414e96
import dart::ffi
AbdelrahmanMosly 1747372
Revert "BF-90 deisgn with real data and tested"
AbdelrahmanMosly 2b07ce5
Revert "import dart::ffi"
AbdelrahmanMosly 063128c
Revert "Revert "BF-90 deisgn with real data and tested""
AbdelrahmanMosly b2b936a
BF-17 remove import dart::ffi from model in front
AbdelrahmanMosly 75b861b
BF-17 change package name
AbdelrahmanMosly 22b1545
BF-17 import package
AbdelrahmanMosly 039d02a
BF-17 deploy back to update front
AbdelrahmanMosly e6d5746
BF-91 edit custom field
AbdelrahmanMosly eb1af8e
BF-92 final touches
AbdelrahmanMosly ed5cc47
Merge branch 'Milestone3' into BF-17-Account-page
AbdelrahmanMosly 40e8781
removing warning and redundant import due to merge
AbdelrahmanMosly 0b54e2c
BF-65 remove duplicate package
AbdelrahmanMosly 5d50cd2
BF-65remove duplicate tests
AbdelrahmanMosly 5364b4e
BF-17 tests
AbdelrahmanMosly 198ee9a
BF-17 show email
AbdelrahmanMosly f8cf9b4
BF-17 remove unnecessary debug print
AbdelrahmanMosly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
23 changes: 23 additions & 0 deletions
23
backend/src/main/java/com/brainfood/backend/controllers/UserProfileController.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,23 @@ | ||
package com.brainfood.backend.controllers; | ||
|
||
import com.brainfood.backend.DAO; | ||
import com.brainfood.backend.models.UserProfile; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.security.core.context.SecurityContextHolder; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@ComponentScan | ||
@RestController | ||
@RequestMapping("account_settings") | ||
public class UserProfileController { | ||
|
||
@Autowired | ||
DAO DAO; | ||
@GetMapping("/userProfile") | ||
public UserProfile getUserProfile(){ | ||
return DAO.getUserProfile(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
backend/src/main/java/com/brainfood/backend/models/UserProfile.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,22 @@ | ||
package com.brainfood.backend.models; | ||
|
||
import lombok.*; | ||
|
||
import java.util.Date; | ||
|
||
@Getter @Setter | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class UserProfile { | ||
|
||
private String username; | ||
|
||
private String email; | ||
|
||
private float height; | ||
|
||
private float weight; | ||
|
||
private Date birthdate; | ||
} |
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
78 changes: 0 additions & 78 deletions
78
backend/src/test/java/com/brainfood/backend/BodyInfoTest.java
This file was deleted.
Oops, something went wrong.
137 changes: 0 additions & 137 deletions
137
backend/src/test/java/com/brainfood/backend/IngredientTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Autowired here isn't necessary, as you can replace it by constructor injection which has alot of advantages as following:
the dependencies are clearly identified. There is no way to forget one when testing, or instantiating the object in any other circumstance (like creating the bean instance explicitly in a config class).
the dependencies can be final, which helps with robustness and thread-safety.
you don't need reflection to set the dependencies. InjectMocks is still usable, but not necessary. you can just create mocks by yourself and inject them by simply calling the constructor.
by the autowired approach, you are allowing anyone (in different class outside/inside the Spring container) to create an instance using default constructor (like new SomeService()), which is NOT good as you need SomeOtherService object (as a dependency) for your SomeService.
The answer is
yes
and you can do it even for JPA repositories.Spring scans your classes for constructor that matches your class' fields. Find details here:
Additional Details
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.
I wouldn't prefer Autowired my self as well here but I decided to use it to be consistent with the rest of the project.
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.
Good, so we should mark it as an issue. I think it will need a huge refactoring, but it will be worthy.