diff --git a/src/main/java/com/ajou/hertz/domain/practice_room/controller/PracticeRoomController.java b/src/main/java/com/ajou/hertz/domain/practice_room/controller/PracticeRoomController.java index 085c91d..fbd3a58 100644 --- a/src/main/java/com/ajou/hertz/domain/practice_room/controller/PracticeRoomController.java +++ b/src/main/java/com/ajou/hertz/domain/practice_room/controller/PracticeRoomController.java @@ -18,6 +18,7 @@ import com.ajou.hertz.domain.practice_room.dto.request.CreateNewPracticeRoomRequest; import com.ajou.hertz.domain.practice_room.dto.response.PracticeRoomResponse; import com.ajou.hertz.domain.practice_room.service.PracticeRoomCommandService; +import com.ajou.hertz.domain.practice_room.service.PracticeRoomQueryService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; @@ -35,6 +36,7 @@ public class PracticeRoomController { private final PracticeRoomCommandService practiceRoomCommandService; + private final PracticeRoomQueryService practiceRoomQueryService; @Operation( summary = "합주실 매물 등록", diff --git a/src/main/java/com/ajou/hertz/domain/practice_room/dto/request/CreateNewPracticeRoomRequest.java b/src/main/java/com/ajou/hertz/domain/practice_room/dto/request/CreateNewPracticeRoomRequest.java index cd6da4b..f246f85 100644 --- a/src/main/java/com/ajou/hertz/domain/practice_room/dto/request/CreateNewPracticeRoomRequest.java +++ b/src/main/java/com/ajou/hertz/domain/practice_room/dto/request/CreateNewPracticeRoomRequest.java @@ -80,12 +80,6 @@ public class CreateNewPracticeRoomRequest { @Schema(description = "해시태그(각 해시태그마다 최대 10글자)", example = "[\"밴드\", \"락\"]") private List<@NotBlank @Length(max = 10) String> hashtags; - public PracticeRoom toEntity(User seller) { - return PracticeRoom.create(seller, getTitle(), getTradeAddress().toEntity(), getCoordinate().toEntity(), - getHasSoundEquipment(), getHasInstrument(), getPricePerDay(), getPricePerHour(), getPricePerMonth(), - getCapacity(), getSize(), getHasParkingLot(), getDescription()); - } - public CreateNewPracticeRoomRequest( String title, FullAddressRequest tradeAddress, @@ -118,5 +112,11 @@ public CreateNewPracticeRoomRequest( this.hashtags = hashtags; } + public PracticeRoom toEntity(User seller) { + return PracticeRoom.create(seller, getTitle(), getTradeAddress().toEntity(), getCoordinate().toEntity(), + getHasSoundEquipment(), getHasInstrument(), getPricePerDay(), getPricePerHour(), getPricePerMonth(), + getCapacity(), getSize(), getHasParkingLot(), getDescription()); + } + } diff --git a/src/main/java/com/ajou/hertz/domain/practice_room/entity/PracticeRoom.java b/src/main/java/com/ajou/hertz/domain/practice_room/entity/PracticeRoom.java index 9e4bf96..a68bd1e 100644 --- a/src/main/java/com/ajou/hertz/domain/practice_room/entity/PracticeRoom.java +++ b/src/main/java/com/ajou/hertz/domain/practice_room/entity/PracticeRoom.java @@ -26,57 +26,42 @@ @Entity public class PracticeRoom extends TimeTrackedBaseEntity { + @Embedded + private final PracticeRoomImages images = new PracticeRoomImages(); + @Embedded + private final PracticeRoomHashtags hashtags = new PracticeRoomHashtags(); @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "practice_room_id", nullable = false) private Long id; - @JoinColumn(name = "seller_id", nullable = false) @ManyToOne(fetch = FetchType.LAZY) private User seller; - @Column(nullable = false) private String title; - @Embedded private FullAddress tradeAddress; - @Column(nullable = false) private Boolean hasSoundEquipment; - @Column(nullable = false) private Boolean hasInstrument; - @Column(nullable = false) private Integer pricePerDay; - @Column(nullable = false) private Integer pricePerHour; - @Column(nullable = false) private Integer pricePerMonth; - @Column(nullable = false) private Short capacity; - @Column(nullable = false) private String size; - @Column(nullable = false) private Boolean hasParkingLot; - @Embedded private PracticeRoomDescription description; - @Embedded private Coordinate coordinate; - @Embedded - private final PracticeRoomImages images = new PracticeRoomImages(); - - @Embedded - private final PracticeRoomHashtags hashtags = new PracticeRoomHashtags(); - protected PracticeRoom( Long id, User seller, diff --git a/src/main/java/com/ajou/hertz/domain/practice_room/entity/PracticeRoomImage.java b/src/main/java/com/ajou/hertz/domain/practice_room/entity/PracticeRoomImage.java index e16f7f2..7ba03c1 100644 --- a/src/main/java/com/ajou/hertz/domain/practice_room/entity/PracticeRoomImage.java +++ b/src/main/java/com/ajou/hertz/domain/practice_room/entity/PracticeRoomImage.java @@ -37,12 +37,6 @@ private PracticeRoomImage(Long id, PracticeRoom practiceRoom, String originalNam public static PracticeRoomImage create(PracticeRoom practiceRoom, String originalName, String storedName, String url) { - return new PracticeRoomImage( - null, - practiceRoom, - originalName, - storedName, - url - ); + return new PracticeRoomImage(null, practiceRoom, originalName, storedName, url); } }