feat(backend): persist tasks and generated message history

- add EntityTask domain and CRUD API backed by PostgreSQL

- relate generated messages directly to tasks and delete on task removal

- move preview generation to backend Llama endpoint

- migrate frontend task APIs from localStorage to backend endpoints

- update tests and CLAUDE rules for backend-owned LLM/persistence
This commit is contained in:
2026-03-27 02:46:56 -03:00
parent f2a16b5cf6
commit ebcea643c4
20 changed files with 1181 additions and 244 deletions

View File

@@ -0,0 +1,11 @@
package com.condado.newsletter.repository
import com.condado.newsletter.model.EntityTask
import com.condado.newsletter.model.VirtualEntity
import org.springframework.data.jpa.repository.JpaRepository
import java.util.UUID
interface EntityTaskRepository : JpaRepository<EntityTask, UUID> {
fun findAllByActiveTrue(): List<EntityTask>
fun findAllByVirtualEntity(virtualEntity: VirtualEntity): List<EntityTask>
}

View File

@@ -0,0 +1,12 @@
package com.condado.newsletter.repository
import com.condado.newsletter.model.GeneratedMessageHistory
import org.springframework.data.jpa.repository.JpaRepository
import java.util.UUID
interface GeneratedMessageHistoryRepository : JpaRepository<GeneratedMessageHistory, UUID> {
fun findAllByTask_IdOrderByCreatedAtDesc(taskId: UUID): List<GeneratedMessageHistory>
fun countByTask_Id(taskId: UUID): Long
fun deleteByIdAndTask_Id(id: UUID, taskId: UUID): Long
fun deleteAllByTask_Id(taskId: UUID)
}