-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
233 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/main/java/com/ajou/hertz/domain/practice_room/dto/PracticeRoomImageDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.ajou.hertz.domain.practice_room.dto; | ||
|
||
import com.ajou.hertz.domain.practice_room.entity.PracticeRoomImage; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Getter | ||
|
||
public class PracticeRoomImageDto { | ||
|
||
private Long id; | ||
private String name; | ||
private String url; | ||
|
||
public static PracticeRoomImageDto from(PracticeRoomImage practiceRoomImage) { | ||
return new PracticeRoomImageDto( | ||
practiceRoomImage.getId(), | ||
practiceRoomImage.getOriginalName(), | ||
practiceRoomImage.getUrl() | ||
); | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
src/main/java/com/ajou/hertz/domain/practice_room/entity/PracticeRoom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package com.ajou.hertz.domain.practice_room.entity; | ||
|
||
import com.ajou.hertz.common.entity.Coordinate; | ||
import com.ajou.hertz.common.entity.FullAddress; | ||
import com.ajou.hertz.common.entity.TimeTrackedBaseEntity; | ||
import com.ajou.hertz.domain.user.entity.User; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Embedded; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Getter | ||
@Entity | ||
public class PracticeRoom extends TimeTrackedBaseEntity { | ||
|
||
@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; | ||
|
||
@Column(nullable = false) | ||
@Embedded | ||
private FullAddress fullAddress; | ||
|
||
@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; | ||
|
||
@Column(length = 1000, nullable = false) | ||
private String description; | ||
|
||
@Embedded | ||
private Coordinate coordinate; | ||
|
||
@Embedded | ||
private PracticeRoomImages images = new PracticeRoomImages(); | ||
|
||
@Embedded | ||
private PracticeRoomHashtags hashtags = new PracticeRoomHashtags(); | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/com/ajou/hertz/domain/practice_room/entity/PracticeRoomHashtag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.ajou.hertz.domain.practice_room.entity; | ||
|
||
import com.ajou.hertz.common.entity.BaseEntity; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Getter | ||
@Entity | ||
public class PracticeRoomHashtag extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "practice_room_hashtag_id", nullable = false) | ||
private Long id; | ||
|
||
@JoinColumn(name = "practice_room_id", nullable = false) | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
private PracticeRoom practiceRoom; | ||
|
||
@Column(length = 10, nullable = false) | ||
private String content; | ||
|
||
public static PracticeRoomHashtag create(PracticeRoom concertHall, String content) { | ||
return new PracticeRoomHashtag(null, concertHall, content); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/ajou/hertz/domain/practice_room/entity/PracticeRoomHashtags.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.ajou.hertz.domain.practice_room.entity; | ||
|
||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
import jakarta.persistence.Embeddable; | ||
import jakarta.persistence.OneToMany; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.NoArgsConstructor; | ||
|
||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Embeddable | ||
public class PracticeRoomHashtags { | ||
|
||
@OneToMany(mappedBy = "practiceRoom") | ||
private List<PracticeRoomHashtag> content = new LinkedList<>(); | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/com/ajou/hertz/domain/practice_room/entity/PracticeRoomImage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.ajou.hertz.domain.practice_room.entity; | ||
|
||
import com.ajou.hertz.common.entity.FileEntity; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Getter | ||
@Entity | ||
|
||
public class PracticeRoomImage extends FileEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "concert_hall_image_id", nullable = false) | ||
private Long id; | ||
|
||
@JoinColumn(name = "practice_room", nullable = false) | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
private PracticeRoom practiceRoom; | ||
|
||
private PracticeRoomImage(Long id, PracticeRoom practiceRoom, String originalName, String storedName, String url) { | ||
super(originalName, storedName, url); | ||
this.id = id; | ||
this.practiceRoom = practiceRoom; | ||
} | ||
|
||
public static PracticeRoomImage create(PracticeRoom practiceRoom, String originalName, String storedName, | ||
String url) { | ||
return new PracticeRoomImage( | ||
null, | ||
practiceRoom, | ||
originalName, | ||
storedName, | ||
url | ||
); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/ajou/hertz/domain/practice_room/entity/PracticeRoomImages.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.ajou.hertz.domain.practice_room.entity; | ||
|
||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
import jakarta.persistence.Embeddable; | ||
import jakarta.persistence.OneToMany; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.NoArgsConstructor; | ||
|
||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Embeddable | ||
|
||
public class PracticeRoomImages { | ||
|
||
@OneToMany(mappedBy = "practiceRoom") | ||
private List<PracticeRoomImage> content = new LinkedList<>(); | ||
} |