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 @@ -3,6 +3,7 @@
import com.teamEWSN.gitdeun.Recruitment.entity.Recruitment;
import com.teamEWSN.gitdeun.Recruitment.entity.RecruitmentField;
import com.teamEWSN.gitdeun.common.util.AuditedEntity;
import com.teamEWSN.gitdeun.user.entity.User;
import jakarta.persistence.*;
import lombok.*;

Expand Down Expand Up @@ -34,13 +35,16 @@ public class Application extends AuditedEntity {
@JoinColumn(name = "recruitment_id", nullable = false)
private Recruitment recruitment;

/** 신청 사용자 (User.id) */
@Column(name = "applicant_id", nullable = false)
private Long applicantId;
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(
name = "applicant_id", nullable = false,
foreignKey = @ForeignKey(name = "fk_applicant_user") // 외래키 값 명시
)
private User applicant;

/** 지원 분야 (작성자의 모집 분야 중에서 선택) */
@Enumerated(EnumType.STRING)
@Column(name = "applied_field", nullable = false, length = 32)
@Column(name = "applied_field", length = 32)
private RecruitmentField appliedField;

/** 지원 메세지 */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.teamEWSN.gitdeun.Recruitment.entity;

import com.teamEWSN.gitdeun.Application.entity.Application;
import com.teamEWSN.gitdeun.userskill.entity.DeveloperSkillEnum;
import com.teamEWSN.gitdeun.user.entity.User;
import com.teamEWSN.gitdeun.userskill.entity.DeveloperSkill;
import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import java.time.LocalDateTime;
import java.util.ArrayList;
Expand All @@ -30,81 +28,85 @@ public class Recruitment {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

/** 모집자 (자동 선택, User.id) */
@Column(name = "Recruiter_id", nullable = false)
private Long RecruiterId;
// 모집자
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(
name = "recruiter_id", nullable = false,
foreignKey = @ForeignKey(name = "fk_recruitment_user") // 외래키 값 명시
)
private User recruiter;

/** 모집 공고 제목 (입력 필요) */
// 모집 공고 제목 (입력 필요)
@Column(nullable = false, length = 120)
private String title;

/** 연락망: 이메일 주소 (입력 필요) */
// 연락망: 이메일 주소 (입력 필요)
@Column(length = 120)
private String contactEmail;

/** 모집일 (입력 필요) */
// 모집일 (입력 필요)
@Column(name = "start_at", nullable = false)
private LocalDateTime startAt;

// 모집 마감일 (입력 필요)
@Column(name = "end_at", nullable = false)
private LocalDateTime endAt;

/** 모집 내용 (입력 필요) */
@Lob
// 모집 내용 (입력 필요)
@Lob // 해당 필드를 DB에서 대용량 저장하도록 매핑
@Column(nullable = false)
private String content;

/** 팀 규모(총인원) (입력 필요)*/
// 팀 규모(총인원) (입력 필요)
@Column(name = "team_size_total", nullable = false)
private Integer teamSizeTotal;

/** 남은 모집 인원(입력 필요) – 신청 시 1 감소, 철회/거절 시 1 증가(복원) */
// 남은 모집 인원(입력 필요) – 신청 시 1 감소, 철회/거절 시 1 증가(복원)
@Column(name = "recruit_quota", nullable = false)
private Integer recruitQuota;

/** 개발 언어 태그 (선택 필요) - 화면 필터/표시용 */
// 개발 분야 태그 (선택 필요) - BACKEND/FRONTEND/AI 등
@ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name = "recruitment_language_tags", joinColumns = @JoinColumn(name = "recruitment_id"))
@Column(name = "language", nullable = false, length = 64)
@CollectionTable(name = "recruitment_field_tags", joinColumns = @JoinColumn(name = "recruitment_id"))
@Column(name = "field", nullable = false, length = 32)
@Enumerated(EnumType.STRING)
@Builder.Default
private Set<DeveloperSkillEnum> languageTags = new HashSet<>();
private Set<RecruitmentField> fieldTags = new HashSet<>();

/** 개발 분야 태그 (선택 필요) - BACKEND/FRONTEND/AI 등 */
// 개발 언어 태그 (선택 필요) - 화면 필터/표시용
@ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name = "recruitment_field_tags", joinColumns = @JoinColumn(name = "recruitment_id"))
@Column(name = "field", nullable = false, length = 32)
@CollectionTable(name = "recruitment_language_tags", joinColumns = @JoinColumn(name = "recruitment_id"))
@Column(name = "language", nullable = false, length = 64)
@Enumerated(EnumType.STRING)
@Builder.Default
private Set<RecruitmentField> fieldTags = new HashSet<>();
private Set<DeveloperSkill> languageTags = new HashSet<>();

/** 모집 상태 (모집 예정 / 모집 중 / 모집 마감) */
// 모집 상태 (모집 예정 / 모집 중 / 모집 마감)
@Enumerated(EnumType.STRING)
@Column(nullable = false, length = 24)
private RecruitmentStatus status;

/** 조회수 */
@Column(name = "view_count", nullable = false)
// 조회수
@Column(name = "views", nullable = false)
@Builder.Default
private Long viewCount = 0L;
private int views = 0;

