Skip to content
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 @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.google.gson.Gson;

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

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

// When
Expand All @@ -145,6 +148,8 @@ void findByIdTest() throws Exception {
fieldWithPath("data.workName").description("소일거리 이름"),
fieldWithPath("data.workDetail").description("소일거리 상세 내용"),
fieldWithPath("data.workCredit").description("소일거리 시급"),
fieldWithPath("data.location").description("소일거리 위치"),
fieldWithPath("data.physicalStatus").description("소일거리 건강상태"),
fieldWithPath("data.mainCategory").description("소일거리 메인카테고리"),
fieldWithPath("data.subCategory").description("소일거리 서브카테고리")
)));
Expand Down
Loading