Skip to content
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

모든 요청 허용 #15

Merged
merged 15 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.authorizeHttpRequests(auth -> auth
.requestMatchers("/", "/api/join", "/api/login").permitAll()
.anyRequest().authenticated()
.anyRequest().permitAll()
);
http
.csrf(AbstractHttpConfigurer::disable)
.cors(AbstractHttpConfigurer::disable)
.formLogin(AbstractHttpConfigurer::disable)
.httpBasic(AbstractHttpConfigurer::disable)
.addFilterAt(loginFilter(), UsernamePasswordAuthenticationFilter.class) // 로그인 필터 변경
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public class Restaurant extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "restaurant_id")
private Long id;
@Column(name = "restaurant_name")
private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.Builder;
import lombok.Getter;
import workplate.workplateserver.auth.domain.MainExperience;
import workplate.workplateserver.auth.domain.PhysicalStatus;
import workplate.workplateserver.auth.domain.SubExperience;
import workplate.workplateserver.work.domain.entity.Work;

Expand All @@ -21,16 +22,20 @@ public class WorkResponse {
private String workName;
private String workDetail;
private Long workCredit;
private String location;
private MainExperience mainCategory;
private SubExperience subCategory;
private PhysicalStatus physicalStatus;

public static WorkResponse toDto(Work work) {
return WorkResponse.builder()
.workName(work.getWorkName())
.workDetail(work.getWorkDetail())
.workCredit(work.getWorkCredit())
.location(work.getLocation())
.mainCategory(work.getMainCategory())
.subCategory(work.getSubCategory())
.physicalStatus(work.getPhysicalStatus())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import workplate.workplateserver.auth.domain.MainExperience;
import workplate.workplateserver.auth.domain.PhysicalStatus;
import workplate.workplateserver.auth.domain.SubExperience;
import workplate.workplateserver.common.BaseEntity;

Expand All @@ -39,21 +40,27 @@ public class Work extends BaseEntity {
private String workDetail;
@Column(name = "work_credit")
private Long workCredit;
@Column(name = "work_main_category")
private String location;
@Column(name = "main_category")
@Enumerated(EnumType.STRING)
private MainExperience mainCategory;
@Column(name = "work_sub_category")
@Column(name = "sub_category")
@Enumerated(EnumType.STRING)
private SubExperience subCategory;
@Column(name = "physical_status")
@Enumerated(EnumType.STRING)
private PhysicalStatus physicalStatus;

public static Work toEntity(String workName, String workDetail, Long workCredit, MainExperience mainCategory,
SubExperience subCategory) {
public static Work toEntity(String workName, String workDetail, Long workCredit, String location,
MainExperience mainCategory, SubExperience subCategory, PhysicalStatus physicalStatus) {
return Work.builder()
.workName(workName)
.workDetail(workDetail)
.workCredit(workCredit)
.location(location)
.mainCategory(mainCategory)
.subCategory(subCategory)
.physicalStatus(physicalStatus)
.build();
}
}
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
Loading
Loading