-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…go-api [Feat] 배너 업로드 Admin페이지 구현
- Loading branch information
Showing
41 changed files
with
394 additions
and
99 deletions.
There are no files selected for viewing
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
34 changes: 0 additions & 34 deletions
34
src/main/java/team7/inplace/admin/application/BannerService.java
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
src/main/java/team7/inplace/admin/banner/application/BannerService.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 team7.inplace.admin.banner.application; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import team7.inplace.admin.banner.application.command.BannerCommand.Create; | ||
import team7.inplace.admin.banner.application.dto.BannerInfo; | ||
import team7.inplace.admin.banner.application.dto.BannerInfo.Detail; | ||
import team7.inplace.admin.banner.persistence.BannerRepository; | ||
import team7.inplace.admin.banner.persistence.BannerS3Repository; | ||
import team7.inplace.global.exception.InplaceException; | ||
import team7.inplace.global.exception.code.BannerErrorCode; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class BannerService { | ||
private final BannerS3Repository bannerS3Repository; | ||
private final BannerRepository bannerRepository; | ||
|
||
public void uploadBanner(Create command) { | ||
var imgPath = bannerS3Repository.uploadBanner(command.imageFile()); | ||
var banner = command.toEntity(imgPath); | ||
bannerRepository.save(banner); | ||
} | ||
|
||
public List<Detail> getBanners() { | ||
var now = LocalDateTime.now(); | ||
var banners = bannerRepository.findActiveBanner(now); | ||
|
||
return banners.stream() | ||
.sorted((a, b) -> Boolean.compare(b.getIsFixed(), a.getIsFixed())) | ||
.map(BannerInfo.Detail::from) | ||
.toList(); | ||
} | ||
|
||
public void deleteBanner(Long id) { | ||
var banner = bannerRepository.findById(id) | ||
.orElseThrow(() -> InplaceException.of(BannerErrorCode.NOT_FOUND)); | ||
bannerS3Repository.deleteBanner(banner.getImgPath()); | ||
bannerRepository.delete(banner); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...in/application/command/BannerCommand.java → ...er/application/command/BannerCommand.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
4 changes: 2 additions & 2 deletions
4
...ace/admin/application/dto/BannerInfo.java → ...in/banner/application/dto/BannerInfo.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
2 changes: 1 addition & 1 deletion
2
...va/team7/inplace/admin/domain/Banner.java → ...7/inplace/admin/banner/domain/Banner.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
4 changes: 2 additions & 2 deletions
4
...e/admin/persistence/BannerRepository.java → .../banner/persistence/BannerRepository.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
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
4 changes: 2 additions & 2 deletions
4
...ace/admin/presentation/BannerRequest.java → ...in/banner/presentation/BannerRequest.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
4 changes: 2 additions & 2 deletions
4
...ce/admin/presentation/BannerResponse.java → ...n/banner/presentation/BannerResponse.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
2 changes: 1 addition & 1 deletion
2
...va/team7/inplace/cicd/TestController.java → ...m7/inplace/admin/cicd/TestController.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
2 changes: 1 addition & 1 deletion
2
...ace/crawling/application/AddressUtil.java → ...min/crawling/application/AddressUtil.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
4 changes: 2 additions & 2 deletions
4
.../crawling/application/CrawlingFacade.java → .../crawling/application/CrawlingFacade.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
6 changes: 3 additions & 3 deletions
6
...ing/application/KakaoCrawlingService.java → ...ing/application/KakaoCrawlingService.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
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
10 changes: 5 additions & 5 deletions
10
...g/application/YoutubeCrawlingService.java → ...g/application/YoutubeCrawlingService.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
9 changes: 4 additions & 5 deletions
9
...rawling/application/dto/CrawlingInfo.java → ...rawling/application/dto/CrawlingInfo.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
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
2 changes: 1 addition & 1 deletion
2
...nplace/crawling/client/YoutubeClient.java → .../admin/crawling/client/YoutubeClient.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
2 changes: 1 addition & 1 deletion
2
...nplace/crawling/client/dto/PlaceNode.java → .../admin/crawling/client/dto/PlaceNode.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
2 changes: 1 addition & 1 deletion
2
.../inplace/crawling/domain/ChannelType.java → ...ce/admin/crawling/domain/ChannelType.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
2 changes: 1 addition & 1 deletion
2
...place/crawling/domain/YoutubeChannel.java → ...admin/crawling/domain/YoutubeChannel.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
4 changes: 2 additions & 2 deletions
4
...persistence/YoutubeChannelRepository.java → ...persistence/YoutubeChannelRepository.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
Oops, something went wrong.