/** 모집 공고 이미지 (선택) */
// 모집 공고 이미지 (선택)
@Builder.Default
@OneToMany(mappedBy = "recruitment", cascade = CascadeType.ALL, orphanRemoval = true)
private List<RecruitmentImage> recruitmentImages = new ArrayList<>();

/** 지원 신청 리스트 (양방향 필요시 매핑) */
/*// 지원 신청 리스트
@OneToMany(mappedBy = "recruitment", fetch = FetchType.LAZY)
@Builder.Default
private List<Application> applications = new ArrayList<>();
private List<Application> applications = new ArrayList<>();*/

/** 추천 가중치용 요구 기술(언어/프레임워크/툴 등, 선택) */
// 추천 가중치용 요구 기술(언어/프레임워크/툴 등, 선택)
@OneToMany(mappedBy = "recruitment", cascade = CascadeType.ALL, orphanRemoval = true)
@Builder.Default
private Set<RecruitmentRequiredSkill> requiredSkills = new HashSet<>();



public void increaseView() { this.viewCount++; }
public void increaseView() { this.views++; }
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.teamEWSN.gitdeun.Recruitment.entity;

import com.teamEWSN.gitdeun.userskill.entity.DeveloperSkillEnum;
import com.teamEWSN.gitdeun.userskill.entity.DeveloperSkill;
import jakarta.persistence.*;
import lombok.*;

Expand Down Expand Up @@ -28,7 +28,7 @@ public class RecruitmentRequiredSkill {

@Enumerated(EnumType.STRING)
@Column(nullable = false, length = 64)
private DeveloperSkillEnum skill;
private DeveloperSkill skill;

@Enumerated(EnumType.STRING)
@Column(nullable = false, length = 32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.teamEWSN.gitdeun.userskill.dto.CategorizedSkillsResponseDto;
import com.teamEWSN.gitdeun.userskill.dto.CategorizedSkillsWithSelectionDto;
import com.teamEWSN.gitdeun.userskill.dto.SkillSelectionRequestDto;
import com.teamEWSN.gitdeun.userskill.entity.DeveloperSkillEnum;
import com.teamEWSN.gitdeun.userskill.entity.DeveloperSkill;
import com.teamEWSN.gitdeun.userskill.service.UserSkillService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
Expand All @@ -28,10 +28,10 @@ public class UserSkillController {
@GetMapping
public ResponseEntity<CategorizedSkillsResponseDto> getAvailableInterests() {
// Enum에서 카테고리별 displayName 값 추출
Map<String, List<String>> categorizedInterests = Arrays.stream(DeveloperSkillEnum.values())
Map<String, List<String>> categorizedInterests = Arrays.stream(DeveloperSkill.values())
.collect(Collectors.groupingBy(
DeveloperSkillEnum::getCategory,
Collectors.mapping(DeveloperSkillEnum::getDisplayName, Collectors.toList())
DeveloperSkill::getCategory,
Collectors.mapping(DeveloperSkill::getDisplayName, Collectors.toList())
));
return ResponseEntity.ok(new CategorizedSkillsResponseDto(categorizedInterests));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@Getter
@AllArgsConstructor
public enum DeveloperSkillEnum {
public enum DeveloperSkill {
// 프로그래밍 언어
JAVASCRIPT("JavaScript", "LANGUAGE"),
TYPESCRIPT("TypeScript", "LANGUAGE"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.teamEWSN.gitdeun.user.repository.UserRepository;
import com.teamEWSN.gitdeun.userskill.dto.CategorizedSkillsWithSelectionDto;
import com.teamEWSN.gitdeun.userskill.dto.DeveloperSkillDto;
import com.teamEWSN.gitdeun.userskill.entity.DeveloperSkillEnum;
import com.teamEWSN.gitdeun.userskill.entity.DeveloperSkill;
import com.teamEWSN.gitdeun.userskill.entity.UserSkill;
import com.teamEWSN.gitdeun.userskill.repository.UserSkillRepository;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -47,9 +47,9 @@ public CategorizedSkillsWithSelectionDto getUserSkillsWithSelection(Long userId)

// 카테고리별로 모든 기술을 분류하고 선택 여부 표시
Map<String, List<DeveloperSkillDto>> categorizedSkills =
Arrays.stream(DeveloperSkillEnum.values())
Arrays.stream(DeveloperSkill.values())
.collect(Collectors.groupingBy(
DeveloperSkillEnum::getCategory,
DeveloperSkill::getCategory,
LinkedHashMap::new, // 순서 보장
Collectors.mapping(
skillEnum -> new DeveloperSkillDto(
Expand Down Expand Up @@ -114,8 +114,8 @@ private void validateSkillSelection(List<String> selectedSkills) {
}

// 유효한 기술인지 검증 (Set으로 변환하여 검색 성능 향상)
Set<String> validSkills = Arrays.stream(DeveloperSkillEnum.values())
.map(DeveloperSkillEnum::getDisplayName)
Set<String> validSkills = Arrays.stream(DeveloperSkill.values())
.map(DeveloperSkill::getDisplayName)
.collect(Collectors.toSet());

// 유효하지 않은 기술 리스트 확인
Expand Down