-
Notifications
You must be signed in to change notification settings - Fork 0
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 join #5
Feature join #5
Conversation
jpa,db ์ฐ๊ฒฐ์ ์ํ ์์กด์ฑ ์ฃผ์ ๋ฐ ์ค์ ์งํ๊ณผ ํ๋ก์ ํธ ๋๋ ํฐ๋ฆฌ๋ช ์ ์คํ๋ฅผ ๋ฐ๊ฒฌํ์ฌ ์์ ํจ.
ํ์๊ฐ์ ๊ธฐ๋ฅ์ ํ์ํ entity , repository ,dto ๋ฑ ํด๋์ค ์์ฑํ ๊ธฐ๋ฅ ๊ตฌํํจ
ResponseEntity์ ์๋ต ๋ฉ์์ง๋ฅผ ์ปค์คํ ํ๊ธฐ ์ํ ํด๋์ค ์์ฑ ๋ฐ ํ์๊ฐ์ ์ ๋น๋ฐ๋ฒํธ๋ฅผ ์ํธํ ํ๊ธฐ ์ํ ํด๋์ค ์์ฑ
P6spy ์ ์ฉ์ ์ํ ํด๋์ค ์์ฑ ๋ฐ application.yml ์ค์ ์งํ
๋ก๊ทธ ํ๋ ์ ์ํฌ๋ฅผ logback์์ log4j2๋ก ๋ณ๊ฒฝํจ.
Testcontainer๋ฅผ ์ฌ์ฉํ ์์๋๋ก ํ ์คํธ ํ๊ฒฝ์ ๊ตฌ์ถํ๊ณ ์ค์ ๋ก ๋์ํ๋์ง ํ์ธํ๊ธฐ ์ํ ํ ์คํธ ์ฝ๋ ์์ฑ
ํ์ ๊ฐ์ ํ ์คํธ ๋ก์ง ์์ฑ ๋ฐ application-test.yml ํ์ผ ์ค์ ๋ณ๊ฒฝ ์งํ
๋ถํ์ํ ์ฝ๋์ ์ด๋ ธํ ์ด์ ์ ๊ฑฐ ๋ฐ ๋๋ฝ๋ ์ด๋ ธํ ์ด์ ์์ฑ ์ถ๊ฐ
rest doc ์ ์ฉํ๋ฉด์ ๋ถํ์ํ ํ ์คํธ ์ฝ๋ ์ญ์ ์งํ
์ปจํธ๋กค๋ฌ์ ๋ฐํ๊ฐ๊ณผ ๋น์ฆ๋์ค ๋ก์ง์์ ์๋ชป๋ ๊ฐ์ ์ ๋ฌํ๊ณ ๋ฐํํ๋ ๋ถ๋ถ์ ํ์ธํ์ฌ ์์ ์งํํจ
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.
๊ณ ์ํ์ จ์ต๋๋ค! ๋ฆฌ๋ทฐ๋๋ฆฐ ๋ด์ฉ ํ์ธ ํ ๋ต๋ณ ๋ถํ๋๋ฆฌ๊ฒ ์ต๋๋ค~
src/main/java/spring/academyPlatform/global/mapper/UserMapper.java
Outdated
Show resolved
Hide resolved
src/main/java/spring/academyPlatform/global/mapper/UserMapper.java
Outdated
Show resolved
Hide resolved
src/main/java/spring/academyPlatform/global/util/BcryptPasswordEncryptor.java
Outdated
Show resolved
Hide resolved
src/main/java/spring/academyPlatform/global/util/BcryptPasswordEncryptor.java
Show resolved
Hide resolved
UserMapper์ ์์น๋ฅผ global์์ User ๋๋ฉ์ธ ํ์๋ก ์ด๋ ๋ฐ ๋ถํ์ํ ์ด๋ ธํ ์ด์ ์ญ์
๋งค์ง๋๋ฒ๋ฅผ ์์๋ก ๋ณ๊ฒฝํจ
์ฌ์ฉํ์ง ์๋ api ์ญ์ ์งํํจ
Message ํด๋์ค ์ ๊ฑฐ์ ์ด์ ๋ฐ๋ฅธ ์ฝ๋ ์์
DTO ํด๋์ค ๋ช ์นญ ๋ณ๊ฒฝ ๋ฐ ์ด๋ ธํ ์ด์ ์์
builder์์ Mapper ์ฌ์ฉ์ผ๋ก ๋ณ๊ฒฝ ๋ฐ ์ฌ์ฉํ์ง ์๋ ๋ก์ง ์ญ์
๊ณ ์ ๊ฐ์ผ๋ก ์ ๋ ฅ๋์ด์ง๋ ๊ฐ์ enum ํด๋์ค๋ก ๊ด๋ฆฌํ๋๋ก ๋ณ๊ฒฝํจ
๋ถํ์ํ ์ค์ ์ ์ญ์ ํจ
enum type์ผ๋ก ๋ณ๊ฒฝ๋ ์ปฌ๋ผ์ผ๋ก ์ธํ ์์
ํด๋์ค๋ช ๋ณ๊ฒฝ์ผ๋ก ์ธํ ์์ ์งํ
private final UserService userService; | ||
|
||
@PostMapping("/user") | ||
public ResponseEntity<Object> getUser(@Valid @RequestBody UserCreateRequest dto) { |
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.
@@
try { | ||
UserCreateResponse result = userService.createUser(dto); | ||
Map<String, Object> resultMap = new HashMap<>(); | ||
resultMap.put("user", result); |
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.
@@
@Getter | ||
public class UserCreateRequest { | ||
@NotBlank | ||
String userId; |
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.
@@
import spring.academyPlatform.user.dto.UserCreateRequest; | ||
import spring.academyPlatform.user.dto.UserCreateResponse; | ||
|
||
@Component |
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.
@@
package spring.academyPlatform.user.model; | ||
|
||
public enum TypeCode { | ||
student, teacher; |
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.
@@
@NotBlank | ||
String userName; | ||
@NotBlank | ||
TypeCode userType; |
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.
@@
import lombok.Builder; | ||
import lombok.Getter; | ||
import spring.academyPlatform.user.model.TypeCode; | ||
import spring.academyPlatform.user.model.YnCode; |
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.
@@
YnCode ํด๋์ค ํจํค์ง ์ด๋ ๋ฐ TypeCode ํด๋์ค UserTypeCode๋ก ๋ช ์นญ ๋ณ๊ฒฝํจ
๊ธฐ์กด Message ํด๋์ค๋ฅผ return ๊ฐ์ผ๋ก ๋ฐ๋ ๋ก์ง์์ dto ํด๋์ค๋ฅผ ๋ฐ๋ ๋ก์ง์ผ๋ก ๋ณ๊ฒฝํจ.
๊ธฐ์กดtype ์์ enum type์ผ๋ก์ ๋ณ๊ฒฝ์ ๋ฐ๋ฅธ ๋ก์ง ์์ ๋ฐ ๋ณํ ๋ฉ์๋ ์ถ๊ฐ
dto ํด๋์ค์ ๋๋ฝ๋ ์ ๊ทผ์ ์ด์๋ฅผ ์ถ๊ฐํ๊ณ enum type์ผ๋ก ์ ๋ณ๊ฒฝ ์งํ
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 ์ ๋ชฉ
๐ ๋ณ๊ฒฝ ์ฌํญ (Changes)
๐ฅ ๊ด๋ จ ์ด์ (Related Issues)
๐ฌ ๋ฆฌ๋ทฐ ์๊ตฌ์ฌํญ
๐ด ์ฒดํฌ๋ฆฌ์คํธ (Checklist)