chore: update
This commit is contained in:
@@ -161,7 +161,7 @@ public class ShiftService {
|
|||||||
@Description("Quản lý xóa một ca trực")
|
@Description("Quản lý xóa một ca trực")
|
||||||
@RolesAllowed(Role.Manager)
|
@RolesAllowed(Role.Manager)
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean deleteShift(@Name("id") Long id) throws GraphQLException {
|
public boolean deleteShift(@Name("id") UUID id) throws GraphQLException {
|
||||||
String ownerId = request.getHeader(InternalValue.userId);
|
String ownerId = request.getHeader(InternalValue.userId);
|
||||||
|
|
||||||
EateryEntity eatery = EateryEntity.findByOwnerId(ownerId);
|
EateryEntity eatery = EateryEntity.findByOwnerId(ownerId);
|
||||||
|
|||||||
@@ -145,6 +145,8 @@ public class ShiftServiceTest {
|
|||||||
given()
|
given()
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
.header(InternalValue.userId, staffId.toString())
|
.header(InternalValue.userId, staffId.toString())
|
||||||
|
.header(InternalValue.managerId, ownerId.toString())
|
||||||
|
.header(InternalValue.role, Role.Staff)
|
||||||
.body("{ \"query\": \"" + mutation + "\" }")
|
.body("{ \"query\": \"" + mutation + "\" }")
|
||||||
.when()
|
.when()
|
||||||
.post("/graphql")
|
.post("/graphql")
|
||||||
@@ -164,8 +166,7 @@ public class ShiftServiceTest {
|
|||||||
"12:00:00",
|
"12:00:00",
|
||||||
eatery
|
eatery
|
||||||
);
|
);
|
||||||
UUID staffId = UUID.randomUUID();
|
registerStaffToShift(UUID.randomUUID(), shift);
|
||||||
registerStaffToShift(staffId, shift);
|
|
||||||
|
|
||||||
String mutation = String.format(
|
String mutation = String.format(
|
||||||
"mutation { deleteShift(id: \\\"%s\\\") }",
|
"mutation { deleteShift(id: \\\"%s\\\") }",
|
||||||
@@ -173,6 +174,8 @@ public class ShiftServiceTest {
|
|||||||
);
|
);
|
||||||
|
|
||||||
given()
|
given()
|
||||||
|
.header(InternalValue.userId, ownerId.toString())
|
||||||
|
.header(InternalValue.role, Role.Manager)
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
.body("{ \"query\": \"" + mutation + "\" }")
|
.body("{ \"query\": \"" + mutation + "\" }")
|
||||||
.when()
|
.when()
|
||||||
|
|||||||
Reference in New Issue
Block a user