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 @@ -27,7 +27,8 @@ public enum ExceptionMessage {
DUPLICATE_INTEREST_CENTER("이미 관심 표시한 기관입니다."),
NOT_EXISTS_VOLUNTEER_APPLY("존재하지 않는 봉사 활동 지원입니다."),
REVIEW_ALREADY_EXISTS("이미 작성한 리뷰가 존재합니다."),
REVIEW_RESTRICTED_TO_ATTENDED("리뷰는 참석한 봉사에 한해서만 작성할 수 있습니다.")
REVIEW_RESTRICTED_TO_ATTENDED("리뷰는 참석한 봉사에 한해서만 작성할 수 있습니다."),
NOT_EXISTS_REVIEW("존재하지 않는 리뷰입니다."),
;

private final String message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import com.somemore.global.common.response.ApiResponse;
import com.somemore.recruitboard.domain.RecruitStatus;
import com.somemore.recruitboard.domain.VolunteerType;
import com.somemore.recruitboard.domain.VolunteerCategory;
import com.somemore.recruitboard.dto.condition.RecruitBoardNearByCondition;
import com.somemore.recruitboard.dto.condition.RecruitBoardSearchCondition;
import com.somemore.recruitboard.dto.response.RecruitBoardDetailResponseDto;
Expand Down Expand Up @@ -67,14 +67,14 @@ public ApiResponse<Page<RecruitBoardWithCenterResponseDto>> getAll(
public ApiResponse<Page<RecruitBoardWithCenterResponseDto>> getAllBySearch(
@PageableDefault(sort = "created_at", direction = DESC) Pageable pageable,
@RequestParam(required = false) String keyword,
@RequestParam(required = false) VolunteerType type,
@RequestParam(required = false) VolunteerCategory category,
@RequestParam(required = false) String region,
@RequestParam(required = false) Boolean admitted,
@RequestParam(required = false) RecruitStatus status
) {
RecruitBoardSearchCondition condition = RecruitBoardSearchCondition.builder()
.keyword(keyword)
.type(type)
.category(category)
.region(region)
.admitted(admitted)
.status(status)
Expand Down Expand Up @@ -118,14 +118,14 @@ public ApiResponse<Page<RecruitBoardResponseDto>> getRecruitBoardsByCenterId(
@PathVariable UUID centerId,
@PageableDefault(sort = "created_at", direction = DESC) Pageable pageable,
@RequestParam(required = false) String keyword,
@RequestParam(required = false) VolunteerType type,
@RequestParam(required = false) VolunteerCategory category,
@RequestParam(required = false) String region,
@RequestParam(required = false) Boolean admitted,
@RequestParam(required = false) RecruitStatus status
) {
RecruitBoardSearchCondition condition = RecruitBoardSearchCondition.builder()
.keyword(keyword)
.type(type)
.category(category)
.region(region)
.admitted(admitted)
.status(status)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void changeRecruitStatus(RecruitStatus newStatus, LocalDateTime currentDa
private void updateRecruitmentInfo(RecruitBoardUpdateRequestDto dto) {
recruitmentInfo.updateWith(
dto.recruitmentCount(),
dto.volunteerType(),
dto.volunteerCategory(),
dto.volunteerStartDateTime(),
dto.volunteerEndDateTime(),
dto.admitted()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ public class RecruitmentInfo {
private LocalDateTime volunteerEndDateTime;

@Enumerated(value = STRING)
@Column(name = "volunteer_type", nullable = false, length = 30)
private VolunteerType volunteerType;
@Column(name = "volunteer_category", nullable = false, length = 30)
private VolunteerCategory volunteerCategory;

@Column(name = "admitted", nullable = false)
private Boolean admitted;

@Builder
public RecruitmentInfo(String region, Integer recruitmentCount,
LocalDateTime volunteerStartDateTime, LocalDateTime volunteerEndDateTime,
VolunteerType volunteerType, Boolean admitted) {
VolunteerCategory volunteerCategory, Boolean admitted) {

validateVolunteerDateTime(volunteerStartDateTime, volunteerEndDateTime);

this.region = region;
this.recruitmentCount = recruitmentCount;
this.volunteerStartDateTime = volunteerStartDateTime.truncatedTo(MINUTES);
this.volunteerEndDateTime = volunteerEndDateTime.truncatedTo(MINUTES);
this.volunteerType = volunteerType;
this.volunteerCategory = volunteerCategory;
this.admitted = admitted;
}

Expand All @@ -62,14 +62,14 @@ public LocalTime calculateVolunteerTime() {
return LocalTime.of((int) hours, (int) minutes);
}

public void updateWith(Integer recruitmentCount, VolunteerType volunteerType,
public void updateWith(Integer recruitmentCount, VolunteerCategory volunteerCategory,
LocalDateTime volunteerStartDateTime, LocalDateTime volunteerEndDateTime,
Boolean admitted) {

validateVolunteerDateTime(volunteerStartDateTime, volunteerEndDateTime);

this.recruitmentCount = recruitmentCount;
this.volunteerType = volunteerType;
this.volunteerCategory = volunteerCategory;
this.volunteerStartDateTime = volunteerStartDateTime.truncatedTo(MINUTES);
this.volunteerEndDateTime = volunteerEndDateTime.truncatedTo(MINUTES);
this.admitted = admitted;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@Getter
@RequiredArgsConstructor
public enum VolunteerType {
public enum VolunteerCategory {

LIVING_SUPPORT("생활편의지원"),
HOUSING_ENVIRONMENT("주거환경"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.somemore.recruitboard.dto.condition;

import com.somemore.recruitboard.domain.RecruitStatus;
import com.somemore.recruitboard.domain.VolunteerType;
import com.somemore.recruitboard.domain.VolunteerCategory;
import lombok.Builder;
import org.springframework.data.domain.Pageable;

@Builder
public record RecruitBoardSearchCondition(
String keyword,
VolunteerType type,
VolunteerCategory category,
String region,
Boolean admitted,
RecruitStatus status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.somemore.location.dto.request.LocationCreateRequestDto;
import com.somemore.recruitboard.domain.RecruitBoard;
import com.somemore.recruitboard.domain.RecruitmentInfo;
import com.somemore.recruitboard.domain.VolunteerType;
import com.somemore.recruitboard.domain.VolunteerCategory;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
Expand Down Expand Up @@ -36,7 +36,7 @@ public record RecruitBoardCreateRequestDto(
LocalDateTime volunteerEndDateTime,
@Schema(description = "봉사 활동 유형", example = "ENVIRONMENTAL_PROTECTION")
@NotNull(message = "봉사 활동 유형은 필수 값입니다.")
VolunteerType volunteerType,
VolunteerCategory volunteerCategory,
@Schema(description = "봉사 시간 인정 여부", example = "true")
@NotNull(message = "시간 인정 여부는 필수 값입니다.")
Boolean admitted,
Expand All @@ -50,7 +50,7 @@ public RecruitBoard toEntity(UUID centerId, Long locationId, String imgUrl) {
.recruitmentCount(recruitmentCount)
.volunteerStartDateTime(volunteerStartDateTime)
.volunteerEndDateTime(volunteerEndDateTime)
.volunteerType(volunteerType)
.volunteerCategory(volunteerCategory)
.admitted(admitted)
.build();

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

import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.somemore.recruitboard.domain.VolunteerType;
import com.somemore.recruitboard.domain.VolunteerCategory;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
Expand All @@ -29,7 +29,7 @@ public record RecruitBoardUpdateRequestDto(
LocalDateTime volunteerEndDateTime,
@Schema(description = "봉사 활동 유형", example = "ENVIRONMENTAL_PROTECTION")
@NotNull(message = "봉사 활동 유형은 필수 값입니다.")
VolunteerType volunteerType,
VolunteerCategory volunteerCategory,
@Schema(description = "봉사 시간 인정 여부", example = "true")
@NotNull(message = "시간 인정 여부는 필수 값입니다.")
Boolean admitted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.somemore.recruitboard.domain.RecruitBoard;
import com.somemore.recruitboard.domain.RecruitStatus;
import com.somemore.recruitboard.domain.RecruitmentInfo;
import com.somemore.recruitboard.domain.VolunteerType;
import com.somemore.recruitboard.domain.VolunteerCategory;
import com.somemore.recruitboard.repository.mapper.RecruitBoardDetail;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
Expand Down Expand Up @@ -40,7 +40,7 @@ public record RecruitBoardDetailResponseDto(
@Schema(description = "봉사 종료 일시", example = "2024-12-01T13:00:00")
LocalDateTime volunteerEndDateTime,
@Schema(description = "봉사 유형", example = "LIVING_SUPPORT")
VolunteerType volunteerType,
VolunteerCategory volunteerCategory,
@Schema(description = "봉사 시간", example = "04:00:00")
LocalTime volunteerTime,
@Schema(description = "시간 인정 여부", example = "true")
Expand Down Expand Up @@ -73,7 +73,7 @@ public static RecruitBoardDetailResponseDto from(RecruitBoardDetail recruitBoard
.recruitmentCount(info.getRecruitmentCount())
.volunteerStartDateTime(info.getVolunteerStartDateTime())
.volunteerEndDateTime(info.getVolunteerEndDateTime())
.volunteerType(info.getVolunteerType())
.volunteerCategory(info.getVolunteerCategory())
.volunteerTime(info.calculateVolunteerTime())
.admitted(info.getAdmitted())
.imgUrl(board.getImgUrl())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.somemore.recruitboard.domain.RecruitBoard;
import com.somemore.recruitboard.domain.RecruitStatus;
import com.somemore.recruitboard.domain.RecruitmentInfo;
import com.somemore.recruitboard.domain.VolunteerType;
import com.somemore.recruitboard.domain.VolunteerCategory;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
import java.time.LocalTime;
Expand Down Expand Up @@ -41,7 +41,7 @@ public record RecruitBoardResponseDto(
@Schema(description = "봉사 종료 일시", example = "2024-12-01T13:00:00")
LocalDateTime volunteerEndDateTime,
@Schema(description = "봉사 유형", example = "LIVING_SUPPORT")
VolunteerType volunteerType,
VolunteerCategory volunteerCategory,
@Schema(description = "봉사 시간", example = "04:00:00")
LocalTime volunteerTime,
@Schema(description = "시간 인정 여부", example = "true")
Expand All @@ -65,7 +65,7 @@ public static RecruitBoardResponseDto from(RecruitBoard board) {
.recruitmentCount(info.getRecruitmentCount())
.volunteerStartDateTime(info.getVolunteerStartDateTime())
.volunteerEndDateTime(info.getVolunteerEndDateTime())
.volunteerType(info.getVolunteerType())
.volunteerCategory(info.getVolunteerCategory())
.volunteerTime(info.calculateVolunteerTime())
.admitted(info.getAdmitted())
.imgUrl(board.getImgUrl())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.somemore.recruitboard.domain.RecruitBoard;
import com.somemore.recruitboard.domain.RecruitStatus;
import com.somemore.recruitboard.domain.RecruitmentInfo;
import com.somemore.recruitboard.domain.VolunteerType;
import com.somemore.recruitboard.domain.VolunteerCategory;
import com.somemore.recruitboard.repository.mapper.RecruitBoardWithCenter;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
Expand Down Expand Up @@ -40,7 +40,7 @@ public record RecruitBoardWithCenterResponseDto(
@Schema(description = "봉사 종료 일시", example = "2024-12-01T13:00:00")
LocalDateTime volunteerEndDateTime,
@Schema(description = "봉사 유형", example = "LIVING_SUPPORT")
VolunteerType volunteerType,
VolunteerCategory volunteerCategory,
@Schema(description = "봉사 시간", example = "04:00:00")
LocalTime volunteerTime,
@Schema(description = "시간 인정 여부", example = "true")
Expand Down Expand Up @@ -68,7 +68,7 @@ public static RecruitBoardWithCenterResponseDto from(
.recruitmentCount(info.getRecruitmentCount())
.volunteerStartDateTime(info.getVolunteerStartDateTime())
.volunteerEndDateTime(info.getVolunteerEndDateTime())
.volunteerType(info.getVolunteerType())
.volunteerCategory(info.getVolunteerCategory())
.volunteerTime(info.calculateVolunteerTime())
.admitted(info.getAdmitted())
.imgUrl(board.getImgUrl())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.somemore.recruitboard.domain.RecruitBoard;
import com.somemore.recruitboard.domain.RecruitStatus;
import com.somemore.recruitboard.domain.RecruitmentInfo;
import com.somemore.recruitboard.domain.VolunteerType;
import com.somemore.recruitboard.domain.VolunteerCategory;
import com.somemore.recruitboard.repository.mapper.RecruitBoardWithLocation;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
Expand Down Expand Up @@ -41,7 +41,7 @@ public record RecruitBoardWithLocationResponseDto(
@Schema(description = "봉사 종료 일시", example = "2024-12-01T13:00:00")
LocalDateTime volunteerEndDateTime,
@Schema(description = "봉사 유형", example = "LIVING_SUPPORT")
VolunteerType volunteerType,
VolunteerCategory volunteerCategory,
@Schema(description = "봉사 시간", example = "04:00:00")
LocalTime volunteerTime,
@Schema(description = "시간 인정 여부", example = "true")
Expand Down Expand Up @@ -69,7 +69,7 @@ public static RecruitBoardWithLocationResponseDto from(
.recruitmentCount(info.getRecruitmentCount())
.volunteerStartDateTime(info.getVolunteerStartDateTime())
.volunteerEndDateTime(info.getVolunteerEndDateTime())
.volunteerType(info.getVolunteerType())
.volunteerCategory(info.getVolunteerCategory())
.volunteerTime(info.calculateVolunteerTime())
.admitted(info.getAdmitted())
.imgUrl(board.getImgUrl())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.List;

import com.somemore.recruitboard.domain.RecruitStatus;
import com.somemore.recruitboard.domain.VolunteerType;
import com.somemore.recruitboard.domain.VolunteerCategory;
import com.somemore.recruitboard.repository.mapper.RecruitBoardDetail;
import com.somemore.recruitboard.repository.mapper.RecruitBoardWithCenter;
import com.somemore.recruitboard.repository.mapper.RecruitBoardWithLocation;
Expand Down Expand Up @@ -102,7 +102,7 @@ public Page<RecruitBoardWithCenter> findAllWithCenter(RecruitBoardSearchConditio
Pageable pageable = condition.pageable();
BooleanExpression predicate = isNotDeleted()
.and(keywordEq(condition.keyword()))
.and(volunteerTypeEq(condition.type()))
.and(volunteerCategoryEq(condition.category()))
.and(regionEq(condition.region()))
.and(admittedEq(condition.admitted()))
.and(statusEq(condition.status()));
Expand Down Expand Up @@ -167,7 +167,7 @@ public Page<RecruitBoard> findAllByCenterId(UUID centerId,
BooleanExpression predicate = isNotDeleted()
.and(centerIdEq(centerId))
.and(keywordEq(condition.keyword()))
.and(volunteerTypeEq(condition.type()))
.and(volunteerCategoryEq(condition.category()))
.and(regionEq(condition.region()))
.and(admittedEq(condition.admitted()))
.and(statusEq(condition.status()));
Expand Down Expand Up @@ -211,8 +211,8 @@ private BooleanExpression keywordEq(String keyword) {
keyword) : null;
}

private BooleanExpression volunteerTypeEq(VolunteerType type) {
return type != null ? recruitBoard.recruitmentInfo.volunteerType.eq(type)
private BooleanExpression volunteerCategoryEq(VolunteerCategory category) {
return category != null ? recruitBoard.recruitmentInfo.volunteerCategory.eq(category)
: null;
}

Expand Down
Loading