-
Notifications
You must be signed in to change notification settings - Fork 5
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
Feature/product testcode #57
Changes from all commits
47230d2
0e0b953
cad3149
919c7c2
37f1e0e
818ff84
f91cd89
64125ee
03de4b9
f5218ba
2746aad
5f9c5de
ffb1095
bd26605
aaba17c
b678a34
20beabb
45d60da
b32d9ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,9 @@ services: | |
|
||
# batch: | ||
# build: ./module-batch | ||
# image: ${IMAGE} | ||
# ports: | ||
# - "8082:8080" | ||
# - "8082:8082" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๐๐ป |
||
# depends_on: | ||
# - db-edit | ||
# | ||
|
@@ -36,7 +37,7 @@ services: | |
# db-read: | ||
# image: younglong/pg-washpedia:latest | ||
# volumes: | ||
# - postgreEditDB:/var/lib/postgresql/data | ||
# - ./postgreEditDB:/var/lib/postgresql/data | ||
# environment: | ||
# POSTGRES_DB: read_db | ||
# POSTGRES_USER: ${{ secrets.PROJECT_USER }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the code patch you provided, here are some of the improvements and bug risks I can identify:
Additionally, it would be helpful to review other parts of the codebase, including Dockerfile, environment variables, and any additional services or functionality not included in the given patch. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lombok.anyConstructor.addConstructorProperties=true |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
/** | ||
* DTO for {@link com.kernel360.member.entity.Member} | ||
*/ | ||
public record MemberDto(Integer memberNo, | ||
public record MemberDto(Long memberNo, | ||
String id, | ||
String email, | ||
String password, | ||
|
@@ -21,7 +21,7 @@ public record MemberDto(Integer memberNo, | |
) { | ||
|
||
public static MemberDto of( | ||
Integer memberNo, | ||
Long memberNo, | ||
String id, | ||
String email, | ||
String password, | ||
|
@@ -64,14 +64,14 @@ public static MemberDto from(Member entity) { | |
); | ||
} | ||
|
||
public Member toEntity(MemberDto memberDto) { | ||
public Member toEntity() { | ||
return Member.of( | ||
this.memberNo, | ||
this.id, | ||
this.email, | ||
this.password, | ||
this.gender, | ||
this.birthdate | ||
this.memberNo(), | ||
this.id(), | ||
this.email(), | ||
this.password(), | ||
this.gender(), | ||
this.birthdate() | ||
); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Overall, the code patch looks fine with a few suggestions for improvement:
Besides these suggestions, ensure that the changes made match the requirements of your application, as I can only provide general code review suggestions based on the given information. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ ResponseEntity<ProductDto> findProductById(@PathVariable("id") Long productId) { | |
.orElse(ResponseEntity.status(HttpStatus.NOT_FOUND).build()); | ||
} | ||
|
||
@GetMapping("/products/") | ||
@GetMapping("/products/search") | ||
ResponseEntity<List<ProductDto>> findProductByKeyword(@RequestParam("keyword") String keyword){ | ||
final List<ProductDto> list = productService.getProductListByKeyword(keyword); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code patch you provided is quite small, but here are a few observations:
Overall, without seeing the complete context or implementation details, it's difficult to identify any other potential issues or suggest further improvements. However, these points should give you some initial areas to consider for your code review. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the provided code patch, here's a brief code review:
Remember to also consider best practices related to security, exception handling, logging, and testing based on your project requirements. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
* DTO for {@link com.kernel360.product.entity.Product} | ||
*/ | ||
|
||
public record ProductDto(Integer productNo, | ||
public record ProductDto(Long productNo, | ||
String productName, | ||
String barcode, | ||
String description, | ||
|
@@ -22,7 +22,7 @@ public record ProductDto(Integer productNo, | |
) { | ||
|
||
public static ProductDto of( | ||
Integer productNo, | ||
Long productNo, | ||
String productName, | ||
String barcode, | ||
String description, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here are some observations and suggestions for your code patch:
Remember to also test your code changes thoroughly to catch any potential bugs or issues that may arise as a result of these modifications. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,7 @@ public void setup() { | |
void ๋ก๊ทธ์ธ() throws Exception { | ||
|
||
MemberDto memberDto = MemberDto.of("testID", "testPassword"); | ||
MemberDto memberInfo = new MemberDto(1, | ||
MemberDto memberInfo = new MemberDto(1L, | ||
"test01", | ||
"[email protected]", | ||
"", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
|
||
class MemberTest { | ||
|
||
private Integer memberNo; | ||
private Long memberNo; | ||
private String id; | ||
private String email; | ||
private String password; | ||
|
@@ -20,7 +20,7 @@ class MemberTest { | |
|
||
@BeforeEach | ||
void ํ ์คํธ์ค๋น() { | ||
memberNo = 1; | ||
memberNo = 1L; | ||
id = "user123"; | ||
email = "[email protected]"; | ||
password = "password123"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,7 @@ public void init() { | |
/** given **/ | ||
MemberDto loginDto = MemberDto.of("test03", "1234qwer"); | ||
Member mockLoginEntity = Member.loginMember(loginDto.id(), loginDto.password()); | ||
Member mockEntity = Member.of(502, loginDto.id(), "[email protected]", "0eb9de69892882d54516e03e30098354a2e39cea36adab275b6300c737c942fd", null, null); | ||
Member mockEntity = Member.of(502L, loginDto.id(), "[email protected]", "0eb9de69892882d54516e03e30098354a2e39cea36adab275b6300c737c942fd", null, null); | ||
String mockToken = "dummy_token"; | ||
|
||
/** stub **/ | ||
|
@@ -105,13 +105,13 @@ public void init() { | |
void ํ ํฐ_๋ฐ๊ธ_์ ์ฅ_ํ ์คํธ() { | ||
|
||
/** given **/ | ||
Member memberEntity = Member.of(502, "test03", null, null, null, null); | ||
Member memberEntity = Member.of(502L, "test03", null, null, null, null); | ||
String mockToken = "mockToken"; | ||
Auth auth = Auth.jwt(null, 502, mockToken); | ||
Auth auth = Auth.jwt(null, 502L, mockToken); | ||
|
||
/** stub **/ | ||
when(jwt.generateToken(anyString())).thenReturn(mockToken); | ||
when(authRepository.findOneByMemberNo(anyInt())).thenReturn(auth); | ||
when(authRepository.findOneByMemberNo(anyLong())).thenReturn(auth); | ||
|
||
/** when **/ | ||
String token = jwt.generateToken(memberEntity.getId()); //mockToken return ์ ์ ์ํ ํ์ธ | ||
|
@@ -136,7 +136,7 @@ public void init() { | |
|
||
/** given **/ | ||
String id = "test01"; | ||
Member memberEntity = Member.of(51, "test01", null, null, null, null); | ||
Member memberEntity = Member.of(51L, "test01", null, null, null, null); | ||
|
||
/** stub **/ | ||
when(memberRepository.findOneById(anyString())).thenReturn(memberEntity); | ||
|
@@ -175,7 +175,7 @@ public void init() { | |
|
||
/** given **/ | ||
String email = "[email protected]"; | ||
Member memberEntity = Member.of(51, "test01", "[email protected]", null, null, null); | ||
Member memberEntity = Member.of(51L, "test01", "[email protected]", null, null, null); | ||
|
||
/** stub **/ | ||
when(memberRepository.findOneByEmail(anyString())).thenReturn(memberEntity); | ||
|
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.
์ดํ์๋ PR์ ๊ตฌ๋ถํด์ ์ฌ๋ ค์ฃผ์๋ ๊ฒ ์ข์ ๊ฒ ๊ฐ์์!
PR ๋ช ๊ณผ ๋ด๋ถ ์์ ์ฌํญ์ด ๋ค๋ฅธ ๋ถ๋ถ๋ค์ด ์์ด์ ๋์ค์ ์ด๋ ฅ ๊ด๋ฆฌ๊ฐ ์ด๋ ค์ธ ์๋ ์์ง ์์๊น์!?