-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
81 additions
and
63 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
15 changes: 13 additions & 2 deletions
15
src/main/java/com/sparta/binplay/dto/request/VideoAdRequestDto.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 |
---|---|---|
@@ -1,11 +1,22 @@ | ||
package com.sparta.binplay.dto.request; | ||
|
||
import com.sparta.binplay.entity.AdViews; | ||
import com.sparta.binplay.entity.Ads; | ||
import com.sparta.binplay.entity.Videos; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class VideoAdRequestDto { | ||
private long viewCount; | ||
private boolean statIs; | ||
private Videos video; | ||
private AdViews adViews; | ||
private Ads ad; | ||
|
||
@Builder | ||
public VideoAdRequestDto(Ads ad, int viewCount, Videos video, boolean statIs) { | ||
this.ad = ad; | ||
this.viewCount = viewCount; | ||
this.video = video; | ||
this.statIs = statIs; | ||
} | ||
} |
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
17 changes: 2 additions & 15 deletions
17
src/main/java/com/sparta/binplay/service/VideoAdService.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 |
---|---|---|
@@ -1,26 +1,13 @@ | ||
package com.sparta.binplay.service; | ||
|
||
import com.sparta.binplay.dto.response.VideoAdResponseDto; | ||
import com.sparta.binplay.entity.VideoAd; | ||
import com.sparta.binplay.repository.AdRepository; | ||
import com.sparta.binplay.repository.AdViewRepository; | ||
import com.sparta.binplay.repository.VideoAdRepository; | ||
import com.sparta.binplay.repository.VideoRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class VideoAdService { | ||
private final VideoAdRepository videoAdRepository; | ||
private final VideoRepository videoRepository; | ||
private final AdRepository adRepository; | ||
|
||
// 특정 광고 재생 횟수 업데이트 | ||
public VideoAdResponseDto updateAdCount(Long videoAdId) { | ||
VideoAd videoAd = videoAdRepository.findById(videoAdId).orElseThrow(() -> new RuntimeException("영상을 찾을 수 없습니다.")); | ||
|
||
videoAdRepository.save(videoAd); | ||
|
||
return VideoAdResponseDto.from(videoAd); | ||
} | ||
private final AdViewRepository adViewRepository; | ||
} |
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