66 lines
2.1 KiB
Kotlin
66 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 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 AudioContentType {
|
|
INDIVIDUAL, BUNDLE
|
|
}
|
|
|
|
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,
|
|
val price: Int = 0,
|
|
@Enumerated(value = EnumType.STRING)
|
|
val type: AudioContentType = AudioContentType.INDIVIDUAL,
|
|
val isGeneratePreview: Boolean = true,
|
|
var isOnlyRental: Boolean = false,
|
|
var isAdult: Boolean = false,
|
|
var isCommentAvailable: 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.EAGER)
|
|
@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()
|
|
|
|
@OneToMany(mappedBy = "child", cascade = [CascadeType.ALL])
|
|
var children: MutableList<BundleAudioContent> = mutableListOf()
|
|
}
|