68 lines
2.1 KiB
Kotlin
68 lines
2.1 KiB
Kotlin
package kr.co.vividnext.sodalive.content
|
|
|
|
import kr.co.vividnext.sodalive.common.BaseEntity
|
|
import kr.co.vividnext.sodalive.content.hashtag.AudioContentHashTag
|
|
import kr.co.vividnext.sodalive.content.main.curation.AudioContentCuration
|
|
import kr.co.vividnext.sodalive.content.theme.AudioContentTheme
|
|
import kr.co.vividnext.sodalive.member.Member
|
|
import java.time.LocalDateTime
|
|
import javax.persistence.CascadeType
|
|
import javax.persistence.Column
|
|
import javax.persistence.Entity
|
|
import javax.persistence.EnumType
|
|
import javax.persistence.Enumerated
|
|
import javax.persistence.FetchType
|
|
import javax.persistence.JoinColumn
|
|
import javax.persistence.ManyToOne
|
|
import javax.persistence.OneToMany
|
|
import javax.persistence.OneToOne
|
|
import javax.persistence.Table
|
|
|
|
enum class PurchaseOption {
|
|
BOTH, BUY_ONLY, RENT_ONLY
|
|
}
|
|
|
|
enum class SortType {
|
|
NEWEST, PRICE_HIGH, PRICE_LOW
|
|
}
|
|
|
|
@Entity
|
|
@Table(name = "content")
|
|
data class AudioContent(
|
|
var title: String,
|
|
@Column(columnDefinition = "TEXT", nullable = false)
|
|
var detail: String,
|
|
var price: Int = 0,
|
|
var releaseDate: LocalDateTime? = null,
|
|
val limited: Int? = null,
|
|
var remaining: Int? = null,
|
|
@Enumerated(value = EnumType.STRING)
|
|
val purchaseOption: PurchaseOption = PurchaseOption.BOTH,
|
|
val isGeneratePreview: Boolean = true,
|
|
var isOnlyRental: Boolean = false,
|
|
var isAdult: Boolean = false,
|
|
var isCommentAvailable: Boolean = true,
|
|
var isFullDetailVisible: Boolean = true
|
|
) : BaseEntity() {
|
|
var isActive: Boolean = false
|
|
var content: String? = null
|
|
var coverImage: String? = null
|
|
|
|
@OneToOne(fetch = FetchType.EAGER)
|
|
@JoinColumn(name = "theme_id", nullable = false)
|
|
var theme: AudioContentTheme? = null
|
|
|
|
@ManyToOne(fetch = FetchType.LAZY)
|
|
@JoinColumn(name = "curation_id", nullable = true)
|
|
var curation: AudioContentCuration? = null
|
|
|
|
@OneToOne(fetch = FetchType.LAZY)
|
|
@JoinColumn(name = "member_id", nullable = false)
|
|
var member: Member? = null
|
|
|
|
var duration: String? = null
|
|
|
|
@OneToMany(mappedBy = "audioContent", cascade = [CascadeType.ALL])
|
|
val audioContentHashTags: MutableList<AudioContentHashTag> = mutableListOf()
|
|
}
|