Skip to content

Commit 3bb940f

Browse files
committed
feat(volunteer): 리뷰 조회에 필요한 기능 추가
1 parent 14de8b6 commit 3bb940f

File tree

5 files changed

+37
-11
lines changed

5 files changed

+37
-11
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
package com.somemore.volunteer.repository;
22

33
import com.somemore.volunteer.domain.Volunteer;
4+
import java.util.List;
5+
import java.util.UUID;
46
import org.springframework.data.jpa.repository.JpaRepository;
57

68
public interface VolunteerJpaRepository extends JpaRepository<Volunteer, Long> {
9+
10+
List<Volunteer> findAllByIdInAndDeletedFalse(List<UUID> ids);
11+
712
}
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
package com.somemore.volunteer.repository;
22

33
import com.somemore.volunteer.domain.Volunteer;
4-
import org.springframework.stereotype.Repository;
5-
4+
import java.util.List;
65
import java.util.Optional;
76
import java.util.UUID;
7+
import org.springframework.stereotype.Repository;
88

99
@Repository
1010
public interface VolunteerRepository {
11+
1112
Volunteer save(Volunteer volunteer);
13+
1214
Optional<Volunteer> findById(UUID id);
15+
1316
Optional<Volunteer> findByOauthId(String oauthId);
17+
1418
String findNicknameById(UUID id);
19+
1520
void deleteAllInBatch();
21+
22+
List<Volunteer> findAllByIds(List<UUID> volunteerIds);
1623
}

src/main/java/com/somemore/volunteer/repository/VolunteerRepositoryImpl.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
import com.querydsl.jpa.impl.JPAQueryFactory;
66
import com.somemore.volunteer.domain.QVolunteer;
77
import com.somemore.volunteer.domain.Volunteer;
8-
import lombok.RequiredArgsConstructor;
9-
import org.springframework.stereotype.Repository;
10-
8+
import java.util.List;
119
import java.util.Optional;
1210
import java.util.UUID;
11+
import lombok.RequiredArgsConstructor;
12+
import org.springframework.stereotype.Repository;
1313

1414
@RequiredArgsConstructor
1515
@Repository
@@ -46,6 +46,11 @@ public void deleteAllInBatch() {
4646
volunteerJpaRepository.deleteAllInBatch();
4747
}
4848

49+
@Override
50+
public List<Volunteer> findAllByIds(List<UUID> volunteerIds) {
51+
return volunteerJpaRepository.findAllByIdInAndDeletedFalse(volunteerIds);
52+
}
53+
4954
private Optional<Volunteer> findOne(BooleanExpression condition) {
5055

5156
return Optional.ofNullable(

src/main/java/com/somemore/volunteer/service/VolunteerQueryService.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.somemore.volunteer.service;
22

3+
import static com.somemore.global.exception.ExceptionMessage.NOT_EXISTS_VOLUNTEER;
4+
35
import com.somemore.facade.validator.VolunteerDetailAccessValidator;
46
import com.somemore.global.exception.BadRequestException;
57
import com.somemore.volunteer.domain.Volunteer;
@@ -8,15 +10,13 @@
810
import com.somemore.volunteer.repository.VolunteerDetailRepository;
911
import com.somemore.volunteer.repository.VolunteerRepository;
1012
import com.somemore.volunteer.usecase.VolunteerQueryUseCase;
13+
import java.util.List;
14+
import java.util.UUID;
1115
import lombok.RequiredArgsConstructor;
1216
import lombok.extern.slf4j.Slf4j;
1317
import org.springframework.stereotype.Service;
1418
import org.springframework.transaction.annotation.Transactional;
1519

16-
import java.util.UUID;
17-
18-
import static com.somemore.global.exception.ExceptionMessage.NOT_EXISTS_VOLUNTEER;
19-
2020
@Slf4j
2121
@Service
2222
@RequiredArgsConstructor
@@ -45,7 +45,8 @@ public VolunteerProfileResponseDto getVolunteerProfile(UUID volunteerId) {
4545
}
4646

4747
@Override
48-
public VolunteerProfileResponseDto getVolunteerDetailedProfile(UUID volunteerId, UUID centerId) {
48+
public VolunteerProfileResponseDto getVolunteerDetailedProfile(UUID volunteerId,
49+
UUID centerId) {
4950
volunteerDetailAccessValidator.validateByCenterId(centerId, volunteerId);
5051

5152
return VolunteerProfileResponseDto.from(
@@ -72,6 +73,11 @@ public String getNicknameById(UUID id) {
7273
return nickname;
7374
}
7475

76+
@Override
77+
public List<Volunteer> getAllByIds(List<UUID> volunteerIds) {
78+
return volunteerRepository.findAllByIds(volunteerIds);
79+
}
80+
7581
private Volunteer findVolunteer(UUID volunteerId) {
7682
return volunteerRepository.findById(volunteerId)
7783
.orElseThrow(() -> new BadRequestException(NOT_EXISTS_VOLUNTEER));

src/main/java/com/somemore/volunteer/usecase/VolunteerQueryUseCase.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package com.somemore.volunteer.usecase;
22

3+
import com.somemore.volunteer.domain.Volunteer;
34
import com.somemore.volunteer.dto.response.VolunteerProfileResponseDto;
4-
5+
import java.util.List;
56
import java.util.UUID;
67

78
public interface VolunteerQueryUseCase {
@@ -15,4 +16,6 @@ public interface VolunteerQueryUseCase {
1516
UUID getVolunteerIdByOAuthId(String oAuthId);
1617

1718
String getNicknameById(UUID id);
19+
20+
List<Volunteer> getAllByIds(List<UUID> volunteerIds);
1821
}

0 commit comments

Comments
 (0)