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[]) {
|
||||
console.log(`[Alpha] Syncing ${hus.length} HUs to Turso for project ${projectId}`)
|
||||
for (const hu of hus) {
|
||||
try {
|
||||
await tauriDb.saveUserStory({
|
||||
id: hu.id ?? 0,
|
||||
id: Number(hu.id) || 0,
|
||||
initiative_id: projectId,
|
||||
epic_id: null,
|
||||
code: hu.code ?? null,
|
||||
title: hu.title,
|
||||
description: stripHtml(hu.description || ''),
|
||||
acceptance_criteria: hu.acceptance_criteria ?? null,
|
||||
status: hu.status ?? null,
|
||||
priority: hu.priority ?? null,
|
||||
code: safeStr(hu.code),
|
||||
title: String(hu.title || ''),
|
||||
description: stripHtml(String(hu.description || '')),
|
||||
acceptance_criteria: safeStr(hu.acceptance_criteria),
|
||||
status: safeStr(hu.status),
|
||||
priority: safeStr(hu.priority),
|
||||
story_points: null,
|
||||
estimated_hours: null,
|
||||
actual_hours: null,
|
||||
@@ -155,12 +160,12 @@ export const useWorkItemsStore = defineStore('workitems', () => {
|
||||
for (const epic of epicsData) {
|
||||
try {
|
||||
await tauriDb.saveEpic({
|
||||
id: epic.id,
|
||||
id: Number(epic.id) || 0,
|
||||
initiative_id: projectId,
|
||||
code: epic.code ?? null,
|
||||
name: epic.name || epic.title || `Épica ${epic.id}`,
|
||||
description: epic.description ?? null,
|
||||
status: epic.status ?? null,
|
||||
code: safeStr(epic.code),
|
||||
name: String(epic.name || epic.title || `Épica ${epic.id}`),
|
||||
description: safeStr(epic.description),
|
||||
status: safeStr(epic.status),
|
||||
client_taker: null,
|
||||
stimated_start_date: null,
|
||||
stimated_end_date: null,
|
||||
|
||||
Reference in New Issue
Block a user