diff --git a/main-server/src/main/java/com/sickgyun/server/profile/domain/value/Filter.java b/main-server/src/main/java/com/sickgyun/server/profile/domain/value/Filter.java index 161d5ff..8c68ad3 100644 --- a/main-server/src/main/java/com/sickgyun/server/profile/domain/value/Filter.java +++ b/main-server/src/main/java/com/sickgyun/server/profile/domain/value/Filter.java @@ -1,10 +1,8 @@ package com.sickgyun.server.profile.domain.value; -import java.util.List; - public record Filter( Boolean isRecruited, - List majors, + Major major, Long cardinal ) { } diff --git a/main-server/src/main/java/com/sickgyun/server/profile/infra/database/QueryProfileRepositoryImpl.java b/main-server/src/main/java/com/sickgyun/server/profile/infra/database/QueryProfileRepositoryImpl.java index 5dcf3cf..0f6fb13 100644 --- a/main-server/src/main/java/com/sickgyun/server/profile/infra/database/QueryProfileRepositoryImpl.java +++ b/main-server/src/main/java/com/sickgyun/server/profile/infra/database/QueryProfileRepositoryImpl.java @@ -31,18 +31,18 @@ public List findAllFiltered(Filter filter) { .leftJoin(profile.writer, user) .fetchJoin() .where( - majorFilter(filter.majors()), + majorFilter(filter.major()), recruitedFilter(filter.isRecruited()), cardinalFilter(filter.cardinal()) ).fetch(); } - private BooleanExpression majorFilter(List majors) { - if (majors == null) { + private BooleanExpression majorFilter(Major major) { + if (major == null) { return null; } - return profile.information.major.in(majors); + return profile.information.major.eq(major); } private BooleanExpression recruitedFilter(Boolean isRecruited) { diff --git a/main-server/src/main/java/com/sickgyun/server/profile/presentation/dto/FilterRequest.java b/main-server/src/main/java/com/sickgyun/server/profile/presentation/dto/FilterRequest.java index 99d12c3..7ad285f 100644 --- a/main-server/src/main/java/com/sickgyun/server/profile/presentation/dto/FilterRequest.java +++ b/main-server/src/main/java/com/sickgyun/server/profile/presentation/dto/FilterRequest.java @@ -1,7 +1,5 @@ package com.sickgyun.server.profile.presentation.dto; -import java.util.List; - import org.springframework.web.bind.annotation.RequestParam; import com.sickgyun.server.profile.domain.value.Filter; @@ -11,14 +9,14 @@ public record FilterRequest( @RequestParam(required = false) Boolean isRecruited, @RequestParam(required = false) - List majors, + Major major, @RequestParam(required = false) Long cardinal ) { public Filter toDomain() { return new Filter( isRecruited, - majors, + major, cardinal ); } diff --git a/main-server/src/test/java/com/sickgyun/server/profile/service/QueryProfileServiceTest.java b/main-server/src/test/java/com/sickgyun/server/profile/service/QueryProfileServiceTest.java index 0efe9fe..0561d95 100644 --- a/main-server/src/test/java/com/sickgyun/server/profile/service/QueryProfileServiceTest.java +++ b/main-server/src/test/java/com/sickgyun/server/profile/service/QueryProfileServiceTest.java @@ -94,11 +94,11 @@ public class QueryProfileServiceTest extends ServiceTest { } private List 전공이_ETC인_사람() { - return queryProfileService.readAll(new Filter(null, List.of(Major.ETC), null)); + return queryProfileService.readAll(new Filter(null, Major.ETC, null)); } private List 전공이_GAME_혹은_BACKEND_이고_취업한_사람() { - return queryProfileService.readAll(new Filter(true, List.of(Major.GAME, Major.BACKEND), null)); + return queryProfileService.readAll(new Filter(true, Major.GAME, null)); } private List 입학년도가_2021년인_사람_조회() {