Skip to content

Commit

Permalink
🛠 :: (#830) getCurrentCompany 가져오기
Browse files Browse the repository at this point in the history
  • Loading branch information
4mjeo committed Nov 6, 2024
1 parent db635dc commit 849f77c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@

import lombok.RequiredArgsConstructor;
import team.retum.jobis.common.annotation.ReadOnlyUseCase;
import team.retum.jobis.common.spi.SecurityPort;
import team.retum.jobis.domain.recruitment.spi.RecruitmentPort;

@RequiredArgsConstructor
@ReadOnlyUseCase
public class CheckRecruitmentExistsUseCase {

private final RecruitmentPort recruitmentPort;
private final SecurityPort securityPort;

public boolean execute(Long companyId, boolean winterIntern) {
public boolean execute(boolean winterIntern) {
Long companyId = securityPort.getCurrentCompany().getId();
return recruitmentPort.existsByCompanyIdAndWinterIntern(companyId, winterIntern);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ public interface RecruitmentJpaRepository extends JpaRepository<RecruitmentEntit
@Query("SELECT r FROM RecruitmentEntity r WHERE r.createdAt BETWEEN :startDate AND :endDate")
List<Recruitment> findByCreationDateBetween(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);

boolean existsByCompanyId(Long companyId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,9 @@ public byte[] exportRecruitmentHistory(HttpServletResponse httpResponse) {
return response.getFile();
}

@GetMapping("/exists/{company-id}")
public boolean checkRecruitmentExists(
@PathVariable("company-id") Long companyId,
@RequestParam(value = "winter_intern") Boolean winterIntern
) {
return checkRecruitmentExistsUseCase.execute(companyId, winterIntern);
@GetMapping("/exists")
public boolean checkRecruitmentExists(@RequestParam(value = "winter_intern") Boolean winterIntern) {
return checkRecruitmentExistsUseCase.execute(winterIntern);
}

private List<Long> parseCodes(String jobCode, String techCodes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.requestMatchers(HttpMethod.DELETE, "/recruitments/area/{recruit-area-id}").hasAnyAuthority(TEACHER.name(), COMPANY.name())
.requestMatchers(HttpMethod.GET, "/recruitments/file").hasAuthority(TEACHER.name())
.requestMatchers(HttpMethod.GET, "/recruitments/count").hasAnyAuthority(TEACHER.name())
.requestMatchers(HttpMethod.GET, "/recruitments/exists/{company-id}").hasAnyAuthority(COMPANY.name())
.requestMatchers(HttpMethod.GET, "/recruitments/exists").hasAnyAuthority(COMPANY.name())

// bugs
.requestMatchers(HttpMethod.GET, "/bugs").hasAuthority(DEVELOPER.name())
Expand Down

0 comments on commit 849f77c

Please sign in to comment.