-
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.
* [feat] get menu list of store * [refactor] change to primitive type * [refactor] add '/' * [refactor] transfer logic to dto * [refactor] add path variable validation * [refactor] add exception * [refactor] change store delete query * [refactor] divide method * [refactor] change method name * [refactor] put data in deletedMenu Repository * [refactor] delete unused method * [refactor] change variable name * [fix] save deleted menu when menu deleted
- Loading branch information
Showing
12 changed files
with
170 additions
and
23 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
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
17 changes: 17 additions & 0 deletions
17
src/main/java/org/hankki/hankkiserver/api/menu/service/DeletedMenuUpdater.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,17 @@ | ||
package org.hankki.hankkiserver.api.menu.service; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.hankki.hankkiserver.domain.menu.model.DeletedMenu; | ||
import org.hankki.hankkiserver.domain.menu.repository.DeletedMenuRepository; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class DeletedMenuUpdater { | ||
|
||
private final DeletedMenuRepository deletedMenuRepository; | ||
|
||
public void save(final DeletedMenu deletedMenu) { | ||
deletedMenuRepository.save(deletedMenu); | ||
} | ||
} |
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
13 changes: 13 additions & 0 deletions
13
src/main/java/org/hankki/hankkiserver/api/menu/service/response/MenuGetResponse.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,13 @@ | ||
package org.hankki.hankkiserver.api.menu.service.response; | ||
|
||
import org.hankki.hankkiserver.domain.menu.model.Menu; | ||
|
||
public record MenuGetResponse ( | ||
long id, | ||
int price, | ||
String name | ||
){ | ||
public static MenuGetResponse of(final Menu menu) { | ||
return new MenuGetResponse(menu.getId(), menu.getPrice(), menu.getName()); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/org/hankki/hankkiserver/api/menu/service/response/MenusGetResponse.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,15 @@ | ||
package org.hankki.hankkiserver.api.menu.service.response; | ||
|
||
import java.util.List; | ||
import org.hankki.hankkiserver.domain.menu.model.Menu; | ||
|
||
public record MenusGetResponse( | ||
List<MenuGetResponse> menus | ||
) { | ||
public static MenusGetResponse of(final List<Menu> menus) { | ||
List<MenuGetResponse> findmenus = menus.stream() | ||
.map(MenuGetResponse::of) | ||
.toList(); | ||
return new MenusGetResponse(findmenus); | ||
} | ||
} |
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
49 changes: 49 additions & 0 deletions
49
src/main/java/org/hankki/hankkiserver/domain/menu/model/DeletedMenu.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,49 @@ | ||
package org.hankki.hankkiserver.domain.menu.model; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.hankki.hankkiserver.domain.common.BaseCreatedAtEntity; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Table(name = "deleted_menu") | ||
public class DeletedMenu extends BaseCreatedAtEntity { | ||
|
||
@Id | ||
@Column(name = "deleted_menu_id") | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(name = "name", nullable = false) | ||
private String name; | ||
|
||
@Column(name = "price", nullable = false) | ||
private int price; | ||
|
||
@Column(name = "store_id", nullable = false) | ||
private Long storeId; | ||
|
||
@Builder | ||
private DeletedMenu(final String name, final int price, final Long storeId) { | ||
this.name = name; | ||
this.price = price; | ||
this.storeId = storeId; | ||
} | ||
|
||
public static DeletedMenu create(final String name, final int price, final Long storeId) { | ||
return DeletedMenu.builder() | ||
.name(name) | ||
.price(price) | ||
.storeId(storeId) | ||
.build(); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/org/hankki/hankkiserver/domain/menu/repository/DeletedMenuRepository.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,7 @@ | ||
package org.hankki.hankkiserver.domain.menu.repository; | ||
|
||
import org.hankki.hankkiserver.domain.menu.model.DeletedMenu; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface DeletedMenuRepository extends JpaRepository<DeletedMenu, Long> { | ||
} |
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