Skip to content

Commit fbb6da7

Browse files
KoSeonJe5uhwann
andauthored
[release] v.1.2.1 (#228)
Co-authored-by: 5uhwann <[email protected]>
1 parent 6c12b96 commit fbb6da7

File tree

15 files changed

+323
-135
lines changed

15 files changed

+323
-135
lines changed

.github/codeowners

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @wonjunYou @5uhwann @KoSeonJe
1+
* @wonjunYou @5uhwann @KoSeonJe @Seooooo24

src/main/java/ddingdong/ddingdongBE/domain/club/repository/ClubRepository.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import ddingdong.ddingdongBE.domain.club.entity.Club;
44
import java.util.Optional;
5+
import org.springframework.data.jpa.repository.EntityGraph;
56
import org.springframework.data.jpa.repository.JpaRepository;
67
import org.springframework.stereotype.Repository;
78

@@ -10,4 +11,6 @@ public interface ClubRepository extends JpaRepository<Club, Long> {
1011

1112
Optional<Club> findByUserId(Long userId);
1213

14+
@EntityGraph(attributePaths = {"clubMembers"})
15+
Optional<Club> findEntityGraphByUserId(Long userId);
1316
}

src/main/java/ddingdong/ddingdongBE/domain/club/service/ClubService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@ public interface ClubService {
1717

1818
void delete(Long clubId);
1919

20-
21-
20+
Club getByUserIdWithFetch(Long userId);
2221
}

src/main/java/ddingdong/ddingdongBE/domain/club/service/GeneralClubService.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
import ddingdong.ddingdongBE.domain.club.repository.ClubRepository;
66
import java.util.List;
77
import lombok.RequiredArgsConstructor;
8+
import lombok.extern.slf4j.Slf4j;
89
import org.springframework.stereotype.Service;
910
import org.springframework.transaction.annotation.Transactional;
1011

1112
@Service
1213
@Transactional(readOnly = true)
1314
@RequiredArgsConstructor
15+
@Slf4j
1416
public class GeneralClubService implements ClubService {
1517

1618
private final ClubRepository clubRepository;
@@ -34,6 +36,11 @@ public Club getByUserId(Long userId) {
3436
.orElseThrow(() -> new ResourceNotFound("Club(userId=" + userId + ")를 찾을 수 없습니다."));
3537
}
3638

39+
@Override
40+
public Club getByUserIdWithFetch(Long userId) {
41+
return clubRepository.findEntityGraphByUserId(userId)
42+
.orElseThrow(() -> new ResourceNotFound("Club(userId=" + userId + ")를 찾을 수 없습니다.")); }
43+
3744
@Override
3845
public List<Club> findAll() {
3946
return clubRepository.findAll();
@@ -51,5 +58,4 @@ public void delete(Long clubId) {
5158
Club club = getById(clubId);
5259
clubRepository.delete(club);
5360
}
54-
5561
}

src/main/java/ddingdong/ddingdongBE/domain/clubmember/service/FacadeCentralClubMemberServiceImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
import java.util.Set;
1313
import java.util.stream.Collectors;
1414
import lombok.RequiredArgsConstructor;
15+
import lombok.extern.slf4j.Slf4j;
1516
import org.springframework.stereotype.Service;
1617
import org.springframework.transaction.annotation.Transactional;
1718

1819
@Service
1920
@Transactional(readOnly = true)
2021
@RequiredArgsConstructor
22+
@Slf4j
2123
public class FacadeCentralClubMemberServiceImpl implements FacadeCentralClubMemberService {
2224

2325
private final ClubService clubService;
@@ -32,7 +34,7 @@ public byte[] getClubMemberListFile(Long userId) {
3234

3335
@Override
3436
public AllClubMemberInfoQuery getAllMyClubMember(Long userId) {
35-
Club club = clubService.getByUserId(userId);
37+
Club club = clubService.getByUserIdWithFetch(userId);
3638
return AllClubMemberInfoQuery.of(club.getName(), club.getClubMembers());
3739
}
3840

src/main/java/ddingdong/ddingdongBE/domain/feed/repository/FeedRepository.java

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,29 @@
99
public interface FeedRepository extends JpaRepository<Feed, Long> {
1010

1111
@Query(value = """
12-
select *
13-
from feed f
14-
where (:currentCursorId = -1 or id < :currentCursorId)
15-
and f.club_id = :clubId
16-
and deleted_at is null
17-
order by f.id DESC
18-
limit :size
19-
""", nativeQuery = true)
12+
select *
13+
from feed f
14+
where (:currentCursorId = -1 or id < :currentCursorId)
15+
and f.club_id = :clubId
16+
and deleted_at is null
17+
and (
18+
f.feed_type != 'VIDEO'
19+
or exists (
20+
select 1
21+
from (
22+
select id
23+
from file_meta_data
24+
where entity_id = f.id
25+
and domain_type = 'FEED_VIDEO'
26+
) filtered_fm
27+
join vod_processing_job vpj
28+
on filtered_fm.id = vpj.file_meta_data_id
29+
where vpj.convert_job_status = 'COMPLETE'
30+
)
31+
)
32+
order by f.id DESC
33+
limit :size
34+
""", nativeQuery = true)
2035
Slice<Feed> findPageByClubIdOrderById(
2136
@Param("clubId") Long clubId,
2237
@Param("size") int size,
@@ -29,6 +44,21 @@ Slice<Feed> findPageByClubIdOrderById(
2944
(select max(id)
3045
from feed
3146
where deleted_at is null
47+
and (
48+
f.feed_type != 'VIDEO'
49+
or exists (
50+
select 1
51+
from (
52+
select id
53+
from file_meta_data
54+
where entity_id = f.id
55+
and domain_type = 'FEED_VIDEO'
56+
) filtered_fm
57+
join vod_processing_job vpj
58+
on filtered_fm.id = vpj.file_meta_data_id
59+
where vpj.convert_job_status = 'COMPLETE'
60+
)
61+
)
3262
GROUP BY club_id)
3363
and (:currentCursorId = -1 or id < :currentCursorId)
3464
ORDER BY id DESC

src/main/java/ddingdong/ddingdongBE/domain/feed/service/GeneralFeedService.java

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
import ddingdong.ddingdongBE.common.exception.PersistenceException.ResourceNotFound;
44
import ddingdong.ddingdongBE.domain.feed.entity.Feed;
55
import ddingdong.ddingdongBE.domain.feed.repository.FeedRepository;
6-
import ddingdong.ddingdongBE.domain.vodprocessing.entity.VodProcessingJob;
7-
import ddingdong.ddingdongBE.domain.vodprocessing.service.VodProcessingJobService;
86
import java.util.ArrayList;
97
import java.util.List;
108
import java.util.Optional;
11-
import java.util.stream.Collectors;
129
import lombok.RequiredArgsConstructor;
1310
import org.springframework.data.domain.PageRequest;
1411
import org.springframework.data.domain.Slice;
@@ -22,7 +19,6 @@
2219
public class GeneralFeedService implements FeedService {
2320

2421
private final FeedRepository feedRepository;
25-
private final VodProcessingJobService vodProcessingJobService;
2622

2723
@Override
2824
public Slice<Feed> getFeedPageByClubId(Long clubId, int size, Long currentCursorId) {
@@ -61,9 +57,7 @@ public void delete(Feed feed) {
6157
}
6258

6359
private Slice<Feed> buildSlice(Slice<Feed> originalSlice, int size) {
64-
List<Feed> content = new ArrayList<>(originalSlice.getContent()).stream()
65-
.filter(this::isComplete)
66-
.collect(Collectors.toList());
60+
List<Feed> content = new ArrayList<>(originalSlice.getContent());
6761
if (content.isEmpty()) {
6862
return null;
6963
}
@@ -76,16 +70,4 @@ private Slice<Feed> buildSlice(Slice<Feed> originalSlice, int size) {
7670

7771
return new SliceImpl<>(content, PageRequest.of(originalSlice.getNumber(), size), hasNext);
7872
}
79-
80-
private boolean isComplete(Feed feed) {
81-
if (feed.isImage()) {
82-
return true;
83-
}
84-
85-
VodProcessingJob vodProcessingJob = vodProcessingJobService.findByVideoFeedId(feed.getId());
86-
if (vodProcessingJob == null) {
87-
return false;
88-
}
89-
return vodProcessingJob.isCompleted();
90-
}
9173
}

src/main/java/ddingdong/ddingdongBE/domain/scorehistory/controller/dto/response/AdminScoreHistoryListResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public record AdminScoreHistoryListResponse(
2424

2525
public static AdminScoreHistoryListResponse from(AdminClubScoreHistoryListQuery query) {
2626
return new AdminScoreHistoryListResponse(
27-
query.club().getScore().getValue(),
27+
query.clubTotalScore(),
2828
query.scoreHistories().stream()
2929
.map(ScoreHistoryResponse::from)
3030
.toList()

src/main/java/ddingdong/ddingdongBE/domain/scorehistory/controller/dto/response/ClubScoreHistoryListResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public record ClubScoreHistoryListResponse(
2323

2424
public static ClubScoreHistoryListResponse from(ClubScoreHistoryListQuery query) {
2525
return new ClubScoreHistoryListResponse(
26-
query.club().getScore().getValue(),
26+
query.clubTotalScore(),
2727
query.scoreHistories().stream()
2828
.map(ScoreHistoryResponse::from)
2929
.toList()

src/main/java/ddingdong/ddingdongBE/domain/scorehistory/service/FacadeAdminScoreHistoryServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public Long create(CreateScoreHistoryCommand command) {
3434
public AdminClubScoreHistoryListQuery findAllByClubId(Long clubId) {
3535
Club club = clubService.getById(clubId);
3636
List<ScoreHistory> scoreHistories = scoreHistoryService.findAllByClubId(clubId);
37-
return AdminClubScoreHistoryListQuery.of(club, scoreHistories);
37+
return AdminClubScoreHistoryListQuery.of(club.getScore().getValue(), scoreHistories);
3838
}
3939

4040
private BigDecimal roundToThirdPoint(BigDecimal value) {

src/main/java/ddingdong/ddingdongBE/domain/scorehistory/service/FacadeClubScoreHistoryServiceImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import ddingdong.ddingdongBE.domain.club.entity.Club;
44
import ddingdong.ddingdongBE.domain.club.service.ClubService;
55
import ddingdong.ddingdongBE.domain.scorehistory.entity.ScoreHistory;
6-
import ddingdong.ddingdongBE.domain.scorehistory.service.dto.query.AdminClubScoreHistoryListQuery;
76
import ddingdong.ddingdongBE.domain.scorehistory.service.dto.query.ClubScoreHistoryListQuery;
87
import java.util.List;
98
import lombok.RequiredArgsConstructor;
@@ -22,6 +21,6 @@ public class FacadeClubScoreHistoryServiceImpl implements FacadeClubScoreHistory
2221
public ClubScoreHistoryListQuery findMyScoreHistories(Long userId) {
2322
Club club = clubService.getByUserId(userId);
2423
List<ScoreHistory> scoreHistories = scoreHistoryService.findAllByClubId(club.getId());
25-
return ClubScoreHistoryListQuery.of(club, scoreHistories);
24+
return ClubScoreHistoryListQuery.of(club.getScore().getValue(), scoreHistories);
2625
}
2726
}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package ddingdong.ddingdongBE.domain.scorehistory.service.dto.query;
22

3-
import ddingdong.ddingdongBE.domain.club.entity.Club;
43
import ddingdong.ddingdongBE.domain.scorehistory.entity.ScoreHistory;
4+
import java.math.BigDecimal;
55
import java.util.List;
66

77
public record AdminClubScoreHistoryListQuery(
8-
Club club,
8+
BigDecimal clubTotalScore,
99
List<ScoreHistory> scoreHistories
1010
) {
1111

12-
public static AdminClubScoreHistoryListQuery of(Club club, List<ScoreHistory> scoreHistories) {
13-
return new AdminClubScoreHistoryListQuery(club, scoreHistories);
12+
public static AdminClubScoreHistoryListQuery of(BigDecimal clubTotalScore, List<ScoreHistory> scoreHistories) {
13+
return new AdminClubScoreHistoryListQuery(clubTotalScore, scoreHistories);
1414
}
1515
}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package ddingdong.ddingdongBE.domain.scorehistory.service.dto.query;
22

3-
import ddingdong.ddingdongBE.domain.club.entity.Club;
43
import ddingdong.ddingdongBE.domain.scorehistory.entity.ScoreHistory;
4+
import java.math.BigDecimal;
55
import java.util.List;
66

77
public record ClubScoreHistoryListQuery(
8-
Club club,
8+
BigDecimal clubTotalScore,
99
List<ScoreHistory> scoreHistories
1010
) {
1111

12-
public static ClubScoreHistoryListQuery of(Club club, List<ScoreHistory> scoreHistories) {
13-
return new ClubScoreHistoryListQuery(club, scoreHistories);
12+
public static ClubScoreHistoryListQuery of(BigDecimal clubTotalScore, List<ScoreHistory> scoreHistories) {
13+
return new ClubScoreHistoryListQuery(clubTotalScore, scoreHistories);
1414
}
1515
}

src/main/java/ddingdong/ddingdongBE/file/controller/S3FileController.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import ddingdong.ddingdongBE.file.service.dto.command.GeneratePreSignedUrlRequestCommand;
99
import ddingdong.ddingdongBE.file.service.dto.query.GeneratePreSignedUrlRequestQuery;
1010
import java.net.URL;
11+
import java.net.URLDecoder;
12+
import java.nio.charset.StandardCharsets;
1113
import java.time.LocalDateTime;
1214
import lombok.RequiredArgsConstructor;
1315
import org.springframework.web.bind.annotation.RestController;
@@ -22,9 +24,10 @@ public class S3FileController implements S3FileAPi {
2224
public UploadUrlResponse getPreSignedUrl(PrincipalDetails principalDetails, String fileName) {
2325
User user = principalDetails.getUser();
2426
LocalDateTime now = LocalDateTime.now();
27+
String decodedFileName = URLDecoder.decode(fileName, StandardCharsets.UTF_8);
2528
GeneratePreSignedUrlRequestQuery query =
2629
s3FileService.generatePresignedUrlRequest(
27-
new GeneratePreSignedUrlRequestCommand(now, user.getId(), fileName));
30+
new GeneratePreSignedUrlRequestCommand(now, user.getId(), decodedFileName));
2831
URL presingedUrl = s3FileService.getPresignedUrl(query.generatePresignedUrlRequest());
2932
return UploadUrlResponse.of(query, presingedUrl);
3033
}

0 commit comments

Comments
 (0)