Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class IngredientCategory {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ingredient_category_pk")
private int IngredientCategoryPk;
private int ingredientCategoryPk;

@Column(name = "ingredient_category")
private String IngredientCategory;
private String ingredientCategory;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class IngredientStorage {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ingredient_storage_pk")
private int IngredientStoragePk;
private int ingredientStoragePk;

@Column(name = "ingredient_storage")
private String IngredientStorage;
private String ingredientStorage;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package moja.refrigerator.aggregate.recipe;

import jakarta.persistence.*;
import lombok.Data;
import moja.refrigerator.aggregate.user.User;

@Data
@Entity
@Table(name = "tbl_comment")
public class Comment {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "comment_pk")
private long commentPk ;

@Column(name = "comment_create_time")
private String commentCreateTime ;
@Column(name = "comment_update_time")
private String commentUpdateTime ;
@Column(name = "comment_contents")
private String commentContents ;

@JoinColumn(name = "user")
@ManyToOne
private User user ;

@JoinColumn(name = "recipe")
@ManyToOne
private Recipe recipe ;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package moja.refrigerator.aggregate.recipe;

import jakarta.persistence.*;
import lombok.Data;
import moja.refrigerator.aggregate.user.User;

@Data
@Entity
@Table(name = "tbl_recipe")
public class Recipe {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "recipe_pk")
private long recipePk;

@Column(name = "recipe_name")
private String recipeName;

@Column(name = "recipe_cooking_time")
private int recipeCookingTime;

@Column(name = "recipe_create_time")
private String recipeCreateTime;

@Column(name = "recipe_update_time")
private String recipeUpdateTime;

@Column(name = "recipe_difficulty")
private int recipeDifficulty;

@Column(name = "recipe_views")
private long recipeViews;

@JoinColumn(name = "user")
@ManyToOne
private User user;

@JoinColumn(name = "cooking_source")
@ManyToOne
private RecipeSource recipeSource;

@JoinColumn(name = "recipe_category")
@ManyToOne
private RecipeCategory recipeCategory;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package moja.refrigerator.aggregate.recipe;

import jakarta.persistence.*;
import lombok.Data;

@Data
@Entity
@Table(name="tbl_recipe_category")
public class RecipeCategory {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "recipe_category_pk")
private int recipeCategoryPK;

@Column(name = "recipe_category")
private String recipeCategory;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package moja.refrigerator.aggregate.recipe;

import jakarta.persistence.*;
import lombok.Data;
import moja.refrigerator.aggregate.ingredient.IngredientManagement;

@Data
@Entity
@Table(name = "tbl_recipe_ingredient")
public class RecipeIngredient {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "recipe_ingredient_pk")
private long recipeIngredientPk ;

@Column(name = "ingredient_is_necessary")
private boolean ingredientIsNecessary ;

@JoinColumn(name = "ingredient_management")
@ManyToOne
private IngredientManagement ingredientManagement;

@JoinColumn(name = "recipe")
@ManyToOne
private Recipe recipe;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package moja.refrigerator.aggregate.recipe;


import jakarta.persistence.*;
import lombok.Data;
import moja.refrigerator.aggregate.user.User;

@Data
@Entity
@Table(name="tbl_recipe_like")
public class RecipeLike {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "like_pk")
private long likePk;

@JoinColumn(name = "user")
@ManyToOne
private User user;

@JoinColumn(name = "recipe")
@ManyToOne
private Recipe recipe;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package moja.refrigerator.aggregate.recipe;


import jakarta.persistence.*;
import lombok.Data;

@Data
@Entity
@Table(name="tbl_recipe_source")
public class RecipeSource {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "cooking_source_pk")
private long cookingSourcePk;

@Column(name = "cooking_source_save")
private String cookingSourceSave;

@Column(name = "cooking_source_create_time")
private String cookingSourceCreateTime;

@Column(name = "cooking_source_file_name")
private String cookingSourceFileName;

@JoinColumn(name = "cooking_source_type")
@OneToOne
private RecipeSourceType cookingSourceType;

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package moja.refrigerator.aggregate.recipe;


import jakarta.persistence.*;
import lombok.Data;

@Table(name = "tbl_recipe_source_type")
@Entity
@Data
public class RecipeSourceType {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "cooking_source_type_pk")
private int cookingSourceTypePk;

@Column(name = "cooking_source_type",length = 50)
private String cookingSourceType;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package moja.refrigerator.aggregate.recipe;

import jakarta.persistence.*;
import lombok.Data;
import moja.refrigerator.aggregate.ingredient.IngredientManagement;

@Data
@Entity
@Table(name = "tbl_replacable_ingredient")
public class ReplacableIngredient {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "replaceable_ingredient_pk")
private long replaceableIngredientPk ;

@JoinColumn(name = "ingredient_management")
@ManyToOne
private IngredientManagement ingredientManagement;

@JoinColumn(name = "recipe_ingredient")
@ManyToOne
private RecipeIngredient recipeIngredient ;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package moja.refrigerator.controller.recipe;

import moja.refrigerator.service.recipe.RecipeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/recipe")
public class RecipeController {
private RecipeService recipeService;

@Autowired
public RecipeController(RecipeService recipeService) {
this.recipeService = recipeService;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package moja.refrigerator.repository.recipe;

import moja.refrigerator.aggregate.recipe.Recipe;
import org.springframework.data.jpa.repository.JpaRepository;

public interface RecipeRepository extends JpaRepository<Recipe, Long> {
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package moja.refrigerator.service.recipe;

public interface RecipeService {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package moja.refrigerator.service.recipe;


import moja.refrigerator.repository.recipe.RecipeRepository;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RecipeServiceImpl implements RecipeService {

private RecipeRepository recipeRepository;
private ModelMapper mapper;

@Autowired
public RecipeServiceImpl(RecipeRepository recipeRepository, ModelMapper mapper) {
this.recipeRepository = recipeRepository;
this.mapper = mapper;
}
}