| 구성 요소 | 설명 |
|---|---|
| 1. Recipe | - 하나의 레시피는 여러 개의 RecipeIngredient를 가짐- @OneToMany(mappedBy = "recipe") |
| 2. Ingredient | - 하나의 재료는 여러 개의 RecipeIngredient에 포함될 수 있음- @OneToMany(mappedBy = "ingredient") |
| 3. RecipeIngredient | - 중간 테이블(Entity) 역할 - @ManyToOne 으로 Recipe, Ingredient 각각 참조- 추가 필드: quantity |
| 4. RecipeIngredientId | - 복합키 클래스 - @Embeddable 로 선언- 식별자 역할: recipeId, ingredientId |
📦recipe_platform
┣ 📂controller
┃ ┣ 📜IngredientController.java
┃ ┗ 📜RecipeController.java
┣ 📂dto
┃ ┣ 📜AddIngredientToRecipeDto.java
┃ ┣ 📜IngredientDto.java
┃ ┣ 📜IngredientResponseDto.java
┃ ┣ 📜RecipeDetailDto.java
┃ ┣ 📜RecipeDto.java
┃ ┣ 📜RecipeIngredientDto.java
┃ ┗ 📜RecipeResponseDto.java
┣ 📂model
┃ ┣ 📜Ingredient.java
┃ ┣ 📜Recipe.java
┃ ┣ 📜RecipeIngredient.java
┃ ┗ 📜RecipeIngredientId.java
┣ 📂repository
┃ ┣ 📜IngredientRepository.java
┃ ┣ 📜RecipeIngredientRepository.java
┃ ┗ 📜RecipeRepository.java
┣ 📂service
┃ ┣ 📜IngredientService.java
┃ ┗ 📜RecipeService.java
┗ 📜RecipePlatformApplication.java
✅ 레시피 관련 기능 (/api/recipes)
| HTTP | URI | 기능 |
|---|---|---|
GET | /api/recipes | 레시피 목록 조회 (페이지네이션) |
GET | /api/recipes/{id} | 특정 레시피 상세 조회 |
POST | /api/recipes | 레시피 등록 |
PUT | /api/recipes/{id} | 레시피 수정 |
DELETE | /api/recipes/{id} | 레시피 삭제 |
POST | /api/recipes/{id}/ingredients/add | 레시피에 재료 추가 |
DELETE | /api/recipes/{id}/ingredients/{ingredientId} | 레시피에서 특정 재료 제거 |
✅ 재료 관련 기능 (/api/ingredients)
| HTTP | URI | 기능 |
|---|---|---|
GET | /api/ingredients | 재료 목록 조회 (페이지네이션) |
GET | /api/ingredients/{id} | 특정 재료 조회 |
POST | /api/ingredients | 재료 등록 |
PUT | /api/ingredients/{id} | 재료 수정 |
DELETE | /api/ingredients/{id} | 재료 삭제 |