Skip to content

Commit

Permalink
🐛 [Fix] 지원 취소 transactional 추가 및 validation
Browse files Browse the repository at this point in the history
dto validation 추가 및 message 추가
  • Loading branch information
Kimhan-nah committed Apr 6, 2024
1 parent 10c2c9f commit 49ea386
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
@Getter
@NoArgsConstructor(access = lombok.AccessLevel.PROTECTED)
public class RecruitmentRequestDto {
@NotNull
@NotNull(message = "시작일을 입력해주세요.")
@FutureOrPresent(message = "시작일은 현재 시간 이후여야 합니다.")
LocalDateTime startDate;

@NotNull
@NotNull(message = "종료일을 입력해주세요.")
@FutureOrPresent(message = "종료일은 현재 시간 이후여야 합니다.")
LocalDateTime endDate;

Expand All @@ -42,7 +42,7 @@ public class RecruitmentRequestDto {
@Size(max = 50, message = "모집 세대는 50자 이내로 입력해주세요.")
String generation;

@NotNull
@NotNull(message = "폼을 입력해주세요.")
@Valid
List<FormParam> form;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package gg.recruit.api.admin.service.param;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

import lombok.Getter;
Expand All @@ -10,8 +9,7 @@
@Getter
@NoArgsConstructor(access = lombok.AccessLevel.PROTECTED)
public class CheckListContent {
@NotNull
@NotEmpty
@NotBlank(message = "문항 내용을 입력해주세요.")
@Size(min = 1, max = 100, message = "100자 이내로 입력해주세요.")
String content;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class FormParam {
@Size(min = 1, max = 300, message = "질문은 300자 이내로 입력해주세요.")
String question;

@NotNull
@NotNull(message = "inputType을 입력해주세요.")
InputType inputType;

@Valid
Expand All @@ -37,5 +37,4 @@ public FormParam(String question, InputType inputType, List<CheckListContent> ch
public Question toQuestion(Recruitment recruitment, int sortNum) {
return new Question(recruitment, inputType, question, sortNum);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@

import java.util.List;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
public class RecruitApplyFormListReqDto {
@NotNull(message = "forms는 null일 수 없습니다.")
@Valid
private List<RecruitApplyFormReqDto> forms;

public RecruitApplyFormListReqDto(List<RecruitApplyFormReqDto> forms) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import java.util.List;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import gg.data.recruit.recruitment.enums.InputType;
import lombok.AllArgsConstructor;
import lombok.Getter;
Expand All @@ -11,9 +14,13 @@
@NoArgsConstructor
@AllArgsConstructor
public class RecruitApplyFormReqDto {
@NotNull(message = "질문 ID를 입력해주세요.")
private Long questionId;
@NotNull(message = "입력 타입을 입력해주세요.")
private InputType inputType;
@NotNull(message = "체크된 항목을 입력해주세요.")
private List<Long> checkedList;
@NotBlank(message = "답변을 입력해주세요.")
private String answer;

public RecruitApplyFormReqDto(Long questionId, String answer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ private List<ApplicationAnswer> toApplicationAnswer(Application application, Map
return newAnswers;
}

@Transactional
public void deleteApplication(DelApplicationParam param) {
Application application = applicationRepository
.findByUserIdAndRecruitId(param.getUserId(), param.getRecruitmentId())
Expand Down

0 comments on commit 49ea386

Please sign in to comment.