-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/BSVR-225
- Loading branch information
Showing
16 changed files
with
232 additions
and
10 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...ain/java/org/depromeet/spot/application/stadium/dto/response/StadiumBlockTagResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.depromeet.spot.application.stadium.dto.response; | ||
|
||
import java.util.List; | ||
|
||
import org.depromeet.spot.usecase.port.in.stadium.StadiumReadUsecase.StadiumBlockTagInfo; | ||
|
||
public record StadiumBlockTagResponse( | ||
long id, String name, List<String> blockCodes, String description) { | ||
public static StadiumBlockTagResponse from(StadiumBlockTagInfo info) { | ||
return new StadiumBlockTagResponse( | ||
info.getId(), info.getName(), info.getBlockCodes(), info.getDescription()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
.../java/org/depromeet/spot/application/stadium/dto/response/StadiumSectionInfoResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.depromeet.spot.application.stadium.dto.response; | ||
|
||
import org.depromeet.spot.usecase.port.in.stadium.StadiumReadUsecase.StadiumSectionInfo; | ||
|
||
public record StadiumSectionInfoResponse(long id, String name, String alias) { | ||
public static StadiumSectionInfoResponse from(StadiumSectionInfo info) { | ||
return new StadiumSectionInfoResponse(info.getId(), info.getName(), info.getAlias()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
.../org/depromeet/spot/infrastructure/jpa/block/repository/tag/BlockTagCustomRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.depromeet.spot.infrastructure.jpa.block.repository.tag; | ||
|
||
import static org.depromeet.spot.infrastructure.jpa.block.entity.QBlockEntity.blockEntity; | ||
import static org.depromeet.spot.infrastructure.jpa.block.entity.QBlockTagEntity.blockTagEntity; | ||
import static org.depromeet.spot.infrastructure.jpa.hashtag.entity.QHashTagEntity.hashTagEntity; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
import org.depromeet.spot.infrastructure.jpa.block.entity.BlockEntity; | ||
import org.depromeet.spot.infrastructure.jpa.block.entity.BlockTagEntity; | ||
import org.depromeet.spot.infrastructure.jpa.hashtag.entity.HashTagEntity; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class BlockTagCustomRepository { | ||
|
||
private final JPAQueryFactory queryFactory; | ||
|
||
public Map<HashTagEntity, List<BlockEntity>> findAllByStadium(Long stadiumId) { | ||
List<BlockTagEntity> blockTagEntities = | ||
queryFactory | ||
.selectFrom(blockTagEntity) | ||
.join(blockTagEntity.block, blockEntity) | ||
.fetchJoin() | ||
.join(blockTagEntity.hashTag, hashTagEntity) | ||
.fetchJoin() | ||
.where(blockEntity.stadiumId.eq(stadiumId)) | ||
.fetch(); | ||
|
||
return blockTagEntities.stream() | ||
.collect( | ||
Collectors.groupingBy( | ||
BlockTagEntity::getHashTag, | ||
Collectors.mapping(BlockTagEntity::getBlock, Collectors.toList()))); | ||
} | ||
} |
6 changes: 0 additions & 6 deletions
6
...ava/org/depromeet/spot/infrastructure/jpa/block/repository/tag/BlockTagJpaRepository.java
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
...va/org/depromeet/spot/infrastructure/jpa/block/repository/tag/BlockTagRepositoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.depromeet.spot.infrastructure.jpa.block.repository.tag; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
import org.depromeet.spot.domain.block.Block; | ||
import org.depromeet.spot.domain.hashtag.HashTag; | ||
import org.depromeet.spot.infrastructure.jpa.block.entity.BlockEntity; | ||
import org.depromeet.spot.infrastructure.jpa.hashtag.entity.HashTagEntity; | ||
import org.depromeet.spot.usecase.port.out.block.BlockTagRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class BlockTagRepositoryImpl implements BlockTagRepository { | ||
|
||
private final BlockTagCustomRepository blockTagCustomRepository; | ||
|
||
@Override | ||
public Map<HashTag, List<Block>> findAllByStadium(Long stadiumId) { | ||
Map<HashTagEntity, List<BlockEntity>> entities = | ||
blockTagCustomRepository.findAllByStadium(stadiumId); | ||
return entities.entrySet().stream() | ||
.collect( | ||
Collectors.toMap( | ||
entry -> entry.getKey().toDomain(), | ||
entry -> | ||
entry.getValue().stream() | ||
.map(BlockEntity::toDomain) | ||
.toList())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
usecase/src/main/java/org/depromeet/spot/usecase/port/in/block/ReadBlockTagUsecase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.depromeet.spot.usecase.port.in.block; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.depromeet.spot.domain.block.Block; | ||
import org.depromeet.spot.domain.hashtag.HashTag; | ||
|
||
public interface ReadBlockTagUsecase { | ||
|
||
Map<HashTag, List<Block>> findAllByStadium(Long stadiumId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
usecase/src/main/java/org/depromeet/spot/usecase/port/out/block/BlockTagRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.depromeet.spot.usecase.port.out.block; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.depromeet.spot.domain.block.Block; | ||
import org.depromeet.spot.domain.hashtag.HashTag; | ||
|
||
public interface BlockTagRepository { | ||
|
||
Map<HashTag, List<Block>> findAllByStadium(Long stadiumId); | ||
} |
26 changes: 26 additions & 0 deletions
26
usecase/src/main/java/org/depromeet/spot/usecase/service/block/ReadBlockTagService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.depromeet.spot.usecase.service.block; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.depromeet.spot.domain.block.Block; | ||
import org.depromeet.spot.domain.hashtag.HashTag; | ||
import org.depromeet.spot.usecase.port.in.block.ReadBlockTagUsecase; | ||
import org.depromeet.spot.usecase.port.out.block.BlockTagRepository; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional(readOnly = true) | ||
public class ReadBlockTagService implements ReadBlockTagUsecase { | ||
|
||
private final BlockTagRepository blockTagRepository; | ||
|
||
@Override | ||
public Map<HashTag, List<Block>> findAllByStadium(final Long stadiumId) { | ||
return blockTagRepository.findAllByStadium(stadiumId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters