-
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
60 additions
and
52 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
22 changes: 22 additions & 0 deletions
22
backend/src/main/java/net/pengcook/recipe/dto/RecipeHomeResponse.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,22 @@ | ||
package net.pengcook.recipe.dto; | ||
|
||
import java.time.LocalDateTime; | ||
import net.pengcook.user.domain.AuthorAble; | ||
|
||
public record RecipeHomeResponse( | ||
long recipeId, | ||
String title, | ||
long authorId, | ||
String authorName, | ||
String authorImage, | ||
String thumbnail, | ||
int likeCount, | ||
int commentCount, | ||
LocalDateTime createdAt | ||
) implements AuthorAble { | ||
|
||
@Override | ||
public long getAuthorId() { | ||
return authorId; | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
import net.pengcook.authentication.domain.UserInfo; | ||
import net.pengcook.ingredient.domain.Requirement; | ||
import net.pengcook.ingredient.dto.IngredientCreateRequest; | ||
import net.pengcook.recipe.dto.MainRecipeResponse; | ||
import net.pengcook.recipe.dto.RecipeHomeWithMineResponse; | ||
import net.pengcook.recipe.dto.PageRecipeRequest; | ||
import net.pengcook.recipe.dto.RecipeRequest; | ||
import net.pengcook.recipe.dto.RecipeResponse; | ||
|
@@ -41,21 +41,21 @@ class RecipeServiceTest { | |
void readRecipes(int pageNumber, int pageSize, int expectedFirstRecipeId) { | ||
UserInfo userInfo = new UserInfo(1L, "[email protected]"); | ||
PageRecipeRequest pageRecipeRequest = new PageRecipeRequest(pageNumber, pageSize, null, null, null); | ||
List<MainRecipeResponse> mainRecipeResponses = recipeService.readRecipes(userInfo, pageRecipeRequest); | ||
List<RecipeHomeWithMineResponse> recipeHomeWithMineResponses = recipeService.readRecipes(userInfo, pageRecipeRequest); | ||
|
||
assertThat(mainRecipeResponses.getFirst().recipeId()).isEqualTo(expectedFirstRecipeId); | ||
assertThat(recipeHomeWithMineResponses.getFirst().recipeId()).isEqualTo(expectedFirstRecipeId); | ||
} | ||
|
||
@Test | ||
@DisplayName("๋ ์ํผ ๊ฐ์ ์กฐํ ์ ์กฐํ์๊ฐ ์์ฑํ ๊ธ์ธ์ง ์ฌ๋ถ๋ฅผ ํจ๊ป ์๋ตํ๋ค.") | ||
void readRecipesWithUserInfo() { | ||
UserInfo userInfo = new UserInfo(1L, "[email protected]"); | ||
PageRecipeRequest pageRecipeRequest = new PageRecipeRequest(0, 2, null, null, null); | ||
List<MainRecipeResponse> mainRecipeResponses = recipeService.readRecipes(userInfo, pageRecipeRequest); | ||
List<RecipeHomeWithMineResponse> recipeHomeWithMineResponses = recipeService.readRecipes(userInfo, pageRecipeRequest); | ||
|
||
assertAll( | ||
() -> assertThat(mainRecipeResponses.getFirst().mine()).isFalse(), | ||
() -> assertThat(mainRecipeResponses.getLast().mine()).isTrue() | ||
() -> assertThat(recipeHomeWithMineResponses.getFirst().mine()).isFalse(), | ||
() -> assertThat(recipeHomeWithMineResponses.getLast().mine()).isTrue() | ||
); | ||
} | ||
|
||
|
@@ -77,7 +77,7 @@ void readRecipesWhenPageOffsetIsGreaterThanIntMaxValue() { | |
void readLikeRecipes() { | ||
UserInfo userInfo = new UserInfo(1L, "[email protected]"); | ||
|
||
List<MainRecipeResponse> actual = recipeService.readLikeRecipes(userInfo); | ||
List<RecipeHomeWithMineResponse> actual = recipeService.readLikeRecipes(userInfo); | ||
|
||
assertAll( | ||
() -> assertThat(actual.size()).isOne(), | ||
|