Skip to content

Commit

Permalink
Merge pull request #169 from kakao-tech-campus-2nd-step3/Develop
Browse files Browse the repository at this point in the history
[Master] [지원, μœ μ €μ •λ³΄] μ½”λ“œ λ¦¬νŒ©ν† λ§ 및 μ—”λ“œν¬μΈνŠΈ λ³€κ²½
  • Loading branch information
LeeTaek2T authored Nov 13, 2024
2 parents 1afb216 + a344a90 commit 361422d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public ApplicationFormResponse findApplicationForm(Long applyId) {
return applicationFormResponse;
}


//(κ³ μš©μ£Όμž…μž₯)ꡬ인글에 μ§€μ›ν•œ μ§€μ›μž 확인
public List<ApplierPerRecruitmentResponse> searchApplicant(Long recruitmentId, User user) {
Recruitment recruitment = findRecruitment(recruitmentId);

Expand All @@ -94,6 +94,7 @@ private ApplierPerRecruitmentResponse createApplierPerRecruitmentResponse(Apply
);
}

//(μ§€μ›μž μž…μž₯) μžμ‹ μ΄ μ§€μ›ν•œ κ³³λ“€ ν™•μΈν•˜λŠ” λ©”μ„œλ“œ
public List<RecruitmentsOfApplierResponse> searchMyAppliedRecruitments(User user) {
return applyRepository.findByUser(user)
.orElseThrow(() -> new NoSuchElementException("ν•΄λ‹Ήν•˜λŠ” 지원이 μ—†μŠ΅λ‹ˆλ‹€."))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
Expand Down Expand Up @@ -87,8 +88,8 @@ public ResponseEntity<Void> fillInVisa(@RequestBody VisaRequest visaRequest,
}

@Operation(summary = "λΉ„μž 정보 κ°€μ Έμ˜€κΈ°")
@GetMapping("/visa")
public ResponseEntity<VisaResponse> findVisa(@RequestParam("userId") Long userId) {
@GetMapping("/visa/{userId}")
public ResponseEntity<VisaResponse> findVisa(@PathVariable("userId") Long userId) {
VisaResponse visaResponse = userInformationService.findVisa(userId);
return ResponseEntity.ok(visaResponse);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,34 @@ public UserInformationService(ForeignerInformationRepository foreignerInformatio
this.fileUtil = fileUtil;
}


public Long createCompany(CompanyRequest companyRequest, MultipartFile logoImage, User user) {
byte[] imageFile = null;
String storedFileName = null;
String storedFileName = getStoredFileName(logoImage, user);
Company company = createCompanyEntity(companyRequest, storedFileName, user);
return companyRepository.save(company).getId();
}

private String getStoredFileName(MultipartFile logoImage, User user) {
if (logoImage == null) {
storedFileName = defaultLogoUrl;
} else {
imageFile = fileUtil.safelyGetBytes(logoImage)
.orElseThrow(() -> new IllegalArgumentException("multipart νŒŒμΌμ„ 읽지 λͺ»ν•˜μ˜€μŠ΅λ‹ˆλ‹€."));
storedFileName = gcsUploader.upload(imageFile, "companyLogo",
user.getId().toString() + "Real" + logoImage.getOriginalFilename())
.orElseThrow(() -> new NoSuchElementException("파일 μ—…λ‘œλ“œμ— μ‹€νŒ¨ν–ˆμŠ΅λ‹ˆλ‹€."));
return defaultLogoUrl;
}
Company company = new Company(companyRequest.name(), companyRequest.industryOccupation(),
companyRequest.brand(), companyRequest.revenuePerYear(), storedFileName, user);
Company savedCompany = companyRepository.save(company);
return savedCompany.getId();
byte[] imageFile = fileUtil.safelyGetBytes(logoImage)
.orElseThrow(() -> new IllegalArgumentException("multipart νŒŒμΌμ„ 읽지 λͺ»ν•˜μ˜€μŠ΅λ‹ˆλ‹€."));

return gcsUploader.upload(imageFile, "companyLogo",
user.getId() + "Real" + logoImage.getOriginalFilename())
.orElseThrow(() -> new NoSuchElementException("파일 μ—…λ‘œλ“œμ— μ‹€νŒ¨ν–ˆμŠ΅λ‹ˆλ‹€."));
}

private Company createCompanyEntity(CompanyRequest request, String logoUrl, User user) {
return new Company(
request.name(),
request.industryOccupation(),
request.brand(),
request.revenuePerYear(),
logoUrl,
user
);
}

public List<CompanyResponse> findCompany(User user) {
Expand Down

0 comments on commit 361422d

Please sign in to comment.