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 @@ -35,7 +35,6 @@ public class ResumeController {
schema = @Schema(implementation = ResumeCreateRequest.class),
examples = @ExampleObject(value = """
{
"applicantId": 123,
"title": "프론트엔드 개발자 이력서",
"name": "홍길동",
"introduction": "React와 Next.js 기반 프로젝트를 다수 진행했습니다.",
Expand All @@ -53,10 +52,13 @@ public class ResumeController {
schema = @Schema(implementation = ResumeResponse.class)))
)
public ResponseEntity<ResumeResponse> createResume(
@AuthenticationPrincipal Jwt jwt, // 인증 정책에 따라 사용 여부 결정
@AuthenticationPrincipal Jwt jwt,
@Valid @RequestBody ResumeCreateRequest request
) {
Long resumeId = resumeService.createResume(request);
Long currentUserId = com.chaineeproject.chainee.security.SecurityUtils.uidOrNull(jwt);
if (currentUserId == null) return ResponseEntity.status(401).build();

Long resumeId = resumeService.createResumeFor(currentUserId, request);
return ResponseEntity.ok(new ResumeResponse(true, "RESUME_CREATED", resumeId));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,35 @@

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import java.util.List;

@Schema(name = "ResumeCreateRequest", description = "이력서 생성 요청")
public record ResumeCreateRequest(
@Schema(description = "지원자 ID", example = "19")
@NotBlank Long applicantId,
@Schema(description = "이력서 제목", example = "백엔드 개발자 이력서")
@NotBlank @Size(max = 200)
String title,

@Schema(description = "이력서 제목", example = "프론트엔드 개발자 이력서")
@NotBlank String title,
@Schema(description = "지원자 이름", example = "김여은")
@NotBlank @Size(max = 100)
String name,

@Schema(description = "지원자 이름", example = "홍길동")
@NotBlank String name,

@Schema(description = "자기소개", example = "React와 Next.js 기반 프로젝트를 다수 진행했습니다.")
@Schema(description = "자기소개", example = "Spring Boot 기반 프로젝트를 다수 진행했습니다.")
@Size(max = 4000)
String introduction,

@Schema(description = "희망 포지션", example = "프론트엔드 개발자")
@Schema(description = "희망 포지션", example = "백엔드 개발자")
@Size(max = 100)
String desiredPosition,

@Schema(description = "보유 기술 목록", example = "[\"React\", \"TypeScript\", \"TailwindCSS\"]")
@Schema(description = "보유 기술 목록", example = "[\"Spring Boot\",\"Java\",\"MySQL\"]")
List<String> skills,

@Schema(description = "경력 수준", example = "3-5년")
@Size(max = 50)
String careerLevel,

@Schema(description = "포트폴리오 URL", example = "https://portfolio.example.com")
@Size(max = 500)
String portfolioUrl
) {}
26 changes: 13 additions & 13 deletions src/main/java/com/chaineeproject/chainee/service/ResumeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ public class ResumeService {
private final ResumeRepository resumeRepository;

// ========= 생성 =========
public Long createResume(ResumeCreateRequest request) {
User applicant = userRepository.findById(request.applicantId())
public Long createResumeFor(Long currentUserId, ResumeCreateRequest req) {
User applicant = userRepository.findById(currentUserId)
.orElseThrow(() -> new ApplicationException(ErrorCode.APPLICANT_NOT_FOUND));

Resume resume = new Resume();
resume.setOwner(applicant);
resume.setTitle(request.title());
resume.setName(request.name());
resume.setIntroduction(request.introduction());
resume.setDesiredPosition(request.desiredPosition());
if (request.skills() != null) resume.setSkills(String.join(",", request.skills()));
resume.setCareerLevel(request.careerLevel());
resume.setPortfolioUrl(request.portfolioUrl());
resume.setCreatedAt(LocalDateTime.now());
Resume r = new Resume();
r.setOwner(applicant);
r.setTitle(req.title());
r.setName(req.name());
r.setIntroduction(req.introduction());
r.setDesiredPosition(req.desiredPosition());
if (req.skills() != null) r.setSkills(String.join(",", req.skills()));
r.setCareerLevel(req.careerLevel());
r.setPortfolioUrl(req.portfolioUrl());
r.setCreatedAt(LocalDateTime.now());

return resumeRepository.save(resume).getId();
return resumeRepository.save(r).getId();
}

// ========= 조회(본인) 목록 =========
Expand Down