agregar logs a sync Turso para diagnosticar guardado de HUs

This commit is contained in:
2026-05-27 18:25:18 -05:00
parent e905fa5712
commit 023d4694bd
+41 -31
View File
@@ -124,43 +124,53 @@ export const useWorkItemsStore = defineStore('workitems', () => {
} }
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}`)
for (const hu of hus) { for (const hu of hus) {
await tauriDb.saveUserStory({ try {
id: hu.id ?? 0, await tauriDb.saveUserStory({
initiative_id: projectId, id: hu.id ?? 0,
epic_id: null, initiative_id: projectId,
code: hu.code ?? null, epic_id: null,
title: hu.title, code: hu.code ?? null,
description: stripHtml(hu.description || ''), title: hu.title,
acceptance_criteria: hu.acceptance_criteria ?? null, description: stripHtml(hu.description || ''),
status: hu.status ?? null, acceptance_criteria: hu.acceptance_criteria ?? null,
priority: hu.priority ?? null, status: hu.status ?? null,
story_points: null, priority: hu.priority ?? null,
estimated_hours: null, story_points: null,
actual_hours: null, estimated_hours: null,
assigned_to: null, actual_hours: null,
created_at: null, assigned_to: null,
}).catch(() => {}) created_at: null,
})
} catch (e) {
console.error(`[Alpha] Failed to save HU ${hu.id}:`, e)
}
} }
} }
async function syncEpicsToTurso(projectId: number, epicsData: KappaEpicDevelopment[]) { async function syncEpicsToTurso(projectId: number, epicsData: KappaEpicDevelopment[]) {
console.log(`[Alpha] Syncing ${epicsData.length} epics to Turso for project ${projectId}`)
for (const epic of epicsData) { for (const epic of epicsData) {
await tauriDb.saveEpic({ try {
id: epic.id, await tauriDb.saveEpic({
initiative_id: projectId, id: epic.id,
code: epic.code ?? null, initiative_id: projectId,
name: epic.name || epic.title || `Épica ${epic.id}`, code: epic.code ?? null,
description: epic.description ?? null, name: epic.name || epic.title || `Épica ${epic.id}`,
status: epic.status ?? null, description: epic.description ?? null,
client_taker: null, status: epic.status ?? null,
stimated_start_date: null, client_taker: null,
stimated_end_date: null, stimated_start_date: null,
start_date: null, stimated_end_date: null,
end_date: null, start_date: null,
created_at: null, end_date: null,
updated_at: null, created_at: null,
}).catch(() => {}) updated_at: null,
})
} catch (e) {
console.error(`[Alpha] Failed to save epic ${epic.id}:`, e)
}
} }
} }