From 52c6776647f0c70dd658cbe29ac4e64ced57626a Mon Sep 17 00:00:00 2001 From: toki-ai Date: Wed, 13 Nov 2024 00:46:10 +0700 Subject: [PATCH] [PBS-84][Anh Dao] fix: dto request --- .../dto/request/RoomType/RoomTypeCreationRequest.java | 1 + src/main/java/com/swp/PodBookingSystem/entity/RoomType.java | 1 + .../java/com/swp/PodBookingSystem/service/RoomTypeService.java | 1 + 3 files changed, 3 insertions(+) diff --git a/src/main/java/com/swp/PodBookingSystem/dto/request/RoomType/RoomTypeCreationRequest.java b/src/main/java/com/swp/PodBookingSystem/dto/request/RoomType/RoomTypeCreationRequest.java index 9758919a..3fe87d24 100644 --- a/src/main/java/com/swp/PodBookingSystem/dto/request/RoomType/RoomTypeCreationRequest.java +++ b/src/main/java/com/swp/PodBookingSystem/dto/request/RoomType/RoomTypeCreationRequest.java @@ -14,4 +14,5 @@ public class RoomTypeCreationRequest { int quantity; int capacity; Integer buildingId; + String image; } diff --git a/src/main/java/com/swp/PodBookingSystem/entity/RoomType.java b/src/main/java/com/swp/PodBookingSystem/entity/RoomType.java index 6450d02c..4a958d3e 100644 --- a/src/main/java/com/swp/PodBookingSystem/entity/RoomType.java +++ b/src/main/java/com/swp/PodBookingSystem/entity/RoomType.java @@ -25,6 +25,7 @@ public class RoomType { int quantity; int capacity; @Column(nullable = true, length = 1000) + String image; @JsonIgnore diff --git a/src/main/java/com/swp/PodBookingSystem/service/RoomTypeService.java b/src/main/java/com/swp/PodBookingSystem/service/RoomTypeService.java index 352ebaef..9be56c8d 100644 --- a/src/main/java/com/swp/PodBookingSystem/service/RoomTypeService.java +++ b/src/main/java/com/swp/PodBookingSystem/service/RoomTypeService.java @@ -33,6 +33,7 @@ public class RoomTypeService { public RoomTypeResponse createRoomType(RoomTypeCreationRequest request) { Optional building = buildingRepository.findById(request.getBuildingId()); RoomType newRoomType = roomTypeMapper.toRoomType(request); + newRoomType.setImage(request.getImage()); newRoomType.setBuilding(building.orElse(null)); return roomTypeMapper.toRoomTypeResponse(roomTypeRepository.save(newRoomType)); }