chore: update
This commit is contained in:
+14
-12
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -20,11 +20,9 @@
|
||||
<compiler-plugin.version>3.15.0</compiler-plugin.version>
|
||||
<maven.compiler.release>25</maven.compiler.release>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding
|
||||
>UTF-8</project.reporting.outputEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
|
||||
<quarkus.platform.group-id
|
||||
>io.quarkus.platform</quarkus.platform.group-id>
|
||||
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
|
||||
<quarkus.platform.version>3.32.4</quarkus.platform.version>
|
||||
<skipITs>true</skipITs>
|
||||
<surefire-plugin.version>3.5.4</surefire-plugin.version>
|
||||
@@ -53,6 +51,12 @@
|
||||
<artifactId>quarkus-security</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.datafaker</groupId>
|
||||
<artifactId>datafaker</artifactId>
|
||||
@@ -143,8 +147,7 @@
|
||||
<configuration>
|
||||
<argLine>@{argLine}</argLine>
|
||||
<systemPropertyVariables>
|
||||
<java.util.logging.manager
|
||||
>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||
<maven.home>${maven.home}</maven.home>
|
||||
</systemPropertyVariables>
|
||||
<forkCount>1</forkCount>
|
||||
@@ -168,8 +171,7 @@
|
||||
<systemPropertyVariables>
|
||||
<native.image.path>
|
||||
${project.build.directory}/${project.build.finalName}-runner</native.image.path>
|
||||
<java.util.logging.manager
|
||||
>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||
<maven.home>${maven.home}</maven.home>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
|
||||
@@ -25,7 +25,7 @@ public class EateryEntity extends BaseEntity {
|
||||
cascade = CascadeType.ALL,
|
||||
orphanRemoval = true
|
||||
)
|
||||
public List<MenuItemEntity> menus = new ArrayList<>();
|
||||
public List<MenuItemEntity> menuItems = new ArrayList<>();
|
||||
|
||||
public EateryEntity() {}
|
||||
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
package com.drinkool.entities;
|
||||
|
||||
import com.drinkool.dtos.AddMenuItem;
|
||||
import com.drinkool.interfaces.MenuItemInterface;
|
||||
import com.drinkool.lib.entities.BaseEntity;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.transaction.Transactional;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Entity
|
||||
@Table
|
||||
public class MenuItemEntity extends BaseEntity {
|
||||
@Getter
|
||||
@Setter
|
||||
public class MenuItemEntity extends BaseEntity implements MenuItemInterface {
|
||||
|
||||
@Column(nullable = false)
|
||||
public String name;
|
||||
@@ -18,19 +24,20 @@ public class MenuItemEntity extends BaseEntity {
|
||||
@JoinColumn(name = "eatery_id")
|
||||
public EateryEntity eatery;
|
||||
|
||||
MenuItemEntity() {}
|
||||
|
||||
MenuItemEntity(MenuItemInterface input) {
|
||||
this.setName(input.getName());
|
||||
this.setPrice(input.getPrice());
|
||||
}
|
||||
|
||||
/**
|
||||
* Phương thức tiện ích để tạo nhanh Menu Item từ tên
|
||||
*/
|
||||
@Transactional
|
||||
public static MenuItemEntity create(
|
||||
EateryEntity eatery,
|
||||
String name,
|
||||
double price
|
||||
) {
|
||||
MenuItemEntity menuItem = new MenuItemEntity();
|
||||
public static MenuItemEntity create(EateryEntity eatery, AddMenuItem input) {
|
||||
MenuItemEntity menuItem = new MenuItemEntity(input);
|
||||
|
||||
menuItem.name = name;
|
||||
menuItem.price = price;
|
||||
menuItem.eatery = eatery;
|
||||
|
||||
menuItem.persist();
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.drinkool.dtos;
|
||||
|
||||
import com.drinkool.interfaces.MenuItemInterface;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AddMenuItem implements MenuItemInterface {
|
||||
|
||||
String name;
|
||||
double price;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.drinkool.interfaces;
|
||||
|
||||
public interface MenuItemInterface {
|
||||
String getName();
|
||||
void setName(String name);
|
||||
double getPrice();
|
||||
void setPrice(double price);
|
||||
}
|
||||
Reference in New Issue
Block a user