Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import workplate.workplateserver.auth.domain.MainExperience;
import workplate.workplateserver.auth.domain.SubExperience;
import workplate.workplateserver.work.domain.entity.Work;

/**
Expand All @@ -19,12 +21,16 @@ public class WorkResponse {
private String workName;
private String workDetail;
private Long workCredit;
private MainExperience mainCategory;
private SubExperience subCategory;

public static WorkResponse toDto(Work work) {
return WorkResponse.builder()
.workName(work.getWorkName())
.workDetail(work.getWorkDetail())
.workCredit(work.getWorkCredit())
.mainCategory(work.getMainCategory())
.subCategory(work.getSubCategory())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
Expand All @@ -10,6 +12,8 @@
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import workplate.workplateserver.auth.domain.MainExperience;
import workplate.workplateserver.auth.domain.SubExperience;
import workplate.workplateserver.common.BaseEntity;

/**
Expand All @@ -35,12 +39,21 @@ public class Work extends BaseEntity {
private String workDetail;
@Column(name = "work_credit")
private Long workCredit;
@Column(name = "work_main_category")
@Enumerated(EnumType.STRING)
private MainExperience mainCategory;
@Column(name = "work_sub_category")
@Enumerated(EnumType.STRING)
private SubExperience subCategory;

public static Work toEntity(String workName, String workDetail, Long workCredit) {
public static Work toEntity(String workName, String workDetail, Long workCredit, MainExperience mainCategory,
SubExperience subCategory) {
return Work.builder()
.workName(workName)
.workDetail(workDetail)
.workCredit(workCredit)
.mainCategory(mainCategory)
.subCategory(subCategory)
.build();
}
}
58 changes: 41 additions & 17 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=uqGwVr5ZRkFGB1PDZT5OiMVU0jpDbCBYYDbvR2T-R8Q_DWeS3JmIbtg6d3BrYmXxAxN6vKFt_wN3CUN1VgDbJAbJJaVdbgKg HTTP/1.1
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/join?_csrf=PgIVII1UGSy-VgyBIBIGTa1dWM46uJ4ZGHdIY9I6EJszZnmjBjchRr0yfBuTYW7nRD8yeJw7da9cjq80KUQrUeQNKaJSBUzC 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=nHAt8mXu5LrBXuVeaBu2HIYegvQHhqbJ9_PMyGVbGoI4V6oh-kcfkVOM1Ivsad09WjaCL-V_r81iv5LkxcqvqwM5LudeYMgR HTTP/1.1
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/join?_csrf=W-QQiuAMvzJ8R4RLrtawe4gwfv9ZPmY3wgmrj27vemXqocL4aNYm7tE9jFdRJuUvmPuEHexWU8dvWl4a-znOtwyNTVDTxKGd HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 75
Host: localhost:8080
Expand Down Expand Up @@ -722,7 +722,7 @@ <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=P36JFwmul7Teu6P8UCzcJ0IGpZJZa_KevzzOcfMTJZpZhciWW0ixLzmY9oHzisfFZgHoF3dkiPA4WMezjAqoE8QmE686tKmg HTTP/1.1
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/member?_csrf=kmlxlZyRuwrIyGn0zbMmqnILmlAemcnMXx2Qn0BYNeNE5msYqgpE9q2ki2zl-1rB_p4Smhc7t2kprv7hZiz0pnRsVIV0hVJ8 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 246
Host: localhost:8080
Expand Down Expand Up @@ -862,8 +862,7 @@ <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=pZ25SF_D7mKw0dsGee1kXmL8WR_Yu2nru0qP64U_vwS7vPnDlquILDv0i1Od4bkxH8BQOlGddCa6iAjG2im_ieYKjGffiJv0 HTTP/1.1

<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/member?_csrf=23Cny2COxXGIMijWKGtj-mXdNUI13SxniQulHeXvQME_TJ0p4kmT-lbrp0WlUR3lTEZXy13rGHsA5RlK6miReIaNdPUHL6RK HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 246
Host: localhost:8080
Expand Down Expand Up @@ -1518,8 +1517,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=FTufPolFbnQWgcjDW8jT-Zkka5uhtYIsfBvR-8aKTSGi-mnJJQuoCbgjChI7sK6lY-Xnz6oTRvnHgbABSCrnmv--ekKRzFys HTTP/1.1

<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">PATCH /api/credits/plus?_csrf=qmt_Za8wsOh3pBq84WDkNp731oPvmLzVTO5mr8Dx5RfiDEDKz1JNVJxShthanSLZ2U3QAa7F-7rcoYz4ddheyvXB0SSEOyPy HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 47
Host: localhost:8080
Expand Down Expand Up @@ -1642,8 +1640,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=RIhdRhgUX7s9SaRUFcBJ4rkdcDr5ESnv0ZSbEQORawtiuuyFJ-xrdSAjbd0Qe5E2Ie19gY4qXQOaIBrC5_etJzuoXmhRgoq8 HTTP/1.1

<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">PATCH /api/credits/minus?_csrf=p3QgOoesv8lpAyBdnDtNeGxiJbc16bjauYGOLlwM5weJ3Ic4nkJFDLaZ3KtEYkFlqRZ5HFlWCNUN3933gbG4T2xq3jG-7bEO HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 47
Host: localhost:8080
Expand Down Expand Up @@ -1812,7 +1809,7 @@ <h5 id="_응답_11_http_response">HTTP response</h5>
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Length: 611
Content-Length: 833

{
"success" : true,
Expand All @@ -1821,15 +1818,21 @@ <h5 id="_응답_11_http_response">HTTP response</h5>
"content" : [ {
"workName" : "경비",
"workDetail" : "병원을 경비합니다.",
"workCredit" : 10000
"workCredit" : 10000,
"mainCategory" : "SERVICE",
"subCategory" : "SECURITY_GUARD"
}, {
"workName" : "주간경비",
"workDetail" : "병원을 주간에 경비합니다.",
"workCredit" : 11000
"workCredit" : 11000,
"mainCategory" : "SERVICE",
"subCategory" : "SECURITY_GUARD"
}, {
"workName" : "야간경비",
"workDetail" : "병원을 야간에 경비합니다.",
"workCredit" : 12000
"workCredit" : 12000,
"mainCategory" : "SERVICE",
"subCategory" : "SECURITY_GUARD"
} ],
"pageNum" : 0,
"pageSize" : 0,
Expand Down Expand Up @@ -1888,6 +1891,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[].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>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>data.content[].subCategory</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.pageNum</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Number</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">현재 페이지 번호</p></td>
Expand Down Expand Up @@ -1967,15 +1980,17 @@ <h5 id="_응답_12_http_response">HTTP response</h5>
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Length: 207
Content-Length: 277

{
"success" : true,
"message" : "요청이 성공적으로 처리되었습니다.",
"data" : {
"workName" : "경비",
"workDetail" : "병원을 경비합니다.",
"workCredit" : 10000
"workCredit" : 10000,
"mainCategory" : "SERVICE",
"subCategory" : "SECURITY_GUARD"
}
}</code></pre>
</div>
Expand Down Expand Up @@ -2027,6 +2042,16 @@ <h5 id="_응답_12_response_fields">Response fields</h5>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Number</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>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>data.subCategory</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>
</tbody>
</table>
</div>
Expand All @@ -2040,8 +2065,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=aLTWfYjPQd7xySlQdXuyQQ-JWy5_zEjlcqFBU1-hVLp8xZ2lUdLmTun_cunc_hBoEFaGcWztdk9N-ivIF5YkZm_EMo9Fof6c HTTP/1.1

<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /api/works-join?_csrf=VfS28BzkEMe7ffCLHNMv4hLSGkSzyV528VPtXQigV_4EjobsZMOHliiGJ_CWTcm6JP4bh3bjN32C8TpbxWLVZGyQZs5m6LDY 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 @@ -29,6 +29,8 @@

import com.google.gson.Gson;

import workplate.workplateserver.auth.domain.MainExperience;
import workplate.workplateserver.auth.domain.SubExperience;
import workplate.workplateserver.auth.domain.entity.Member;
import workplate.workplateserver.auth.domain.jwt.JwtTokenProvider;
import workplate.workplateserver.auth.domain.jwt.repository.JwtAccessTokenRepository;
Expand Down Expand Up @@ -74,9 +76,9 @@ class WorkControllerTest {
@WithMockUser
void findAllTest() throws Exception {
// Given
WorkResponse r1 = new WorkResponse("경비", "병원을 경비합니다.", 10000L);
WorkResponse r2 = new WorkResponse("주간경비", "병원을 주간에 경비합니다.", 11000L);
WorkResponse r3 = new WorkResponse("야간경비", "병원을 야간에 경비합니다.", 12000L);
WorkResponse r1 = new WorkResponse("경비", "병원을 경비합니다.", 10000L, MainExperience.SERVICE, SubExperience.SECURITY_GUARD);
WorkResponse r2 = new WorkResponse("주간경비", "병원을 주간에 경비합니다.", 11000L, MainExperience.SERVICE, SubExperience.SECURITY_GUARD);
WorkResponse r3 = new WorkResponse("야간경비", "병원을 야간에 경비합니다.", 12000L, MainExperience.SERVICE, SubExperience.SECURITY_GUARD);
PageResponse<WorkResponse> response = new PageResponse<>(List.of(r1, r2, r3));
given(workService.findAll(any())).willReturn(response);

Expand All @@ -102,6 +104,8 @@ void findAllTest() throws Exception {
fieldWithPath("data.content[].workName").description("소일거리 이름"),
fieldWithPath("data.content[].workDetail").description("소일거리 상세 내용"),
fieldWithPath("data.content[].workCredit").description("소일거리 시급"),
fieldWithPath("data.content[].mainCategory").description("소일거리 메인카테고리"),
fieldWithPath("data.content[].subCategory").description("소일거리 서브카테고리"),
fieldWithPath("data.pageNum").description("현재 페이지 번호"),
fieldWithPath("data.pageSize").description("페이지 당 항목 수"),
fieldWithPath("data.totalPages").description("총 페이지 수"),
Expand All @@ -117,7 +121,7 @@ void findAllTest() throws Exception {
@WithMockUser
void findByIdTest() throws Exception {
// Given
WorkResponse r1 = new WorkResponse("경비", "병원을 경비합니다.", 10000L);
WorkResponse r1 = new WorkResponse("경비", "병원을 경비합니다.", 10000L, MainExperience.SERVICE, SubExperience.SECURITY_GUARD);
given(workService.findById(1L)).willReturn(r1);

// When
Expand All @@ -140,7 +144,9 @@ void findByIdTest() throws Exception {
fieldWithPath("data").description("처리 결과"),
fieldWithPath("data.workName").description("소일거리 이름"),
fieldWithPath("data.workDetail").description("소일거리 상세 내용"),
fieldWithPath("data.workCredit").description("소일거리 시급")
fieldWithPath("data.workCredit").description("소일거리 시급"),
fieldWithPath("data.mainCategory").description("소일거리 메인카테고리"),
fieldWithPath("data.subCategory").description("소일거리 서브카테고리")
)));
// Then
}
Expand Down
Loading