Skip to content
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

카테고리 도메인 구현 - 완료 #9

Open
wants to merge 84 commits into
base: make
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
cb56235
*fix: add missing method
horobito Jun 24, 2021
cf6a6fd
*fix: fix typo
horobito Jun 24, 2021
32bf132
*fix: add [@AttributeOverride]
horobito Jun 24, 2021
d3a4ace
*fix: add field and fix method
horobito Jun 24, 2021
0ba0f86
*fix: add method parameter
horobito Jun 24, 2021
59ba748
*fix: add [password] field
horobito Jun 24, 2021
62bf920
*feat: make [Password] class
horobito Jun 24, 2021
c973844
*여기까지가 자잘한 수정내용
horobito Jun 24, 2021
d0d605b
*fix: [category] is separated to [category] and [categorizedFood]. So…
horobito Jun 25, 2021
fc0a1ff
*feat: create [CategorizedFood] class and its field classes
horobito Jun 25, 2021
230fc0f
*fix: change [CategoryController]'s location
horobito Jun 25, 2021
ea4e521
*feat: create [CategorizedFoodRepository] class
horobito Jun 25, 2021
5ccf4b2
*fix: delete useless method
horobito Jun 25, 2021
e0321ad
*fix: change name [FoodId -> MenuId]
horobito Jun 25, 2021
4eee846
*fix: change name [FoodId -> MenuId]
horobito Jun 25, 2021
da91169
*feat: add <addFoodInCategory> method in [CategorizedFoodService] class
horobito Jun 25, 2021
802948c
*feat: overloading <checkExistence> method in [MenuService] class
horobito Jun 25, 2021
304d543
*feat: overloading <checkExistence> method in [CategoryService] class
horobito Jun 25, 2021
9b7ba80
*feat: add <findByCategoryIdAndMenuId> method in [CategorizedFoodServ…
horobito Jun 25, 2021
8508072
*fix: fix method
horobito Jun 25, 2021
f42c413
*feat: add <deleteMenuInCategory> method in [CategoryFoodService] class
horobito Jun 25, 2021
0f7771d
*feat: add field [private boolean deleted]
horobito Jun 25, 2021
64dc47a
*fix: fix method
horobito Jun 25, 2021
78985c4
* fix: fix method's location
horobito Jun 26, 2021
9f38694
* feat: add <getDetailCategoryInfo> method in [CategoryController]
horobito Jun 26, 2021
d4d6db3
fix: fix method parameter
horobito Jun 26, 2021
12b861b
feat: add <getDetailInfo> and other methods essential for this in [Ca…
horobito Jun 26, 2021
7d24956
feat: create [CategoryDetailDto] class
horobito Jun 26, 2021
a81f7d0
fix: change method location
horobito Jun 26, 2021
fa139b0
feat: add <changeTitleAndDescription> method in [CategoryController] …
horobito Jun 26, 2021
34de7f3
feat: add <changeTitleAndDescription> method in [CategoryService] class
horobito Jun 26, 2021
8371741
feat: add <changeTitleAndDescription> method in [Category] class
horobito Jun 26, 2021
a9f73d4
feat: add <getAllDetails> method in [CategoryController] class
horobito Jun 26, 2021
543040f
fix: change ResponseType
horobito Jun 26, 2021
2c8e9fe
feat: create <getAllDetails> method in [CategoryService] class
horobito Jun 26, 2021
17acbf2
fix: change class name
horobito Jun 26, 2021
e99bb14
feat: create methods for <getAllDetails> method in [CategoryService]
horobito Jun 26, 2021
d526ef6
fix: add @Getter annotation
horobito Jun 26, 2021
a5c6050
fix: typo
horobito Jun 26, 2021
2f86761
feat: add methods
horobito Jun 26, 2021
a8b9f1f
feat: add methods
horobito Jun 26, 2021
936b5b9
fix: change <getMenu> method
horobito Jun 26, 2021
988e433
feat: create <findAllByCategoryIdOrderByIdDesc> and <findByCategoryId…
horobito Jun 26, 2021
d60504d
fix: fix typo
horobito Jun 26, 2021
5fb1779
feat: create <convertCategorizedFoodToMenuDto> method and apply this
horobito Jun 26, 2021
1f848a3
fix: fix typo
horobito Jun 26, 2021
d08bafd
test: create [CategoryCreateTest>] class's frame
horobito Jun 26, 2021
7dbd520
test: add Mocks in [CategoryCreateTest] class
horobito Jun 26, 2021
3f57d39
fix: delete useless thing
horobito Jun 26, 2021
977d113
test: create <createCategory test 1. normal condition> method in [Cat…
horobito Jun 26, 2021
06364ba
test: chang sut's location
horobito Jun 26, 2021
0f51cc8
test: create [CategoryDeleteTest] class's frame
horobito Jun 26, 2021
14959f0
test: create [CategoryHelper] class
horobito Jun 26, 2021
0b39901
test: create <delete category 1. normal condition> method in [Categor…
horobito Jun 26, 2021
c856843
test: create <delete category 2. abnormal condition- category not exi…
horobito Jun 26, 2021
463ec87
fix: fix typo
horobito Jun 28, 2021
956b607
feat: create [GetCategoryTest] class's frame
horobito Jun 28, 2021
7463593
test: create <getTest 1. Normal condition > method
horobito Jun 28, 2021
1bd6de7
fix: change <deleteCategory> method in [CategoryService] class
horobito Jun 28, 2021
cfb8654
feat: create field and method about 'delete'
horobito Jun 28, 2021
0ac40d3
fix: add condition in method
horobito Jun 28, 2021
3753cb0
fix: change method location
horobito Jun 28, 2021
c31552d
fix: adjust 'deleted'
horobito Jun 28, 2021
0a73cdf
fix: add code in constructor
horobito Jun 28, 2021
c6d6efd
feat: add <categoryDeleteTest 3. category is already deleted>
horobito Jun 28, 2021
498e8fe
fix: change class's location
horobito Jun 28, 2021
5f2a539
test: create <getTest 2. Abnormal condition- category is already dele…
horobito Jun 28, 2021
ffaa0fd
test: create <getTest 3. Abnormal condition- category is null>
horobito Jun 28, 2021
af5c9c5
feat: create [RandomParametersExtension] class
horobito Jun 30, 2021
e4892e3
fix: just change @Mock location
horobito Jun 30, 2021
dfcaca6
feat: create [CategoryRepositoryTest] class for Integration Test
horobito Jun 30, 2021
98154f5
fix: change method name in [CategoryRepository] class
horobito Jun 30, 2021
0845a31
fix: change method name
horobito Jun 30, 2021
fe9b1f5
fix: change field name [foodId->menuId]
horobito Jun 30, 2021
cb168ab
fix: change method name in [CategorizedFoodRepository]
horobito Jun 30, 2021
aee8d2f
test: create <getCategoryTest_v2 1. normal - cursor is not null>
horobito Jun 30, 2021
6201343
test: create <getCategoryTest_v2 2. normal - cursor is null>
horobito Jun 30, 2021
4dc3d07
feat: add methods in [CategorizedFood] class
horobito Jul 1, 2021
e85e222
feat: create <checkAlreadyDeleted> and <checkExistence> in [Categoriz…
horobito Jul 1, 2021
4df3902
feat: create <getLastIndex> method in [CategoryService]
horobito Jul 1, 2021
c0aa87a
fix: add @Getter in [MenuId]
horobito Jul 1, 2021
ed26477
feat: create <existsByIdLEssThanAndCategoryId> method in [Categorized…
horobito Jul 1, 2021
8e11193
fix: add tests but useless
horobito Jul 1, 2021
f561fcf
fix: add [static] signature
horobito Jul 1, 2021
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

This file was deleted.

71 changes: 0 additions & 71 deletions src/main/java/com/project2/demo/Menu/category/domain/Category.java

This file was deleted.

This file was deleted.

21 changes: 0 additions & 21 deletions src/main/java/com/project2/demo/Menu/category/domain/FoodId.java

This file was deleted.

This file was deleted.

19 changes: 18 additions & 1 deletion src/main/java/com/project2/demo/Menu/menu/domain/Menu.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,29 @@ public class Menu {
private MenuDescription menuDescription;

@Embedded
@AttributeOverrides({
@AttributeOverride(
name = "limited",
column = @Column(name = "limited")),
@AttributeOverride(
name = "startTime",
column = @Column(name = "start_time")),
@AttributeOverride(
name = "endTime",
column = @Column(name = "end_time")
)
})
private Time salesTime;

@Embedded
@Column(name = "amount_of_food_left")
private AmountOfFoodLeft amountOfFoodLeft;

@Embedded
@AttributeOverride(
name = "imageURL",
column = @Column(name = "image_url")
)
private ImageURL imageURL;

@Embedded
Expand Down Expand Up @@ -150,7 +167,7 @@ public String getTitle() {
}

public int getPrice() {
return this.price.getPrioce();
return this.price.getPrice();
}

public String getMenuDescription() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
package com.project2.demo.Menu.menu.domain;

import com.project2.demo.Menu.menu.service.MenuDto;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

public interface MenuRepository extends JpaRepository<Menu, Long> {
Menu findMenuById(Long id);

Menu findMenuByIdAndDeleted(Long id, boolean deleted);

Menu findMenuByTitle(Title title);

List<Menu> findAllByOrderByIdDesc(Pageable page);

List<Menu> findByIdLessThanOrderByIdDesc(Long cursor, Pageable page);

boolean existsByIdLessThan(Long cursor);
}
6 changes: 3 additions & 3 deletions src/main/java/com/project2/demo/Menu/menu/domain/Price.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
@NoArgsConstructor
public class Price {

private int prioce ;
private int price ;

private Price(int prioce) {
this.prioce = prioce;
private Price(int price) {
this.price = price;
}

public static Price create(int price){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ public void checkExistence(Menu menu) {
}


public void checkExistence(Long menuId) {
if (menuRepository.findMenuById(menuId)==null){
throw new IllegalArgumentException();
}
}

public Menu getMenu(Time time, MenuParameter menuParameter) {
return Menu.create(
Title.create(menuParameter.getTitle()),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.project2.demo.category.categorizedFood.domain;


import lombok.Getter;
import lombok.NoArgsConstructor;

import javax.persistence.*;

@Entity
@NoArgsConstructor
public class CategorizedFood {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Embedded
private CategoryId categoryId;

@Embedded
private MenuId menuId;

private boolean deleted;


private CategorizedFood(CategoryId categoryId, MenuId menuId) {
this.categoryId = categoryId;
this.menuId = menuId;
this.deleted = false;
}

public static CategorizedFood create(CategoryId categoryId, MenuId menuId){
return new CategorizedFood(categoryId, menuId);
}

public Long getCategoryId(){
return this.categoryId.getCategoryId();
}

public void delete(){
this.deleted = true;
}

public boolean checkDeleted() {
return this.deleted;
}

public Long getMenuId() {
return this.menuId.getMenuId();
}
}
Loading