Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c4dce6f670 | |||
| eef3fb773b |
@@ -1,3 +1,10 @@
|
|||||||
|
## [1.5.30](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.29...v1.5.30) (2026-05-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* better cart response ([#57](https://git.demonkernel.io.vn/FoodSurf/backend/issues/57)) ([5d0a047](https://git.demonkernel.io.vn/FoodSurf/backend/commit/5d0a0476029cee55f8fbe6ec6e9565ca53ee16bc))
|
||||||
|
|
||||||
## [1.5.29](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.28...v1.5.29) (2026-05-13)
|
## [1.5.29](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.28...v1.5.29) (2026-05-13)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.drinkool</groupId>
|
<groupId>com.drinkool</groupId>
|
||||||
<artifactId>drinkool</artifactId>
|
<artifactId>drinkool</artifactId>
|
||||||
<version>1.5.29</version>
|
<version>1.5.30</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.drinkool</groupId>
|
<groupId>com.drinkool</groupId>
|
||||||
<artifactId>drinkool</artifactId>
|
<artifactId>drinkool</artifactId>
|
||||||
<version>1.5.29</version>
|
<version>1.5.30</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.drinkool</groupId>
|
<groupId>com.drinkool</groupId>
|
||||||
<artifactId>drinkool</artifactId>
|
<artifactId>drinkool</artifactId>
|
||||||
<version>1.5.29</version>
|
<version>1.5.30</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
package com.drinkool.dtos;
|
package com.drinkool.dtos;
|
||||||
|
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.eclipse.microprofile.graphql.NonNull;
|
import org.eclipse.microprofile.graphql.NonNull;
|
||||||
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class CreateShift {
|
public class CreateShift {
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public String name;
|
public Date date;
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public LocalTime startTime;
|
public LocalTime startTime;
|
||||||
@@ -17,4 +18,7 @@ public class CreateShift {
|
|||||||
public LocalTime endTime;
|
public LocalTime endTime;
|
||||||
|
|
||||||
public Integer maxStaff;
|
public Integer maxStaff;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public Integer wage;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
package com.drinkool.entities;
|
package com.drinkool.entities;
|
||||||
|
|
||||||
import com.drinkool.lib.entities.BaseEntity;
|
import com.drinkool.lib.entities.BaseEntity;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.FetchType;
|
import jakarta.persistence.FetchType;
|
||||||
import jakarta.persistence.JoinColumn;
|
import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.UUID;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table
|
@Table
|
||||||
@@ -19,7 +23,7 @@ public class ShiftEntity extends BaseEntity {
|
|||||||
public EateryEntity eatery;
|
public EateryEntity eatery;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
public String name;
|
public Date date;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
public LocalTime startTime;
|
public LocalTime startTime;
|
||||||
@@ -29,4 +33,14 @@ public class ShiftEntity extends BaseEntity {
|
|||||||
|
|
||||||
@Column(nullable = true)
|
@Column(nullable = true)
|
||||||
public Integer maxStaff;
|
public Integer maxStaff;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
public Integer wage;
|
||||||
|
|
||||||
|
@OneToMany(
|
||||||
|
mappedBy = "shift",
|
||||||
|
cascade = CascadeType.ALL,
|
||||||
|
orphanRemoval = true
|
||||||
|
)
|
||||||
|
public List<ShiftRegistrationEntity> registeredStaff = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.drinkool.entities;
|
|||||||
import com.drinkool.lib.entities.BaseEntity;
|
import com.drinkool.lib.entities.BaseEntity;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -15,7 +17,8 @@ public class ShiftRegistrationEntity extends BaseEntity {
|
|||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
public UUID staffId;
|
public UUID staffId;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "shiftId")
|
||||||
public ShiftEntity shift;
|
public ShiftEntity shift;
|
||||||
|
|
||||||
public static long countByShift(UUID shiftId) {
|
public static long countByShift(UUID shiftId) {
|
||||||
|
|||||||
@@ -116,10 +116,11 @@ public class ShiftService {
|
|||||||
|
|
||||||
ShiftEntity shift = new ShiftEntity();
|
ShiftEntity shift = new ShiftEntity();
|
||||||
shift.eatery = eatery;
|
shift.eatery = eatery;
|
||||||
shift.name = input.name;
|
shift.date = input.date;
|
||||||
shift.startTime = input.startTime;
|
shift.startTime = input.startTime;
|
||||||
shift.endTime = input.endTime;
|
shift.endTime = input.endTime;
|
||||||
shift.maxStaff = input.maxStaff;
|
shift.maxStaff = input.maxStaff;
|
||||||
|
shift.wage = input.wage;
|
||||||
|
|
||||||
if (shift.endTime.isBefore(shift.startTime)) {
|
if (shift.endTime.isBefore(shift.startTime)) {
|
||||||
throw new GraphQLException("InvalidEndTime");
|
throw new GraphQLException("InvalidEndTime");
|
||||||
@@ -145,7 +146,6 @@ public class ShiftService {
|
|||||||
!shift.eatery.ownerId.toString().equals(ownerId)
|
!shift.eatery.ownerId.toString().equals(ownerId)
|
||||||
) throw new GraphQLException("InvalidShiftId");
|
) throw new GraphQLException("InvalidShiftId");
|
||||||
|
|
||||||
shift.name = input.name;
|
|
||||||
shift.startTime = input.startTime;
|
shift.startTime = input.startTime;
|
||||||
shift.endTime = input.endTime;
|
shift.endTime = input.endTime;
|
||||||
shift.maxStaff = input.maxStaff;
|
shift.maxStaff = input.maxStaff;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.drinkool.entities.ShiftRegistrationEntity;
|
|||||||
import io.quarkus.test.junit.QuarkusTest;
|
import io.quarkus.test.junit.QuarkusTest;
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -40,13 +41,12 @@ public class ShiftServiceTest {
|
|||||||
.header(InternalValue.role, Role.Manager)
|
.header(InternalValue.role, Role.Manager)
|
||||||
.header(InternalValue.userId, ownerId)
|
.header(InternalValue.userId, ownerId)
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
.body("{ \"query\": \"{ allShifts { name startTime } }\" }")
|
.body("{ \"query\": \"{ allShifts { startTime } }\" }")
|
||||||
.when()
|
.when()
|
||||||
.post("/graphql")
|
.post("/graphql")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
.body("data.allShifts", hasSize(1))
|
.body("data.allShifts", hasSize(1));
|
||||||
.body("data.allShifts[0].name", is("Ca Sáng"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- TEST MUTATIONS ---
|
// --- TEST MUTATIONS ---
|
||||||
@@ -54,18 +54,31 @@ public class ShiftServiceTest {
|
|||||||
@Test
|
@Test
|
||||||
void testCreateShift_AsManager() {
|
void testCreateShift_AsManager() {
|
||||||
String query = """
|
String query = """
|
||||||
mutation Create($input: CreateShiftInput!)
|
mutation createShift($shiftInput: CreateShiftInput!) {
|
||||||
{ createShift(shiftInput: $input) { id name } }""";
|
createShift(shiftInput: $shiftInput) {
|
||||||
|
id
|
||||||
|
date
|
||||||
|
startTime
|
||||||
|
endTime
|
||||||
|
maxStaff
|
||||||
|
wage
|
||||||
|
registeredStaff {
|
||||||
|
staffId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""";
|
||||||
|
|
||||||
Map<String, Object> input = new HashMap<>();
|
Map<String, Object> input = new HashMap<>();
|
||||||
input.put("name", "Ca Sáng");
|
input.put("date", "26/04/2026");
|
||||||
input.put("startTime", "08:00:00");
|
input.put("startTime", "08:00:00");
|
||||||
input.put("endTime", "12:00:00");
|
input.put("endTime", "12:00:00");
|
||||||
input.put("maxStaff", 5);
|
input.put("maxStaff", 5);
|
||||||
|
input.put("wage", 1000000);
|
||||||
|
|
||||||
Map<String, Object> body = new HashMap<>();
|
Map<String, Object> body = new HashMap<>();
|
||||||
body.put("query", query);
|
body.put("query", query);
|
||||||
body.put("variables", Map.of("input", input));
|
body.put("variables", Map.of("shiftInput", input));
|
||||||
|
|
||||||
UUID ownerId = createMockOwner();
|
UUID ownerId = createMockOwner();
|
||||||
createMockEatery(ownerId);
|
createMockEatery(ownerId);
|
||||||
@@ -78,8 +91,7 @@ public class ShiftServiceTest {
|
|||||||
.when()
|
.when()
|
||||||
.post("/graphql")
|
.post("/graphql")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(200)
|
.statusCode(200);
|
||||||
.body("data.createShift.name", is("Ca Sáng"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -196,9 +208,10 @@ public class ShiftServiceTest {
|
|||||||
) {
|
) {
|
||||||
ShiftEntity shift = new ShiftEntity();
|
ShiftEntity shift = new ShiftEntity();
|
||||||
shift.eatery = eatery;
|
shift.eatery = eatery;
|
||||||
shift.name = name;
|
shift.date = new Date();
|
||||||
shift.startTime = LocalTime.parse(start);
|
shift.startTime = LocalTime.parse(start);
|
||||||
shift.endTime = LocalTime.parse(end);
|
shift.endTime = LocalTime.parse(end);
|
||||||
|
shift.wage = 10000;
|
||||||
shift.maxStaff = 5;
|
shift.maxStaff = 5;
|
||||||
shift.persist();
|
shift.persist();
|
||||||
return shift;
|
return shift;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.drinkool</groupId>
|
<groupId>com.drinkool</groupId>
|
||||||
<artifactId>drinkool</artifactId>
|
<artifactId>drinkool</artifactId>
|
||||||
<version>1.5.29</version>
|
<version>1.5.30</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.drinkool</groupId>
|
<groupId>com.drinkool</groupId>
|
||||||
<artifactId>drinkool</artifactId>
|
<artifactId>drinkool</artifactId>
|
||||||
<version>1.5.29</version>
|
<version>1.5.30</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: account-pod
|
- name: account-pod
|
||||||
image: git.demonkernel.io.vn/foodsurf/account-service:1.5.29
|
image: git.demonkernel.io.vn/foodsurf/account-service:1.5.30
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: cart-pod
|
- name: cart-pod
|
||||||
image: git.demonkernel.io.vn/foodsurf/cart-service:1.5.29
|
image: git.demonkernel.io.vn/foodsurf/cart-service:1.5.30
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: eatery-pod
|
- name: eatery-pod
|
||||||
image: git.demonkernel.io.vn/foodsurf/eatery-service:1.5.29
|
image: git.demonkernel.io.vn/foodsurf/eatery-service:1.5.30
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: file-pod
|
- name: file-pod
|
||||||
image: git.demonkernel.io.vn/foodsurf/file-service:1.5.29
|
image: git.demonkernel.io.vn/foodsurf/file-service:1.5.30
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: file-volume
|
- name: file-volume
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: gateway-pod
|
- name: gateway-pod
|
||||||
image: git.demonkernel.io.vn/foodsurf/gateway-service:1.5.29
|
image: git.demonkernel.io.vn/foodsurf/gateway-service:1.5.30
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.drinkool</groupId>
|
<groupId>com.drinkool</groupId>
|
||||||
<artifactId>drinkool</artifactId>
|
<artifactId>drinkool</artifactId>
|
||||||
<version>1.5.29</version>
|
<version>1.5.30</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.drinkool</groupId>
|
<groupId>com.drinkool</groupId>
|
||||||
<artifactId>drinkool</artifactId>
|
<artifactId>drinkool</artifactId>
|
||||||
<version>1.5.29</version>
|
<version>1.5.30</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>25</maven.compiler.source>
|
<maven.compiler.source>25</maven.compiler.source>
|
||||||
|
|||||||
Reference in New Issue
Block a user