generated from pricelees/issue-pr-template
[#37] 테마 스키마 재정의 #38
@ -0,0 +1,66 @@
|
||||
package roomescape.theme.infrastructure.persistence.v2
|
||||
|
||||
import jakarta.persistence.Column
|
||||
import jakarta.persistence.Entity
|
||||
import jakarta.persistence.EnumType
|
||||
import jakarta.persistence.Enumerated
|
||||
import jakarta.persistence.Table
|
||||
import roomescape.common.entity.AuditingBaseEntity
|
||||
|
||||
@Entity
|
||||
@Table(name = "theme")
|
||||
class ThemeEntityV2(
|
||||
id: Long,
|
||||
|
||||
var name: String,
|
||||
var description: String,
|
||||
var thumbnailUrl: String,
|
||||
|
||||
@Enumerated(value = EnumType.STRING)
|
||||
var difficulty: Difficulty,
|
||||
|
||||
var price: Int,
|
||||
var minParticipants: Short,
|
||||
var maxParticipants: Short,
|
||||
var availableMinutes: Short,
|
||||
var expectedMinutesFrom: Short,
|
||||
var expectedMinutesTo: Short,
|
||||
|
||||
@Column(columnDefinition = "TINYINT", length = 1)
|
||||
var isOpen: Boolean
|
||||
) : AuditingBaseEntity(id) {
|
||||
|
||||
fun modifyIfNotNull(
|
||||
name: String?,
|
||||
description: String?,
|
||||
thumbnailUrl: String?,
|
||||
difficulty: Difficulty?,
|
||||
price: Int?,
|
||||
minParticipants: Short?,
|
||||
maxParticipants: Short?,
|
||||
availableMinutes: Short?,
|
||||
expectedMinutesFrom: Short?,
|
||||
expectedMinutesTo: Short?,
|
||||
isOpen: Boolean?
|
||||
) {
|
||||
name?.let { this.name = it }
|
||||
description?.let { this.description = it }
|
||||
thumbnailUrl?.let { this.thumbnailUrl = it }
|
||||
difficulty?.let { this.difficulty = it }
|
||||
price?.let { this.price = it }
|
||||
minParticipants?.let { this.minParticipants = it }
|
||||
maxParticipants?.let { this.maxParticipants = it }
|
||||
availableMinutes?.let { this.availableMinutes = it }
|
||||
expectedMinutesFrom?.let { this.expectedMinutesFrom = it }
|
||||
expectedMinutesTo?.let { this.expectedMinutesTo = it }
|
||||
isOpen?.let { this.isOpen = it }
|
||||
}
|
||||
}
|
||||
|
||||
enum class Difficulty {
|
||||
VERY_EASY,
|
||||
EASY,
|
||||
NORMAL,
|
||||
HARD,
|
||||
VERY_HARD
|
||||
}
|
||||
@ -39,6 +39,7 @@ create table if not exists theme (
|
||||
available_minutes smallint not null,
|
||||
expected_minutes_from smallint not null,
|
||||
expected_minutes_to smallint not null,
|
||||
is_open boolean not null,
|
||||
created_at timestamp not null,
|
||||
created_by bigint not null,
|
||||
updated_at timestamp not null,
|
||||
|
||||
@ -41,6 +41,7 @@ create table if not exists theme (
|
||||
available_minutes smallint not null,
|
||||
expected_minutes_from smallint not null,
|
||||
expected_minutes_to smallint not null,
|
||||
is_open tinyint(1) not null,
|
||||
created_at datetime(6) not null,
|
||||
created_by bigint not null,
|
||||
updated_at datetime(6) not null,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user