Skip to content

Commit

Permalink
#18 feat: jpa 엔티티 클래스 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
SunwoongH committed Jan 16, 2025
1 parent 6391c12 commit 7b2a387
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 4 deletions.
4 changes: 2 additions & 2 deletions domain/src/main/kotlin/org/doorip/domain/trip/TodoType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.doorip.domain.trip
enum class TodoType(
private val description: String,
) {
OUR_TODO("아워 투두"),
MY_TODO("마이 투두"),
OUR("아워 투두"),
MY("마이 투두"),
;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.doorip.gateway.rdb.trip

import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.GeneratedValue
import jakarta.persistence.GenerationType
import jakarta.persistence.Id
import jakarta.persistence.Table

@Table(name = "allocator")
@Entity
internal class AllocatorJpaEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "allocator_id", columnDefinition = "bigint", nullable = false)
var id: Long = 0
protected set
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.doorip.gateway.rdb.trip

import jakarta.persistence.Column
import jakarta.persistence.Embedded
import jakarta.persistence.Entity
import jakarta.persistence.GeneratedValue
import jakarta.persistence.GenerationType
import jakarta.persistence.Id
import jakarta.persistence.Table
import org.doorip.domain.trip.PropensityTag

@Table(name = "participant")
@Entity
internal class ParticipantJpaEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "participant_id", columnDefinition = "bigint", nullable = false)
var id: Long = 0
protected set

@Embedded
lateinit var propensityTag: PropensityTag
protected set
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.doorip.gateway.rdb.trip

import jakarta.persistence.Column
import jakarta.persistence.Embeddable

@Embeddable
data class PropensityTag(
@Column(name = "style_a", columnDefinition = "integer")
val styleA: Int,
@Column(name = "style_b", columnDefinition = "integer")
val styleB: Int,
@Column(name = "style_c", columnDefinition = "integer")
val styleC: Int,
@Column(name = "style_d", columnDefinition = "integer")
val styleD: Int,
@Column(name = "style_e", columnDefinition = "integer")
val styleE: Int,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package org.doorip.gateway.rdb.trip

import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.EnumType
import jakarta.persistence.Enumerated
import jakarta.persistence.GeneratedValue
import jakarta.persistence.GenerationType
import jakarta.persistence.Id
import jakarta.persistence.Table
import java.time.LocalDate
import org.doorip.domain.trip.TodoStatus
import org.doorip.domain.trip.TodoType

@Table(name = "todo")
@Entity
internal class TodoJpaEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "todo_id", columnDefinition = "bigint", nullable = false)
var id: Long = 0
protected set

@Column(name = "title", columnDefinition = "varchar(255)", nullable = false)
lateinit var title: String
protected set

@Column(name = "end_date", columnDefinition = "date", nullable = false)
lateinit var endDate: LocalDate
protected set

@Column(name = "memo", columnDefinition = "text", nullable = true)
var memo: String? = null
protected set

@Enumerated(EnumType.STRING)
@Column(name = "secret", columnDefinition = "enum('OUR', 'MY')", nullable = false)
lateinit var todoType: TodoType
protected set

@Enumerated(EnumType.STRING)
@Column(name = "progress", columnDefinition = "enum('incomplete', 'complete')", nullable = false)
lateinit var todoStatus: TodoStatus
protected set
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.doorip.gateway.rdb.trip

import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.GeneratedValue
import jakarta.persistence.GenerationType
import jakarta.persistence.Id
import jakarta.persistence.Table
import java.time.LocalDate

@Table(name = "trip")
@Entity
internal class TripJpaEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "trip_id", columnDefinition = "bigint", nullable = false)
var id: Long = 0
protected set

@Column(name = "code", columnDefinition = "varchar(255)", nullable = false)
lateinit var code: String
protected set

@Column(name = "title", columnDefinition = "varchar(255)", nullable = false)
lateinit var title: String
protected set

@Column(name = "start_date", columnDefinition = "date", nullable = false)
lateinit var startDate: LocalDate
protected set

@Column(name = "end_date", columnDefinition = "date", nullable = false)
lateinit var endDate: LocalDate
protected set
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal class UserJpaEntity : BaseJpaEntity() {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "user_id")
@Column(name = "user_id", columnDefinition = "bigint", nullable = false)
var id: Long = 0
protected set

Expand All @@ -31,7 +31,7 @@ internal class UserJpaEntity : BaseJpaEntity() {
lateinit var intro: String
protected set

@Column(name = "result", columnDefinition = "integer")
@Column(name = "result", columnDefinition = "integer", nullable = true)
var result: Int? = null

@Enumerated(EnumType.STRING)
Expand Down

0 comments on commit 7b2a387

Please sign in to comment.