feat: 새로운 테마 스키마 정의 및 엔티티 추가

This commit is contained in:
이상진 2025-09-03 10:45:18 +09:00
parent 1972a5ca63
commit 6b2f8d9488
3 changed files with 68 additions and 0 deletions

View File

@ -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
}

View File

@ -39,6 +39,7 @@ create table if not exists theme (
available_minutes smallint not null, available_minutes smallint not null,
expected_minutes_from smallint not null, expected_minutes_from smallint not null,
expected_minutes_to smallint not null, expected_minutes_to smallint not null,
is_open boolean not null,
created_at timestamp not null, created_at timestamp not null,
created_by bigint not null, created_by bigint not null,
updated_at timestamp not null, updated_at timestamp not null,

View File

@ -41,6 +41,7 @@ create table if not exists theme (
available_minutes smallint not null, available_minutes smallint not null,
expected_minutes_from smallint not null, expected_minutes_from smallint not null,
expected_minutes_to smallint not null, expected_minutes_to smallint not null,
is_open tinyint(1) not null,
created_at datetime(6) not null, created_at datetime(6) not null,
created_by bigint not null, created_by bigint not null,
updated_at datetime(6) not null, updated_at datetime(6) not null,