-
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 pull request #33 from Central-MakeUs/fix/popcornGet
[fix]팝콘 추천작 반환
- Loading branch information
Showing
4 changed files
with
74 additions
and
8 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
41 changes: 41 additions & 0 deletions
41
Api/src/main/java/com/example/api/Popcorn/dto/response/PopcornDetailResponse.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,41 @@ | ||
package com.example.api.Popcorn.dto.response; | ||
|
||
import com.example.domains.popcorn.entity.Popcorn; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class PopcornDetailResponse { | ||
@Schema(defaultValue = "1", description = "합콘아이디") | ||
private long popcornId; | ||
@Schema(defaultValue = "괴물", description = "영화제목") | ||
private String movieTitle; | ||
|
||
@Schema(defaultValue = "고레에다 히로카즈", description = "영화김독") | ||
private String directorName; | ||
@Schema(defaultValue = "gfhffgvgvghdfhdchj.jpg", description = "영화포스터 이미지") | ||
private String imageUrl; | ||
|
||
@Schema(defaultValue = "agsdfgsdgfsdfgdf", description = "영화 상세 보기") | ||
private String detail; | ||
|
||
@Builder | ||
public PopcornDetailResponse (Long popcornId,String movieTitle,String directorName,String imageUrl,String detail){ | ||
this.popcornId = popcornId; | ||
this.movieTitle=movieTitle; | ||
this.directorName=directorName; | ||
this.imageUrl = imageUrl; | ||
this.detail=detail; | ||
} | ||
public static PopcornDetailResponse from(Popcorn popcorn){ | ||
return PopcornDetailResponse.builder() | ||
.popcornId(popcorn.getId()) | ||
.movieTitle(popcorn.getMovieTitle()) | ||
.directorName(popcorn.getDirectorName()) | ||
.imageUrl(popcorn.getImageUrl()) | ||
.detail(popcorn.getMovieDetail()) | ||
.build(); | ||
|
||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Api/src/main/java/com/example/api/Popcorn/service/GetPopcornDetailUseCase.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,18 @@ | ||
package com.example.api.Popcorn.service; | ||
|
||
import com.example.adaptor.UseCase; | ||
import com.example.api.Popcorn.dto.response.PopcornDetailResponse; | ||
import com.example.api.Popcorn.dto.response.PopcornResponse; | ||
import com.example.domains.popcorn.adaptor.PopcornAdaptor; | ||
import com.example.domains.popcorn.entity.Popcorn; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@UseCase | ||
@RequiredArgsConstructor | ||
public class GetPopcornDetailUseCase { | ||
private final PopcornAdaptor popcornAdaptor; | ||
public PopcornDetailResponse execute(Long id) { | ||
Popcorn popcorn = popcornAdaptor.findById(id); | ||
return PopcornDetailResponse.from(popcorn); | ||
} | ||
} |
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