All checks were successful
Build And Publish Production Image / Build And Publish Production Image (push) Successful in 50s
60 lines
1.8 KiB
Kotlin
60 lines
1.8 KiB
Kotlin
package com.condado.newsletter.model
|
|
|
|
import jakarta.persistence.CascadeType
|
|
import jakarta.persistence.Column
|
|
import jakarta.persistence.Entity
|
|
import jakarta.persistence.EnumType
|
|
import jakarta.persistence.Enumerated
|
|
import jakarta.persistence.FetchType
|
|
import jakarta.persistence.GeneratedValue
|
|
import jakarta.persistence.GenerationType
|
|
import jakarta.persistence.Id
|
|
import jakarta.persistence.JoinColumn
|
|
import jakarta.persistence.ManyToOne
|
|
import jakarta.persistence.OneToMany
|
|
import jakarta.persistence.Table
|
|
import org.hibernate.annotations.CreationTimestamp
|
|
import java.time.LocalDateTime
|
|
import java.util.UUID
|
|
|
|
/**
|
|
* Represents a configurable task belonging to a virtual entity.
|
|
*/
|
|
@Entity
|
|
@Table(name = "entity_tasks")
|
|
class EntityTask(
|
|
@ManyToOne(fetch = FetchType.LAZY)
|
|
@JoinColumn(name = "entity_id", nullable = false)
|
|
val virtualEntity: VirtualEntity,
|
|
|
|
@Column(nullable = false)
|
|
val name: String,
|
|
|
|
@Column(columnDefinition = "TEXT", nullable = false)
|
|
val prompt: String,
|
|
|
|
@Column(name = "schedule_cron", nullable = false)
|
|
val scheduleCron: String,
|
|
|
|
@Column(name = "email_lookback", nullable = false)
|
|
val emailLookback: String,
|
|
|
|
@Enumerated(EnumType.STRING)
|
|
@Column(name = "generation_source", nullable = false)
|
|
val generationSource: TaskGenerationSource = TaskGenerationSource.LLAMA,
|
|
|
|
@Column(nullable = false)
|
|
val active: Boolean = true,
|
|
|
|
@CreationTimestamp
|
|
@Column(name = "created_at", updatable = false, nullable = false)
|
|
val createdAt: LocalDateTime? = null
|
|
) {
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.UUID)
|
|
var id: UUID? = null
|
|
|
|
@OneToMany(mappedBy = "task", cascade = [CascadeType.ALL], orphanRemoval = true)
|
|
val generatedMessages: MutableList<GeneratedMessageHistory> = mutableListOf()
|
|
}
|