forzar conversion de tipos KAPPA a string antes de guardar en Turso
This commit is contained in:
+17
-12
@@ -124,20 +124,25 @@ export const useWorkItemsStore = defineStore('workitems', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function safeStr(v: unknown): string | null {
|
||||||
|
if (v === null || v === undefined) return null
|
||||||
|
return String(v)
|
||||||
|
}
|
||||||
|
|
||||||
async function syncHUsToTurso(projectId: number, hus: KappaUserStory[]) {
|
async function syncHUsToTurso(projectId: number, hus: KappaUserStory[]) {
|
||||||
console.log(`[Alpha] Syncing ${hus.length} HUs to Turso for project ${projectId}`)
|
console.log(`[Alpha] Syncing ${hus.length} HUs to Turso for project ${projectId}`)
|
||||||
for (const hu of hus) {
|
for (const hu of hus) {
|
||||||
try {
|
try {
|
||||||
await tauriDb.saveUserStory({
|
await tauriDb.saveUserStory({
|
||||||
id: hu.id ?? 0,
|
id: Number(hu.id) || 0,
|
||||||
initiative_id: projectId,
|
initiative_id: projectId,
|
||||||
epic_id: null,
|
epic_id: null,
|
||||||
code: hu.code ?? null,
|
code: safeStr(hu.code),
|
||||||
title: hu.title,
|
title: String(hu.title || ''),
|
||||||
description: stripHtml(hu.description || ''),
|
description: stripHtml(String(hu.description || '')),
|
||||||
acceptance_criteria: hu.acceptance_criteria ?? null,
|
acceptance_criteria: safeStr(hu.acceptance_criteria),
|
||||||
status: hu.status ?? null,
|
status: safeStr(hu.status),
|
||||||
priority: hu.priority ?? null,
|
priority: safeStr(hu.priority),
|
||||||
story_points: null,
|
story_points: null,
|
||||||
estimated_hours: null,
|
estimated_hours: null,
|
||||||
actual_hours: null,
|
actual_hours: null,
|
||||||
@@ -155,12 +160,12 @@ export const useWorkItemsStore = defineStore('workitems', () => {
|
|||||||
for (const epic of epicsData) {
|
for (const epic of epicsData) {
|
||||||
try {
|
try {
|
||||||
await tauriDb.saveEpic({
|
await tauriDb.saveEpic({
|
||||||
id: epic.id,
|
id: Number(epic.id) || 0,
|
||||||
initiative_id: projectId,
|
initiative_id: projectId,
|
||||||
code: epic.code ?? null,
|
code: safeStr(epic.code),
|
||||||
name: epic.name || epic.title || `Épica ${epic.id}`,
|
name: String(epic.name || epic.title || `Épica ${epic.id}`),
|
||||||
description: epic.description ?? null,
|
description: safeStr(epic.description),
|
||||||
status: epic.status ?? null,
|
status: safeStr(epic.status),
|
||||||
client_taker: null,
|
client_taker: null,
|
||||||
stimated_start_date: null,
|
stimated_start_date: null,
|
||||||
stimated_end_date: null,
|
stimated_end_date: null,
|
||||||
|
|||||||
Reference in New Issue
Block a user