Skip to content

Commit

Permalink
Merge pull request #303 from TEAM-LIAISON/develop
Browse files Browse the repository at this point in the history
fix : 내 이력서 progress 처리 수정 prod server
  • Loading branch information
oznchex authored Jul 22, 2024
2 parents 8730df7 + 5fd96bd commit 54cde72
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ public enum ExceptionCode {
CANNOT_CREATE_TEAM_WISH_BECAUSE_OF_MAX_COUNT(8001, "팀 소개서 찜하기 최대 개수에 도달했습니다. 더 이상 저장할 수 없어요."),

HAVE_TO_INPUT_BOTH_JOB_AND_SKILL(10000, "희망 역할과 보유 기술을 모두 입력해주세요"),
HAVE_TO_INPUT_TEAM_BUILDING_FIELD(10001, "희망 팀빌딩 분야를 입력해주세요"),
HAVE_TO_INPUT_REGION(10002, "활동 지역 및 위치를 입력해주세요"),
HAVE_TO_INPUT_PRIVATE_ATTACH_URL(10003, "내 이력서의 첨부 URL을 입력해주세요"),

// 팀 소개서 관련 항목
NOT_FOUND_TEAM_PROFILE_BY_MEMBER_ID(1005, "사용자의 ID에 해당하는 팀 소개서 정보가 존재하지 않습니다."),
Expand Down
11 changes: 2 additions & 9 deletions src/main/java/liaison/linkit/profile/domain/Profile.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ public void updateIsProfileRegion(final boolean isProfileRegion) {
public void updateIsAntecedents(final boolean isAntecedents) {
log.info("isAntecedents={}", isAntecedents);
this.isAntecedents = isAntecedents;
log.info("this.Antecedents={}", this.isAntecedents);
if (isAntecedents) {
addPerfectionDefault();
} else {
Expand Down Expand Up @@ -338,24 +339,16 @@ public boolean getIsProfileTeamBuildingField() {
public boolean getIsProfileRegion() {
return isProfileRegion;
}
public boolean getIsAntecedents() {
return isAntecedents;
}
public boolean getIsAntecedents() {return isAntecedents;}
public boolean getIsEducation() {
return isEducation;
}
public boolean getIsAwards() {
return isAwards;
}
// public boolean getIsAttach() {
// return isAttach;
// }
public boolean getIsAttachUrl() {
return isAttachUrl;
}
// public boolean getIsAttachFile() {
// return isAttachFile;
// }

// 3.4. 자기소개 초기화 및 삭제 메서드
public void deleteIntroduction() {this.introduction = null;}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import liaison.linkit.auth.Auth;
import liaison.linkit.auth.MemberOnly;
import liaison.linkit.auth.domain.Accessor;
import liaison.linkit.global.exception.BadRequestException;
import liaison.linkit.profile.dto.request.attach.AttachUrlCreateRequest;
import liaison.linkit.profile.dto.response.attach.AttachResponse;
import liaison.linkit.profile.service.AttachService;
Expand All @@ -14,6 +15,8 @@

import java.util.List;

import static liaison.linkit.global.exception.ExceptionCode.HAVE_TO_INPUT_PRIVATE_ATTACH_URL;

@RestController
@RequiredArgsConstructor
@RequestMapping
Expand All @@ -28,6 +31,9 @@ public ResponseEntity<Void> createAttachUrl(
@Auth final Accessor accessor,
@RequestBody @Valid List<AttachUrlCreateRequest> attachUrlCreateRequests
) {
if (attachUrlCreateRequests.isEmpty()) {
throw new BadRequestException(HAVE_TO_INPUT_PRIVATE_ATTACH_URL);
}
attachService.saveUrl(accessor.getMemberId(), attachUrlCreateRequests);
return ResponseEntity.status(HttpStatus.CREATED).build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public ResponseEntity<Void> createEducations(
return ResponseEntity.ok().build();
}

// 학력 단일 생성
@PostMapping("/education")
@MemberOnly
public ResponseEntity<Void> createEducation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ public ResponseEntity<Void> createOnBoardingPersonalJobAndSkill(
@RequestBody @Valid final OnBoardingPersonalJobAndSkillCreateRequest createRequest
) throws BadRequestException {
// 2개 중에 하나라도 null인 경우
if (createRequest.getSkillNames() == null || createRequest.getJobRoleNames() == null) {
if (createRequest.getSkillNames().isEmpty() || createRequest.getJobRoleNames().isEmpty()) {
log.info("createRequest 포함된 값에 Null이 존재합니다.");
throw new BadRequestException(HAVE_TO_INPUT_BOTH_JOB_AND_SKILL);
} else {
// 2개 다 입력이 들어온 경우
profileOnBoardingService.savePersonalJobAndRole(accessor.getMemberId(), createRequest.getJobRoleNames());
profileOnBoardingService.savePersonalSkill(accessor.getMemberId(), createRequest.getSkillNames());

// 2개 모두 저장 완료, true로 저장 완료함
profileOnBoardingService.updateMemberProfileType(accessor.getMemberId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public ResponseEntity<Void> createProfileRegion(
@Auth final Accessor accessor,
@RequestBody @Valid ProfileRegionCreateRequest profileRegionCreateRequest
) {

log.info("memberId={}의 프로필 지역 생성 요청이 들어왔습니다.", accessor.getMemberId());
profileRegionService.save(accessor.getMemberId(), profileRegionCreateRequest);
return ResponseEntity.status(HttpStatus.CREATED).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import liaison.linkit.auth.Auth;
import liaison.linkit.auth.MemberOnly;
import liaison.linkit.auth.domain.Accessor;
import liaison.linkit.global.exception.BadRequestException;
import liaison.linkit.profile.dto.request.teamBuilding.ProfileTeamBuildingCreateRequest;
import liaison.linkit.profile.service.TeamBuildingFieldService;
import lombok.RequiredArgsConstructor;
Expand All @@ -14,11 +15,14 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static liaison.linkit.global.exception.ExceptionCode.HAVE_TO_INPUT_TEAM_BUILDING_FIELD;

@RestController
@RequiredArgsConstructor
@RequestMapping("/private")
@Slf4j
public class TeamBuildingFieldController {

public final TeamBuildingFieldService teamBuildingFieldService;

// 1.5.2. 희망 팀빌딩 분야 생성/수정
Expand All @@ -28,6 +32,10 @@ public ResponseEntity<Void> createProfileTeamBuilding(
@Auth final Accessor accessor,
@RequestBody @Valid ProfileTeamBuildingCreateRequest profileTeamBuildingCreateRequest
) {
if (profileTeamBuildingCreateRequest.getTeamBuildingFieldNames().isEmpty()) {
throw new BadRequestException(HAVE_TO_INPUT_TEAM_BUILDING_FIELD);
}

log.info("memberId={}의 희망 팀빌딩 분야 생성/수정 요청이 들어왔습니다.", accessor.getMemberId());
teamBuildingFieldService.save(accessor.getMemberId(), profileTeamBuildingCreateRequest);
return ResponseEntity.ok().build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public void saveUrl(
final List<AttachUrlCreateRequest> attachUrlCreateRequests
) {
final Profile profile = getProfile(memberId);

// 기존에 존재 이력이 있다면
if (attachUrlRepository.existsByProfileId(profile.getId())) {
attachUrlRepository.deleteAllByProfileId(profile.getId());
profile.updateIsAttachUrl(false);
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/liaison/linkit/profile/service/AwardsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ public void validateAwardsByProfile(final Long profileId) {
// validate 및 실제 비즈니스 로직 구분 라인 -------------------------------------------------------------

public void save(final Long memberId, final AwardsCreateRequest awardsCreateRequest) {
final Profile profile = getProfile(memberId);

// 실제 저장 메서드
saveAwards(profile, awardsCreateRequest);
final Profile profile = getProfile(memberId);

// 기존에 수상 이력 존재 X
if (!profile.getIsAwards()) {
if (profile.getIsAwards()) {
saveAwards(profile, awardsCreateRequest);
} else{
saveAwards(profile, awardsCreateRequest);
profile.updateIsAwards(true);
profile.updateMemberProfileTypeByCompletion();
}
Expand Down Expand Up @@ -154,11 +154,12 @@ public void deleteAwards(final Long memberId, final Long awardsId) {
final Profile profile = getProfile(memberId);
final Awards awards = getAwards(awardsId);

// 해당 수상 정보 삭제
awardsRepository.deleteById(awards.getId());

if (!awardsRepository.existsByProfileId(profile.getId())) {
// 존재하지 않는 경우
profile.cancelPerfectionTen();
profile.updateIsAwards(false);
profile.updateMemberProfileTypeByCompletion();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,12 @@ public void delete(final Long memberId, final Long educationId) {
final Profile profile = getProfile(memberId);
final Education education = getEducation(educationId);

// 해당 학력 삭제
educationRepository.deleteById(education.getId());

log.info("삭제 완료");
if (!educationRepository.existsByProfileId(profile.getId())) {
profile.updateIsEducation(false);
profile.cancelPerfectionDefault();
profile.updateMemberProfileTypeByCompletion();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ public void save(final Long memberId, final ProfileRegionCreateRequest profileRe
);

if (region == null) {
throw new IllegalArgumentException("Region not found for city: " +
profileRegionCreateRequest.getCityName() + " and division: " +
profileRegionCreateRequest.getDivisionName());
throw new BadRequestException(HAVE_TO_INPUT_REGION);
}

ProfileRegion newProfileRegion = new ProfileRegion(null, profile, region);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,20 @@ public void validateBrowseProfileTeamBuildingFieldByProfile(final Long profileId

// 희망 팀빌딩 분야 저장 비즈니스 로직
public void save(final Long memberId, final ProfileTeamBuildingCreateRequest createRequest) {

final Profile profile = getProfile(memberId);

// 이미 저장된 이력이 존재하는 프로필의 경우 먼저 삭제한다.

if (profileTeamBuildingFieldRepository.existsByProfileId(profile.getId())) {
// 전체 삭제
profileTeamBuildingFieldRepository.deleteAllByProfileId(profile.getId());

// 삭제 이후 false 변경과 11.8 빼기 진행해줘야 함
profile.updateIsProfileTeamBuildingField(false);
profile.updateMemberProfileTypeByCompletion();
}

// 무조건 입력 값이 들어온다
final List<TeamBuildingField> teamBuildingFields = teamBuildingFieldRepository
.findTeamBuildingFieldsByFieldNames(createRequest.getTeamBuildingFieldNames());

Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spring:
use_sql_comments: true
show_sql: false
hibernate:
ddl-auto: create
ddl-auto: validate

datasource:
url: ${database.url}
Expand All @@ -36,13 +36,13 @@ spring:

sql:
init:
mode: always
mode: never

batch:
job:
enabled: true
enabled: false
jdbc:
initialize-schema: always
initialize-schema: never

security:
oauth2:
Expand Down

0 comments on commit 54cde72

Please sign in to comment.