Skip to content

Commit 29deb03

Browse files
authored
refactor: 모집공고 등록 API 수정 및 상세 조회 기능 추가 완료 (#652)
1 parent 3945f85 commit 29deb03

File tree

14 files changed

+169
-28
lines changed

14 files changed

+169
-28
lines changed

src/main/java/page/clab/api/domain/auth/login/application/dto/request/TwoFactorAuthenticationRequestDto.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
@Setter
1010
public class TwoFactorAuthenticationRequestDto {
1111

12-
@NotNull(message = "{notNull.twoFactorAuthenticationRequestDto.memberId}")
12+
@NotNull(message = "{notNull.twoFactorAuthentication.memberId}")
1313
@Schema(description = "학번", example = "202310000", required = true)
1414
private String memberId;
1515

16-
@NotNull(message = "{notNull.twoFactorAuthenticationRequestDto.totp}")
16+
@NotNull(message = "{notNull.twoFactorAuthentication.totp}")
1717
@Schema(description = "TOTP", example = "123456", required = true)
1818
private String totp;
1919
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package page.clab.api.domain.hiring.recruitment.adapter.in.web;
2+
3+
import io.swagger.v3.oas.annotations.Operation;
4+
import io.swagger.v3.oas.annotations.tags.Tag;
5+
import lombok.RequiredArgsConstructor;
6+
import org.springframework.web.bind.annotation.GetMapping;
7+
import org.springframework.web.bind.annotation.PathVariable;
8+
import org.springframework.web.bind.annotation.RequestMapping;
9+
import org.springframework.web.bind.annotation.RestController;
10+
import page.clab.api.domain.hiring.recruitment.application.dto.response.RecruitmentDetailsResponseDto;
11+
import page.clab.api.domain.hiring.recruitment.application.port.in.RetrieveRecruitmentUseCase;
12+
import page.clab.api.global.common.dto.ApiResponse;
13+
14+
@RestController
15+
@RequestMapping("/api/v1/recruitments")
16+
@RequiredArgsConstructor
17+
@Tag(name = "Hiring - Recruitment", description = "모집 공고")
18+
public class RecruitmentDetailsRetrievalController {
19+
20+
private final RetrieveRecruitmentUseCase retrieveRecruitmentUseCase;
21+
22+
@Operation(summary = "모집 공고 상세 조회", description = "ROLE_ANONYMOUS 이상의 권한이 필요함")
23+
@GetMapping("/{recruitmentId}")
24+
public ApiResponse<RecruitmentDetailsResponseDto> retrieveRecruitmentDetails(
25+
@PathVariable(name = "recruitmentId") Long recruitmentId
26+
) {
27+
RecruitmentDetailsResponseDto recruitment = retrieveRecruitmentUseCase.retrieveRecruitmentDetails(recruitmentId);
28+
return ApiResponse.success(recruitment);
29+
}
30+
}

src/main/java/page/clab/api/domain/hiring/recruitment/adapter/out/persistence/RecruitmentJpaEntity.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,32 @@ public class RecruitmentJpaEntity extends BaseEntity {
3737
@GeneratedValue(strategy = GenerationType.IDENTITY)
3838
private Long id;
3939

40+
@Column(nullable = false)
41+
@Size(min = 1, max = 100, message = "{size.recruitment.title}")
42+
private String title;
43+
44+
@Column(nullable = false)
45+
@Size(min = 1, max = 10000, message = "{size.recruitment.teamIntroduction}")
46+
private String teamIntroduction;
47+
4048
@Column(nullable = false)
4149
private LocalDateTime startDate;
4250

4351
@Column(nullable = false)
4452
private LocalDateTime endDate;
4553

54+
@Column(nullable = false)
55+
@Size(min = 1, max = 10000, message = "{size.recruitment.processTimeline}")
56+
private String processTimeline;
57+
4658
@Column(nullable = false)
4759
@Enumerated(EnumType.STRING)
4860
private ApplicationType applicationType;
4961

62+
@Column(nullable = false)
63+
@Size(min = 1, max = 10000, message = "{size.recruitment.jobDescription}")
64+
private String jobDescription;
65+
5066
@Column(nullable = false)
5167
@Size(min = 1, message = "{size.recruitment.target}")
5268
private String target;

src/main/java/page/clab/api/domain/hiring/recruitment/application/dto/mapper/RecruitmentDtoMapper.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.springframework.stereotype.Component;
44
import page.clab.api.domain.hiring.recruitment.application.dto.request.RecruitmentRequestDto;
5+
import page.clab.api.domain.hiring.recruitment.application.dto.response.RecruitmentDetailsResponseDto;
56
import page.clab.api.domain.hiring.recruitment.application.dto.response.RecruitmentEndDateResponseDto;
67
import page.clab.api.domain.hiring.recruitment.application.dto.response.RecruitmentResponseDto;
78
import page.clab.api.domain.hiring.recruitment.domain.Recruitment;
@@ -11,9 +12,13 @@ public class RecruitmentDtoMapper {
1112

1213
public Recruitment fromDto(RecruitmentRequestDto requestDto) {
1314
return Recruitment.builder()
15+
.title(requestDto.getTitle())
16+
.teamIntroduction(requestDto.getTeamIntroduction())
1417
.startDate(requestDto.getStartDate())
1518
.endDate(requestDto.getEndDate())
19+
.processTimeline(requestDto.getProcessTimeline())
1620
.applicationType(requestDto.getApplicationType())
21+
.jobDescription(requestDto.getJobDescription())
1722
.target(requestDto.getTarget())
1823
.isDeleted(false)
1924
.build();
@@ -22,6 +27,7 @@ public Recruitment fromDto(RecruitmentRequestDto requestDto) {
2227
public RecruitmentResponseDto toDto(Recruitment recruitment) {
2328
return RecruitmentResponseDto.builder()
2429
.id(recruitment.getId())
30+
.title(recruitment.getTitle())
2531
.startDate(recruitment.getStartDate())
2632
.endDate(recruitment.getEndDate())
2733
.applicationType(recruitment.getApplicationType())
@@ -37,4 +43,20 @@ public RecruitmentEndDateResponseDto toEndDateDto(Recruitment recruitment) {
3743
.applicationType(recruitment.getApplicationType())
3844
.build();
3945
}
46+
47+
public RecruitmentDetailsResponseDto toDetailsDto(Recruitment recruitment) {
48+
return RecruitmentDetailsResponseDto.builder()
49+
.id(recruitment.getId())
50+
.title(recruitment.getTitle())
51+
.teamIntroduction(recruitment.getTeamIntroduction())
52+
.startDate(recruitment.getStartDate())
53+
.endDate(recruitment.getEndDate())
54+
.processTimeline(recruitment.getProcessTimeline())
55+
.applicationType(recruitment.getApplicationType())
56+
.jobDescription(recruitment.getJobDescription())
57+
.target(recruitment.getTarget())
58+
.status(recruitment.getStatus().getDescription())
59+
.updatedAt(recruitment.getUpdatedAt())
60+
.build();
61+
}
4062
}

src/main/java/page/clab/api/domain/hiring/recruitment/application/dto/request/RecruitmentRequestDto.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
@Setter
1212
public class RecruitmentRequestDto {
1313

14+
@NotNull(message = "{notNull.recruitment.title}")
15+
@Schema(description = "모집 공고 제목", example = "C-Lab Core Team 3기 모집", required = true)
16+
private String title;
17+
18+
@NotNull(message = "{notNull.recruitment.teamIntroduction}")
19+
@Schema(description = "모집 공고 소개", example = "C-Lab Core Team 3기 모집", required = true)
20+
private String teamIntroduction;
21+
1422
@NotNull(message = "{notNull.recruitment.startDate}")
1523
@Schema(description = "모집 시작일", example = "2023-11-06T00:00:00", required = true)
1624
private LocalDateTime startDate;
@@ -19,10 +27,18 @@ public class RecruitmentRequestDto {
1927
@Schema(description = "모집 종료일", example = "2023-11-08T00:00:00", required = true)
2028
private LocalDateTime endDate;
2129

30+
@NotNull(message = "{notNull.recruitment.processTimeline}")
31+
@Schema(description = "모집 일정", example = "대면 면접 | 09월 10일(화)", required = true)
32+
private String processTimeline;
33+
2234
@NotNull(message = "{notNull.recruitment.applicationType}")
2335
@Schema(description = "구분", example = "CORE_TEAM", required = true)
2436
private ApplicationType applicationType;
2537

38+
@NotNull(message = "{notNull.recruitment.jobDescription}")
39+
@Schema(description = "설명", example = "실무에 가까운 경험을 쌓을 수 있어요.", required = true)
40+
private String jobDescription;
41+
2642
@NotNull(message = "{notNull.recruitment.target}")
2743
@Schema(description = "대상", example = "2~3학년", required = true)
2844
private String target;

src/main/java/page/clab/api/domain/hiring/recruitment/application/dto/request/RecruitmentUpdateRequestDto.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,27 @@
1010
@Setter
1111
public class RecruitmentUpdateRequestDto {
1212

13+
@Schema(description = "모집 공고 제목", example = "C-Lab Core Team 3기 모집")
14+
private String title;
15+
16+
@Schema(description = "모집 공고 소개", example = "C-Lab Core Team 3기 모집")
17+
private String teamIntroduction;
18+
1319
@Schema(description = "모집 시작일", example = "2023-11-06T00:00:00")
1420
private LocalDateTime startDate;
1521

1622
@Schema(description = "모집 종료일", example = "2023-11-08T00:00:00")
1723
private LocalDateTime endDate;
1824

25+
@Schema(description = "모집 일정", example = "대면 면접 | 09월 10일(화)")
26+
private String processTimeline;
27+
1928
@Schema(description = "구분", example = "CORE_TEAM")
2029
private ApplicationType applicationType;
2130

31+
@Schema(description = "설명", example = "실무에 가까운 경험을 쌓을 수 있어요.")
32+
private String jobDescription;
33+
2234
@Schema(description = "대상", example = "2~3학년")
2335
private String target;
2436
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package page.clab.api.domain.hiring.recruitment.application.dto.response;
2+
3+
import java.time.LocalDateTime;
4+
import lombok.Builder;
5+
import lombok.Getter;
6+
import page.clab.api.domain.hiring.application.domain.ApplicationType;
7+
8+
@Getter
9+
@Builder
10+
public class RecruitmentDetailsResponseDto {
11+
12+
private Long id;
13+
private String title;
14+
private String teamIntroduction;
15+
private LocalDateTime startDate;
16+
private LocalDateTime endDate;
17+
private String processTimeline;
18+
private ApplicationType applicationType;
19+
private String jobDescription;
20+
private String target;
21+
private String status;
22+
private LocalDateTime updatedAt;
23+
}

src/main/java/page/clab/api/domain/hiring/recruitment/application/dto/response/RecruitmentResponseDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
public class RecruitmentResponseDto {
1111

1212
private Long id;
13+
private String title;
1314
private LocalDateTime startDate;
1415
private LocalDateTime endDate;
1516
private ApplicationType applicationType;
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package page.clab.api.domain.hiring.recruitment.application.port.in;
22

3-
4-
import page.clab.api.domain.hiring.recruitment.domain.Recruitment;
3+
import page.clab.api.domain.hiring.recruitment.application.dto.response.RecruitmentDetailsResponseDto;
54

65
public interface RetrieveRecruitmentUseCase {
7-
8-
Recruitment getById(Long recruitmentId);
6+
RecruitmentDetailsResponseDto retrieveRecruitmentDetails(Long recruitmentId);
97
}

src/main/java/page/clab/api/domain/hiring/recruitment/application/service/RecruitmentRetrievalService.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
import lombok.RequiredArgsConstructor;
44
import org.springframework.stereotype.Service;
5+
import org.springframework.transaction.annotation.Transactional;
6+
import page.clab.api.domain.hiring.recruitment.application.dto.mapper.RecruitmentDtoMapper;
7+
import page.clab.api.domain.hiring.recruitment.application.dto.response.RecruitmentDetailsResponseDto;
58
import page.clab.api.domain.hiring.recruitment.application.port.in.RetrieveRecruitmentUseCase;
69
import page.clab.api.domain.hiring.recruitment.application.port.out.RetrieveRecruitmentPort;
710
import page.clab.api.domain.hiring.recruitment.domain.Recruitment;
@@ -11,9 +14,12 @@
1114
public class RecruitmentRetrievalService implements RetrieveRecruitmentUseCase {
1215

1316
private final RetrieveRecruitmentPort retrieveRecruitmentPort;
17+
private final RecruitmentDtoMapper mapper;
1418

19+
@Transactional(readOnly = true)
1520
@Override
16-
public Recruitment getById(Long recruitmentId) {
17-
return retrieveRecruitmentPort.getById(recruitmentId);
21+
public RecruitmentDetailsResponseDto retrieveRecruitmentDetails(Long id) {
22+
Recruitment recruitment = retrieveRecruitmentPort.getById(id);
23+
return mapper.toDetailsDto(recruitment);
1824
}
1925
}

src/main/java/page/clab/api/domain/hiring/recruitment/application/service/RecruitmentUpdateService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
import org.springframework.stereotype.Service;
55
import org.springframework.transaction.annotation.Transactional;
66
import page.clab.api.domain.hiring.recruitment.application.dto.request.RecruitmentUpdateRequestDto;
7-
import page.clab.api.domain.hiring.recruitment.application.port.in.RetrieveRecruitmentUseCase;
87
import page.clab.api.domain.hiring.recruitment.application.port.in.UpdateRecruitmentUseCase;
8+
import page.clab.api.domain.hiring.recruitment.application.port.out.RetrieveRecruitmentPort;
99
import page.clab.api.domain.hiring.recruitment.application.port.out.UpdateRecruitmentPort;
1010
import page.clab.api.domain.hiring.recruitment.domain.Recruitment;
1111

1212
@Service
1313
@RequiredArgsConstructor
1414
public class RecruitmentUpdateService implements UpdateRecruitmentUseCase {
1515

16-
private final RetrieveRecruitmentUseCase retrieveRecruitmentUseCase;
16+
private final RetrieveRecruitmentPort retrieveRecruitmentPort;
1717
private final UpdateRecruitmentPort updateRecruitmentPort;
1818
private final RecruitmentStatusUpdater recruitmentStatusUpdater;
1919

2020
@Transactional
2121
@Override
2222
public Long updateRecruitment(Long recruitmentId, RecruitmentUpdateRequestDto requestDto) {
23-
Recruitment recruitment = retrieveRecruitmentUseCase.getById(recruitmentId);
23+
Recruitment recruitment = retrieveRecruitmentPort.getById(recruitmentId);
2424
recruitment.update(requestDto);
2525
recruitmentStatusUpdater.updateRecruitmentStatus(recruitment);
2626
recruitment.validateDateRange();

src/main/java/page/clab/api/domain/hiring/recruitment/domain/Recruitment.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,26 @@
2323
public class Recruitment {
2424

2525
private Long id;
26+
private String title;
27+
private String teamIntroduction;
2628
private LocalDateTime startDate;
2729
private LocalDateTime endDate;
30+
private String processTimeline;
2831
private ApplicationType applicationType;
32+
private String jobDescription;
2933
private String target;
3034
private RecruitmentStatus status;
3135
private Boolean isDeleted;
3236
private LocalDateTime updatedAt;
3337

3438
public void update(RecruitmentUpdateRequestDto recruitmentUpdateRequestDto) {
39+
Optional.ofNullable(recruitmentUpdateRequestDto.getTitle()).ifPresent(this::setTitle);
40+
Optional.ofNullable(recruitmentUpdateRequestDto.getTeamIntroduction()).ifPresent(this::setTeamIntroduction);
3541
Optional.ofNullable(recruitmentUpdateRequestDto.getStartDate()).ifPresent(this::setStartDate);
3642
Optional.ofNullable(recruitmentUpdateRequestDto.getEndDate()).ifPresent(this::setEndDate);
43+
Optional.ofNullable(recruitmentUpdateRequestDto.getProcessTimeline()).ifPresent(this::setProcessTimeline);
3744
Optional.ofNullable(recruitmentUpdateRequestDto.getApplicationType()).ifPresent(this::setApplicationType);
45+
Optional.ofNullable(recruitmentUpdateRequestDto.getJobDescription()).ifPresent(this::setJobDescription);
3846
Optional.ofNullable(recruitmentUpdateRequestDto.getTarget()).ifPresent(this::setTarget);
3947
}
4048

src/main/java/page/clab/api/global/config/SecurityConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class SecurityConstants {
1818
public static final String[] PERMIT_ALL_API_ENDPOINTS_GET = {
1919
"/api/v1/applications/{recruitmentId}/{studentId}",
2020
"/api/v1/recruitments", "/api/v1/recruitments/recent-week",
21+
"/api/v1/recruitments/{recruitmentId}",
2122
"/api/v1/news", "/api/v1/news/**",
2223
"/api/v1/blogs", "/api/v1/blogs/**",
2324
"/api/v1/positions", "/api/v1/positions/**",

0 commit comments

Comments
 (0)