diff --git a/src/stores/workitems.ts b/src/stores/workitems.ts index 500b5fc..c58337d 100644 --- a/src/stores/workitems.ts +++ b/src/stores/workitems.ts @@ -124,43 +124,53 @@ export const useWorkItemsStore = defineStore('workitems', () => { } async function syncHUsToTurso(projectId: number, hus: KappaUserStory[]) { + console.log(`[Alpha] Syncing ${hus.length} HUs to Turso for project ${projectId}`) for (const hu of hus) { - await tauriDb.saveUserStory({ - id: 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, - story_points: null, - estimated_hours: null, - actual_hours: null, - assigned_to: null, - created_at: null, - }).catch(() => {}) + try { + await tauriDb.saveUserStory({ + id: 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, + story_points: null, + estimated_hours: null, + actual_hours: null, + assigned_to: null, + created_at: null, + }) + } catch (e) { + console.error(`[Alpha] Failed to save HU ${hu.id}:`, e) + } } } async function syncEpicsToTurso(projectId: number, epicsData: KappaEpicDevelopment[]) { + console.log(`[Alpha] Syncing ${epicsData.length} epics to Turso for project ${projectId}`) for (const epic of epicsData) { - await tauriDb.saveEpic({ - id: epic.id, - initiative_id: projectId, - code: epic.code ?? null, - name: epic.name || epic.title || `Épica ${epic.id}`, - description: epic.description ?? null, - status: epic.status ?? null, - client_taker: null, - stimated_start_date: null, - stimated_end_date: null, - start_date: null, - end_date: null, - created_at: null, - updated_at: null, - }).catch(() => {}) + try { + await tauriDb.saveEpic({ + id: epic.id, + initiative_id: projectId, + code: epic.code ?? null, + name: epic.name || epic.title || `Épica ${epic.id}`, + description: epic.description ?? null, + status: epic.status ?? null, + client_taker: null, + stimated_start_date: null, + stimated_end_date: null, + start_date: null, + end_date: null, + created_at: null, + updated_at: null, + }) + } catch (e) { + console.error(`[Alpha] Failed to save epic ${epic.id}:`, e) + } } }