Skip to content

Commit

Permalink
회원 상세 정보 필드 추가 (#14)
Browse files Browse the repository at this point in the history
* Test: 테스트용 application.yml 파일 추가

* Feat: Dockerfile 작성

* Refactor: AI 요구사항에 맞게 코드 수정

* Fix: H2 관련 설정 삭제

* Refactor: 식당 ID를 반환하도록 추가

* Refactor: AI 요구사항에 맞춰 수정

* Refactor: AI 요구사항에 맞도록 수정

* Test: 테스트 코드 수정

* Refactor: 회원 상세정보 필드 추가
  • Loading branch information
pjh5365 authored Nov 18, 2024
1 parent a6609d9 commit 2efc85b
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class MemberDetailRequest {

private String username;
private int age;
private String location;
private MainExperience mainExperience;
private SubExperience subExperience;
private MainExperience mainPreference;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class MemberDetail extends BaseEntity {
private Member member;

private int age;
private String location;

@Enumerated(value = EnumType.STRING)
private MainExperience mainExperience;
Expand All @@ -59,6 +60,7 @@ public static MemberDetail toEntity(Member member, MemberDetailRequest request)
return MemberDetail.builder()
.member(member)
.age(request.getAge())
.location(request.getLocation())
.mainPreference(request.getMainPreference())
.subExperience(request.getSubExperience())
.subPreference(request.getSubPreference())
Expand Down
70 changes: 55 additions & 15 deletions src/main/resources/static/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ <h4 id="_요청">요청</h4>
<h5 id="_요청_http_request">HTTP request</h5>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/join?_csrf=PgIVII1UGSy-VgyBIBIGTa1dWM46uJ4ZGHdIY9I6EJszZnmjBjchRr0yfBuTYW7nRD8yeJw7da9cjq80KUQrUeQNKaJSBUzC HTTP/1.1
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/join?_csrf=bqhELrQg8rMlPCHc5hRoR90wycusUS5HCAHl66JUF6RF1V6CCMl1FtBCw4IICRK40TlccrxR5KrONRdqbDGE3ZM2dMJx7Gy6 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 75
Host: localhost:8080
Expand Down Expand Up @@ -606,7 +606,7 @@ <h4 id="_요청_2">요청</h4>
<h5 id="_요청_2_http_request">HTTP request</h5>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/join?_csrf=W-QQiuAMvzJ8R4RLrtawe4gwfv9ZPmY3wgmrj27vemXqocL4aNYm7tE9jFdRJuUvmPuEHexWU8dvWl4a-znOtwyNTVDTxKGd HTTP/1.1
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/join?_csrf=OQwBqMC9Zq0gPljoFGTxo3gZ9odv-9Dxw4nTIlcrtmj-QzUQWz40zaaJV88NWmnZLEnFm0sh2-ZeybXcobjnQDVIhgyaIgFz HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 75
Host: localhost:8080
Expand Down Expand Up @@ -722,14 +722,15 @@ <h4 id="_요청_3">요청</h4>
<h5 id="_요청_3_http_request">HTTP request</h5>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/member?_csrf=kmlxlZyRuwrIyGn0zbMmqnILmlAemcnMXx2Qn0BYNeNE5msYqgpE9q2ki2zl-1rB_p4Smhc7t2kprv7hZiz0pnRsVIV0hVJ8 HTTP/1.1
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/member?_csrf=BWhNzdUUTn22CwSqrR5lQ7yf8jmjMNmiC9VL6452FVcMQPaXNQwpr-QseEybM2adnzNRcYim3wHCUu-Pb7cojrtOJG80I8L1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 246
Content-Length: 271
Host: localhost:8080

{
"username" : "testId",
"age" : 70,
"location" : "서울",
"mainExperience" : "OFFICE_ACCOUNTING_IT",
"subExperience" : "ACCOUNTING_FINANCE",
"mainPreference" : "OFFICE_ACCOUNTING_IT",
Expand Down Expand Up @@ -766,6 +767,11 @@ <h5 id="_요청_3_request_fields">Request fields</h5>
<td class="tableblock halign-left valign-top"><p class="tableblock">나이</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>location</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">사는 곳</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>mainExperience</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">일 경험 (대분류)</p></td>
Expand Down Expand Up @@ -862,14 +868,15 @@ <h4 id="_요청_4">요청</h4>
<h5 id="_요청_4_http_request">HTTP request</h5>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/member?_csrf=23Cny2COxXGIMijWKGtj-mXdNUI13SxniQulHeXvQME_TJ0p4kmT-lbrp0WlUR3lTEZXy13rGHsA5RlK6miReIaNdPUHL6RK HTTP/1.1
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/member?_csrf=TwYTRFEJo6f4F80Cw0vd-QJfs-x2UO18aFi_uSChCqqLYCQqLWVxIDI-wpbVdq9mpWbpyDZuno1PaIlRXG-KiRDAO5y-VxEb HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 246
Content-Length: 271
Host: localhost:8080

{
"username" : "testId",
"age" : 70,
"location" : "서울",
"mainExperience" : "OFFICE_ACCOUNTING_IT",
"subExperience" : "ACCOUNTING_FINANCE",
"mainPreference" : "OFFICE_ACCOUNTING_IT",
Expand Down Expand Up @@ -906,6 +913,11 @@ <h5 id="_요청_4_request_fields">Request fields</h5>
<td class="tableblock halign-left valign-top"><p class="tableblock">나이</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>location</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">사는 곳</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>mainExperience</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">일 경험 (대분류)</p></td>
Expand Down Expand Up @@ -1517,7 +1529,7 @@ <h4 id="_요청_9">요청</h4>
<h5 id="_요청_9_http_request">HTTP request</h5>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">PATCH /api/credits/plus?_csrf=qmt_Za8wsOh3pBq84WDkNp731oPvmLzVTO5mr8Dx5RfiDEDKz1JNVJxShthanSLZ2U3QAa7F-7rcoYz4ddheyvXB0SSEOyPy HTTP/1.1
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">PATCH /api/credits/plus?_csrf=QbEDpbZd4ASyJ6pIeBMxr8zgRCYmIBhWvh5p_XdvTQfPqO9TdNVik9Rt12WfQZorST4Fy66FaUcUQ3p7iHsPzUBcf2T2mNY2 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 47
Host: localhost:8080
Expand Down Expand Up @@ -1640,7 +1652,7 @@ <h4 id="_요청_10">요청</h4>
<h5 id="_요청_10_http_request">HTTP request</h5>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">PATCH /api/credits/minus?_csrf=p3QgOoesv8lpAyBdnDtNeGxiJbc16bjauYGOLlwM5weJ3Ic4nkJFDLaZ3KtEYkFlqRZ5HFlWCNUN3933gbG4T2xq3jG-7bEO HTTP/1.1
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">PATCH /api/credits/minus?_csrf=EPL_pCkP5EtZpHW_WmNLGCghJe8MK2JqzufU2LtTiLOBLKMJdJeclho9hXJ0xxHaaE5_ek5CCI1qGVNH-dOw4dgyu4u1TZtt HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 47
Host: localhost:8080
Expand Down Expand Up @@ -1809,7 +1821,7 @@ <h5 id="_응답_11_http_response">HTTP response</h5>
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Length: 833
Content-Length: 1025

{
"success" : true,
Expand All @@ -1819,20 +1831,26 @@ <h5 id="_응답_11_http_response">HTTP response</h5>
"workName" : "경비",
"workDetail" : "병원을 경비합니다.",
"workCredit" : 10000,
"location" : "서울",
"mainCategory" : "SERVICE",
"subCategory" : "SECURITY_GUARD"
"subCategory" : "SECURITY_GUARD",
"physicalStatus" : "NORMAL"
}, {
"workName" : "주간경비",
"workDetail" : "병원을 주간에 경비합니다.",
"workCredit" : 11000,
"location" : "서울",
"mainCategory" : "SERVICE",
"subCategory" : "SECURITY_GUARD"
"subCategory" : "SECURITY_GUARD",
"physicalStatus" : "NORMAL"
}, {
"workName" : "야간경비",
"workDetail" : "병원을 야간에 경비합니다.",
"workCredit" : 12000,
"location" : "서울",
"mainCategory" : "SERVICE",
"subCategory" : "SECURITY_GUARD"
"subCategory" : "SECURITY_GUARD",
"physicalStatus" : "NORMAL"
} ],
"pageNum" : 0,
"pageSize" : 0,
Expand Down Expand Up @@ -1891,6 +1909,16 @@ <h5 id="_응답_11_response_fields">Response fields</h5>
<td class="tableblock halign-left valign-top"><p class="tableblock">소일거리 시급</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>data.content[].location</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">소일거리 위치</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>data.content[].physicalStatus</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">소일거리 건강상태</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>data.content[].mainCategory</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">소일거리 메인카테고리</p></td>
Expand Down Expand Up @@ -1980,7 +2008,7 @@ <h5 id="_응답_12_http_response">HTTP response</h5>
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Length: 277
Content-Length: 337

{
"success" : true,
Expand All @@ -1989,8 +2017,10 @@ <h5 id="_응답_12_http_response">HTTP response</h5>
"workName" : "경비",
"workDetail" : "병원을 경비합니다.",
"workCredit" : 10000,
"location" : "서울",
"mainCategory" : "SERVICE",
"subCategory" : "SECURITY_GUARD"
"subCategory" : "SECURITY_GUARD",
"physicalStatus" : "NORMAL"
}
}</code></pre>
</div>
Expand Down Expand Up @@ -2043,6 +2073,16 @@ <h5 id="_응답_12_response_fields">Response fields</h5>
<td class="tableblock halign-left valign-top"><p class="tableblock">소일거리 시급</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>data.location</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">소일거리 위치</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>data.physicalStatus</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">소일거리 건강상태</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>data.mainCategory</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">소일거리 메인카테고리</p></td>
Expand All @@ -2065,7 +2105,7 @@ <h4 id="_요청_13">요청</h4>
<h5 id="_요청_13_http_request">HTTP request</h5>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/works-join?_csrf=VfS28BzkEMe7ffCLHNMv4hLSGkSzyV528VPtXQigV_4EjobsZMOHliiGJ_CWTcm6JP4bh3bjN32C8TpbxWLVZGyQZs5m6LDY HTTP/1.1
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/works-join?_csrf=le1PZX052-Z25fmXFhLnnWHpTbPWbjmbh1T3T-MS7WTvBQ15rdV7VEQLvdBb1pqlcD_TrwLaYNG1CAu25DKVd9px3FHeND1N HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 44
Host: localhost:8080
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void joinFailTest() throws Exception {
@WithMockUser
void addDetailTest() throws Exception {
// Given
MemberDetailRequest request = new MemberDetailRequest("testId", 70, MainExperience.OFFICE_ACCOUNTING_IT,
MemberDetailRequest request = new MemberDetailRequest("testId", 70, "서울", MainExperience.OFFICE_ACCOUNTING_IT,
SubExperience.ACCOUNTING_FINANCE, MainExperience.OFFICE_ACCOUNTING_IT, SubExperience.ACCOUNTING_FINANCE,
PhysicalStatus.NORMAL);

Expand All @@ -165,6 +165,7 @@ void addDetailTest() throws Exception {
requestFields(
fieldWithPath("username").description("가입한 아이디"),
fieldWithPath("age").description("나이"),
fieldWithPath("location").description("사는 곳"),
fieldWithPath("mainExperience").description("일 경험 (대분류)"),
fieldWithPath("subExperience").description("일 경험 (소분류)"),
fieldWithPath("mainPreference").description("선호 직종 (대분류)"),
Expand All @@ -185,7 +186,7 @@ void addDetailTest() throws Exception {
@WithMockUser
void addDetailFailTest() throws Exception {
// Given
MemberDetailRequest request = new MemberDetailRequest("testId", 70, MainExperience.OFFICE_ACCOUNTING_IT,
MemberDetailRequest request = new MemberDetailRequest("testId", 70, "서울", MainExperience.OFFICE_ACCOUNTING_IT,
SubExperience.ACCOUNTING_FINANCE, MainExperience.OFFICE_ACCOUNTING_IT, SubExperience.ACCOUNTING_FINANCE,
PhysicalStatus.NORMAL);
doThrow(new UsernameNotFoundException("회원정보를 찾을 수 없습니다.")).when(memberService).saveDetails(any());
Expand All @@ -210,6 +211,7 @@ void addDetailFailTest() throws Exception {
requestFields(
fieldWithPath("username").description("가입한 아이디"),
fieldWithPath("age").description("나이"),
fieldWithPath("location").description("사는 곳"),
fieldWithPath("mainExperience").description("일 경험 (대분류)"),
fieldWithPath("subExperience").description("일 경험 (소분류)"),
fieldWithPath("mainPreference").description("선호 직종 (대분류)"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class MemberDetailRepositoryTest {
@DisplayName("회원 상세정보 저장 테스트")
void saveTest() {
// Given
MemberDetailRequest request = new MemberDetailRequest("testId", 70, MainExperience.OFFICE_ACCOUNTING_IT,
MemberDetailRequest request = new MemberDetailRequest("testId", 70, "서울", MainExperience.OFFICE_ACCOUNTING_IT,
SubExperience.ACCOUNTING_FINANCE, MainExperience.OFFICE_ACCOUNTING_IT, SubExperience.ACCOUNTING_FINANCE,
PhysicalStatus.NORMAL);
MemberDetail md = MemberDetail.toEntity(member, request);
Expand All @@ -59,7 +59,7 @@ void saveTest() {
@DisplayName("회원 상세정보 삭제 테스트")
void deleteTest() {
// Given
MemberDetailRequest request = new MemberDetailRequest("testId", 70, MainExperience.OFFICE_ACCOUNTING_IT,
MemberDetailRequest request = new MemberDetailRequest("testId", 70, "서울", MainExperience.OFFICE_ACCOUNTING_IT,
SubExperience.ACCOUNTING_FINANCE, MainExperience.OFFICE_ACCOUNTING_IT, SubExperience.ACCOUNTING_FINANCE,
PhysicalStatus.NORMAL);
MemberDetail md = MemberDetail.toEntity(member, request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void saveMemberFailTest() {
@DisplayName("회원 상세정보 저장 테스트")
void saveDetailsTest() {
// Given
MemberDetailRequest memberDetailRequest = new MemberDetailRequest("testId", 70, MainExperience.OFFICE_ACCOUNTING_IT,
MemberDetailRequest memberDetailRequest = new MemberDetailRequest("testId", 70, "서울", MainExperience.OFFICE_ACCOUNTING_IT,
SubExperience.ACCOUNTING_FINANCE, MainExperience.OFFICE_ACCOUNTING_IT, SubExperience.ACCOUNTING_FINANCE,
PhysicalStatus.NORMAL);
Member m = Member.toEntity("testId", "name", "pw");
Expand All @@ -97,7 +97,7 @@ void saveDetailsTest() {
@DisplayName("회원 상세정보 저장 실패 테스트")
void saveDetailsFailTest() {
// Given
MemberDetailRequest memberDetailRequest = new MemberDetailRequest("testId", 70, MainExperience.OFFICE_ACCOUNTING_IT,
MemberDetailRequest memberDetailRequest = new MemberDetailRequest("testId", 70, "서울", MainExperience.OFFICE_ACCOUNTING_IT,
SubExperience.ACCOUNTING_FINANCE, MainExperience.OFFICE_ACCOUNTING_IT, SubExperience.ACCOUNTING_FINANCE,
PhysicalStatus.NORMAL);
Member m = Member.toEntity("testId", "name", "pw");
Expand Down

0 comments on commit 2efc85b

Please sign in to comment.