diff --git a/backend/pom.xml b/backend/pom.xml
index 8495f0c2..d2c9b0c4 100644
--- a/backend/pom.xml
+++ b/backend/pom.xml
@@ -95,7 +95,7 @@
com.google.guava
guava
- 31.1-jre
+ 32.0.0-jre
diff --git a/backend/src/main/java/com/ecommerce/backend/shared/config/OpenApiConfig.java b/backend/src/main/java/com/ecommerce/backend/shared/config/OpenApiConfig.java
index 8babfa3e..e137286f 100644
--- a/backend/src/main/java/com/ecommerce/backend/shared/config/OpenApiConfig.java
+++ b/backend/src/main/java/com/ecommerce/backend/shared/config/OpenApiConfig.java
@@ -3,6 +3,7 @@
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.servers.Server;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.security.SecurityRequirement;
@@ -15,7 +16,17 @@
info = @Info(
title = "Ecommerce Application API",
version = "1.0"
- )
+ ),
+ servers = {
+ @Server(
+ description = "Local Server",
+ url = "http://localhost:8080"
+ ),
+ @Server(
+ description = "Railway Server",
+ url = "https://e-commerce-production-0d6c.up.railway.app"
+ )
+ }
)
public class OpenApiConfig {
@Bean
diff --git a/backend/src/main/resources/application-dev.yml b/backend/src/main/resources/application-dev.yml
index 3ec8d7df..4c54c215 100644
--- a/backend/src/main/resources/application-dev.yml
+++ b/backend/src/main/resources/application-dev.yml
@@ -3,6 +3,10 @@ spring:
url: jdbc:mysql://localhost:3333/myecommerce
username: root
password: root
+ jpa:
+ show-sql: true
+ hibernate:
+ ddl-auto: update
env-variable:
url: http://localhost:8080
diff --git a/backend/src/main/resources/application-prod.yml b/backend/src/main/resources/application-prod.yml
index e69de29b..c90be0b4 100644
--- a/backend/src/main/resources/application-prod.yml
+++ b/backend/src/main/resources/application-prod.yml
@@ -0,0 +1,15 @@
+server:
+ port: 5000
+
+spring:
+ datasource:
+ url: jdbc:mysql://containers-us-west-195.railway.app:6254/myecommerce
+ username: root
+ password: 7VP7XGaoGdd30qvSYf3T
+ jpa:
+ show-sql: false
+ hibernate:
+ ddl-auto: none
+
+env-variable:
+ url: https://e-commerce-production-0d6c.up.railway.app
diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml
index 99748b07..bd9ad275 100644
--- a/backend/src/main/resources/application.yml
+++ b/backend/src/main/resources/application.yml
@@ -10,7 +10,6 @@ spring:
web-application-type: servlet
jpa:
hibernate:
- ddl-auto: update
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
properties:
@@ -22,7 +21,6 @@ spring:
order_updates: true
format_sql: true
dialect: org.hibernate.dialect.MySQLDialect
- show-sql: true
open-in-view: true
mail:
host: smtp.gmail.com
@@ -41,7 +39,7 @@ spring:
starttls:
enable: true
profiles:
- active: dev
+ active: prod
springdoc:
api-docs:
diff --git a/backend/src/test/java/com/ecommerce/backend/service/orderdetail/OrderDetailServiceImplTest.java b/backend/src/test/java/com/ecommerce/backend/service/orderdetail/OrderDetailServiceImplTest.java
index c9f4ebc6..0ec975e0 100644
--- a/backend/src/test/java/com/ecommerce/backend/service/orderdetail/OrderDetailServiceImplTest.java
+++ b/backend/src/test/java/com/ecommerce/backend/service/orderdetail/OrderDetailServiceImplTest.java
@@ -131,21 +131,6 @@ void fetchOrderDetailByOrderIDAndProductID() {
assertThat(actual).isEqualTo(orderDetail);
}
- @Test
- void whenFetchOrderDetailByOrderIDAndProductID_butNotExistOrderDetailID_thenThrowException() {
- // Given
- var id = BigInteger.valueOf(1);
-
- // When
- when(orderDetailDAO.selectOrderDetailByID(new OrderDetailID(id, id)))
- .thenReturn(Optional.empty());
-
- // Then
- assertThatThrownBy(() -> orderDetailService
- .fetchOrderDetailByOrderIDAndProductID(new OrderDetailID(id, id)))
- .isInstanceOf(ResourceNotFoundException.class);
- }
-
@Test
void addOrderDetail() {
// Given
diff --git a/backend/src/test/java/com/ecommerce/backend/service/product/ProductServiceImplTest.java b/backend/src/test/java/com/ecommerce/backend/service/product/ProductServiceImplTest.java
index c540aa6d..8daae6c7 100644
--- a/backend/src/test/java/com/ecommerce/backend/service/product/ProductServiceImplTest.java
+++ b/backend/src/test/java/com/ecommerce/backend/service/product/ProductServiceImplTest.java
@@ -48,6 +48,7 @@ void fetchAllProducts() {
}
@Test
+ // TODO: refactor this test
void fetchAllProductsByCategoryID() {
// Given
var id = BigInteger.valueOf(1);
@@ -86,6 +87,7 @@ void whenFetchAllProductsByCategoryID_butCategoryNotFound_thenThrowException() {
}
@Test
+ // TODO: refactor product hold category id only
void fetchProductByProductID() {
// Given
var id = BigInteger.valueOf(1);