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