-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ implement recipe steps retrieval #83
Changes from all commits
ca83d94
5afd1d2
71318c6
bdd8a51
f8553a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package net.pengcook.recipe.domain; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Getter | ||
public class RecipeStep { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "recipe_id") | ||
private Recipe recipe; | ||
|
||
private String image; | ||
|
||
private String description; | ||
|
||
private int sequence; | ||
|
||
public long recipeId() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. getRecipeId() 는 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 좋네요! 레벨2에서 slot_startAt 이런식으로 쓴적있는데 그때 알려주시지.. 왜 지금 알려주시죠 |
||
return recipe.getId(); | ||
} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package net.pengcook.recipe.dto; | ||
|
||
import net.pengcook.recipe.domain.RecipeStep; | ||
|
||
public record RecipeStepResponse(long id, long recipeId, String image, String description, int sequence) { | ||
|
||
public RecipeStepResponse(RecipeStep recipeStep) { | ||
this( | ||
recipeStep.getId(), | ||
recipeStep.recipeId(), | ||
recipeStep.getImage(), | ||
recipeStep.getDescription(), | ||
recipeStep.getSequence() | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package net.pengcook.recipe.repository; | ||
|
||
import java.util.List; | ||
import net.pengcook.recipe.domain.RecipeStep; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface RecipeStepRepository extends JpaRepository<RecipeStep, Long> { | ||
|
||
List<RecipeStep> findAllByRecipeIdOrderBySequence(long id); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시
MainRecipeRequest
를 살리고 싶으시면@ModelAttribute
를 고려해봐도 좋을것 같아요!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ModelAttribute를 사용하면 param을 모두 기재할 필요없이 하나의 객체처럼 받아올 수도 있네요 👍🏻
상황에 따라 적용하는것도 고려해봐야겠어요.